mirror of
https://github.com/DarthAffe/ScreenCapture.NET.git
synced 2025-12-13 05:48:39 +00:00
Updated Vortice to 2.3
This commit is contained in:
parent
21f0b7e804
commit
c01c1fea0d
19
ScreenCapture.NET/DirectX/DX11CompatibilityExtensions.cs
Normal file
19
ScreenCapture.NET/DirectX/DX11CompatibilityExtensions.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using Vortice.DXGI;
|
||||||
|
|
||||||
|
namespace ScreenCapture.NET;
|
||||||
|
|
||||||
|
// DarthAffe 22.02.2023: These helper-methods where removed from Vortice and are readded here since they are used.
|
||||||
|
internal static class DX11CompatibilityExtensions
|
||||||
|
{
|
||||||
|
public static IDXGIAdapter1 GetAdapter1(this IDXGIFactory1 factory, int index)
|
||||||
|
{
|
||||||
|
factory.EnumAdapters1(index, out IDXGIAdapter1 adapter).CheckError();
|
||||||
|
return adapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IDXGIOutput GetOutput(this IDXGIAdapter1 adapter, int index)
|
||||||
|
{
|
||||||
|
adapter.EnumOutputs(index, out IDXGIOutput output).CheckError();
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -306,12 +306,12 @@ public sealed class DX11ScreenCapture : IScreenCapture
|
|||||||
{
|
{
|
||||||
Texture2DDescription stagingTextureDesc = new()
|
Texture2DDescription stagingTextureDesc = new()
|
||||||
{
|
{
|
||||||
CpuAccessFlags = CpuAccessFlags.Read,
|
CPUAccessFlags = CpuAccessFlags.Read,
|
||||||
BindFlags = BindFlags.None,
|
BindFlags = BindFlags.None,
|
||||||
Format = Format.B8G8R8A8_UNorm,
|
Format = Format.B8G8R8A8_UNorm,
|
||||||
Width = captureZone.Width,
|
Width = captureZone.Width,
|
||||||
Height = captureZone.Height,
|
Height = captureZone.Height,
|
||||||
OptionFlags = ResourceOptionFlags.None,
|
MiscFlags = ResourceOptionFlags.None,
|
||||||
MipLevels = 1,
|
MipLevels = 1,
|
||||||
ArraySize = 1,
|
ArraySize = 1,
|
||||||
SampleDescription = { Count = 1, Quality = 0 },
|
SampleDescription = { Count = 1, Quality = 0 },
|
||||||
@ -325,12 +325,12 @@ public sealed class DX11ScreenCapture : IScreenCapture
|
|||||||
{
|
{
|
||||||
Texture2DDescription scalingTextureDesc = new()
|
Texture2DDescription scalingTextureDesc = new()
|
||||||
{
|
{
|
||||||
CpuAccessFlags = CpuAccessFlags.None,
|
CPUAccessFlags = CpuAccessFlags.None,
|
||||||
BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource,
|
BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource,
|
||||||
Format = Format.B8G8R8A8_UNorm,
|
Format = Format.B8G8R8A8_UNorm,
|
||||||
Width = captureZone.UnscaledWidth,
|
Width = captureZone.UnscaledWidth,
|
||||||
Height = captureZone.UnscaledHeight,
|
Height = captureZone.UnscaledHeight,
|
||||||
OptionFlags = ResourceOptionFlags.GenerateMips,
|
MiscFlags = ResourceOptionFlags.GenerateMips,
|
||||||
MipLevels = captureZone.DownscaleLevel + 1,
|
MipLevels = captureZone.DownscaleLevel + 1,
|
||||||
ArraySize = 1,
|
ArraySize = 1,
|
||||||
SampleDescription = { Count = 1, Quality = 0 },
|
SampleDescription = { Count = 1, Quality = 0 },
|
||||||
@ -363,12 +363,12 @@ public sealed class DX11ScreenCapture : IScreenCapture
|
|||||||
|
|
||||||
Texture2DDescription captureTextureDesc = new()
|
Texture2DDescription captureTextureDesc = new()
|
||||||
{
|
{
|
||||||
CpuAccessFlags = CpuAccessFlags.None,
|
CPUAccessFlags = CpuAccessFlags.None,
|
||||||
BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource,
|
BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource,
|
||||||
Format = Format.B8G8R8A8_UNorm,
|
Format = Format.B8G8R8A8_UNorm,
|
||||||
Width = Display.Width,
|
Width = Display.Width,
|
||||||
Height = Display.Height,
|
Height = Display.Height,
|
||||||
OptionFlags = ResourceOptionFlags.None,
|
MiscFlags = ResourceOptionFlags.None,
|
||||||
MipLevels = 1,
|
MipLevels = 1,
|
||||||
ArraySize = 1,
|
ArraySize = 1,
|
||||||
SampleDescription = { Count = 1, Quality = 0 },
|
SampleDescription = { Count = 1, Quality = 0 },
|
||||||
@ -383,7 +383,7 @@ public sealed class DX11ScreenCapture : IScreenCapture
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_useNewDuplicationAdapter)
|
if (_useNewDuplicationAdapter)
|
||||||
_duplicatedOutput = output.DuplicateOutput1(_device, Format.B8G8R8A8_UNorm); // DarthAffe 27.02.2021: This prepares for the use of 10bit color depth
|
_duplicatedOutput = output.DuplicateOutput1(_device, new[] { Format.B8G8R8A8_UNorm }); // DarthAffe 27.02.2021: This prepares for the use of 10bit color depth
|
||||||
else
|
else
|
||||||
_duplicatedOutput = output.DuplicateOutput(_device);
|
_duplicatedOutput = output.DuplicateOutput(_device);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -64,7 +64,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Vortice.Direct3D11" Version="1.9.143" />
|
<PackageReference Include="Vortice.Direct3D11" Version="2.3.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user