Removed FX static using directives

このコミットが含まれているのは:
Sergio Pedri committed 2021-10-30 15:11:44 +02:00
1 親 d5e3114f7c
コミット 4d07edcd7c
22ファイル変更
+192 -211

検索条件に一致するファイルはありません

+8 -9
ファイルの表示
@@ -13,7 +13,6 @@ using static TerraFX.Interop.D3D12_FENCE_FLAGS;
using static TerraFX.Interop.D3D12_MESSAGE_ID;
using static TerraFX.Interop.D3D12_SRV_DIMENSION;
using static TerraFX.Interop.D3D12_UAV_DIMENSION;
using FX = TerraFX.Interop.Windows;
namespace ComputeSharp.Graphics.Extensions;
@@ -51,7 +50,7 @@ internal static unsafe class ID3D12DeviceExtensions
{
ComPtr<ID3D12InfoQueue> d3D12InfoQueue = default;
d3D12Device.QueryInterface(FX.__uuidof<ID3D12InfoQueue>(), d3D12InfoQueue.GetVoidAddressOf()).Assert();
d3D12Device.QueryInterface(Windows.__uuidof<ID3D12InfoQueue>(), d3D12InfoQueue.GetVoidAddressOf()).Assert();
D3D12_MESSAGE_ID* d3D12MessageIds = stackalloc D3D12_MESSAGE_ID[3]
{
@@ -88,7 +87,7 @@ internal static unsafe class ID3D12DeviceExtensions
d3D12Device.CreateCommandQueue(
&d3D12CommandQueueDesc,
FX.__uuidof<ID3D12CommandQueue>(),
Windows.__uuidof<ID3D12CommandQueue>(),
d3D12CommandQueue.GetVoidAddressOf()).Assert();
return d3D12CommandQueue.Move();
@@ -107,7 +106,7 @@ internal static unsafe class ID3D12DeviceExtensions
d3D12Device.CreateFence(
0,
D3D12_FENCE_FLAG_NONE,
FX.__uuidof<ID3D12Fence>(),
Windows.__uuidof<ID3D12Fence>(),
d3D12Fence.GetVoidAddressOf()).Assert();
return d3D12Fence.Move();
@@ -132,7 +131,7 @@ internal static unsafe class ID3D12DeviceExtensions
d3D12Device.CreateDescriptorHeap(
&d3D12DescriptorHeapDesc,
FX.__uuidof<ID3D12DescriptorHeap>(),
Windows.__uuidof<ID3D12DescriptorHeap>(),
d3D12DescriptorHeap.GetVoidAddressOf()).Assert();
return d3D12DescriptorHeap.Move();
@@ -177,7 +176,7 @@ internal static unsafe class ID3D12DeviceExtensions
{
D3D12_SHADER_RESOURCE_VIEW_DESC d3D12ShaderResourceViewDescription = default;
d3D12ShaderResourceViewDescription.ViewDimension = D3D12_SRV_DIMENSION_BUFFER;
d3D12ShaderResourceViewDescription.Shader4ComponentMapping = FX.D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
d3D12ShaderResourceViewDescription.Shader4ComponentMapping = Windows.D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
d3D12ShaderResourceViewDescription.Buffer.NumElements = bufferSize;
d3D12ShaderResourceViewDescription.Buffer.StructureByteStride = elementSize;
@@ -202,7 +201,7 @@ internal static unsafe class ID3D12DeviceExtensions
D3D12_SHADER_RESOURCE_VIEW_DESC d3D12ShaderResourceViewDescription = default;
d3D12ShaderResourceViewDescription.ViewDimension = d3D12SrvDimension;
d3D12ShaderResourceViewDescription.Format = dxgiFormat;
d3D12ShaderResourceViewDescription.Shader4ComponentMapping = FX.D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
d3D12ShaderResourceViewDescription.Shader4ComponentMapping = Windows.D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
d3D12ShaderResourceViewDescription.Texture2D.MipLevels = uint.MaxValue;
d3D12Device.CreateShaderResourceView(d3D12Resource, &d3D12ShaderResourceViewDescription, d3D12CpuDescriptorHandle);
@@ -269,7 +268,7 @@ internal static unsafe class ID3D12DeviceExtensions
d3D12Device.CreateCommandAllocator(
d3D12CommandListType,
FX.__uuidof<ID3D12CommandAllocator>(),
Windows.__uuidof<ID3D12CommandAllocator>(),
d3D12CommandAllocator.GetVoidAddressOf()).Assert();
return d3D12CommandAllocator.Move();
@@ -297,7 +296,7 @@ internal static unsafe class ID3D12DeviceExtensions
d3D12CommandListType,
d3D12CommandAllocator,
d3D12PipelineState,
FX.__uuidof<ID3D12GraphicsCommandList>(),
Windows.__uuidof<ID3D12GraphicsCommandList>(),
d3D12GraphicsCommandList.GetVoidAddressOf()).Assert();
return d3D12GraphicsCommandList.Move();
+1 -2
ファイルの表示
@@ -3,7 +3,6 @@ using System.Diagnostics.Contracts;
using System.Runtime.CompilerServices;
using TerraFX.Interop;
using static TerraFX.Interop.D3D12_FEATURE;
using FX = TerraFX.Interop.Windows;
namespace ComputeSharp.Graphics.Helpers;
@@ -51,7 +50,7 @@ internal static class D3D12FeatureHelper
&d3D12Options7,
(uint)sizeof(D3D12_FEATURE_DATA_D3D12_OPTIONS7));
if (result == FX.S_OK)
if (result == Windows.S_OK)
{
return D3D12_HEAP_FLAGS.D3D12_HEAP_FLAG_CREATE_NOT_ZEROED;
}
+13 -14
ファイルの表示
@@ -5,7 +5,6 @@ using ComputeSharp.Core.Extensions;
using ComputeSharp.Graphics.Extensions;
using ComputeSharp.Interop;
using TerraFX.Interop;
using FX = TerraFX.Interop.Windows;
using HRESULT = System.Int32;
using static TerraFX.Interop.D3D_FEATURE_LEVEL;
using static TerraFX.Interop.D3D_SHADER_MODEL;
@@ -119,32 +118,32 @@ internal static partial class DeviceHelper
HRESULT enumAdapters1Result = this.dxgiFactory6.Get()->EnumAdapterByGpuPreference(
this.index,
DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE,
FX.__uuidof<IDXGIAdapter1>(),
Windows.__uuidof<IDXGIAdapter1>(),
dxgiAdapter1.GetVoidAddressOf());
if (enumAdapters1Result == FX.DXGI_ERROR_NOT_FOUND)
if (enumAdapters1Result == Windows.DXGI_ERROR_NOT_FOUND)
{
this.dxgiFactory6.Get()->EnumWarpAdapter(FX.__uuidof<IDXGIAdapter1>(), dxgiAdapter1.GetVoidAddressOf()).Assert();
this.dxgiFactory6.Get()->EnumWarpAdapter(Windows.__uuidof<IDXGIAdapter1>(), dxgiAdapter1.GetVoidAddressOf()).Assert();
DXGI_ADAPTER_DESC1 dxgiDescription1;
dxgiAdapter1.Get()->GetDesc1(&dxgiDescription1).Assert();
HRESULT createDeviceResult = FX.D3D12CreateDevice(
HRESULT createDeviceResult = Windows.D3D12CreateDevice(
dxgiAdapter1.AsIUnknown().Get(),
D3D_FEATURE_LEVEL_11_0,
FX.__uuidof<ID3D12Device>(),
Windows.__uuidof<ID3D12Device>(),
null);
if (FX.SUCCEEDED(createDeviceResult) &&
if (Windows.SUCCEEDED(createDeviceResult) &&
this.predicate?.Invoke(new GraphicsDeviceInfo(&dxgiDescription1)) != false)
{
using ComPtr<ID3D12Device> d3D12Device = default;
FX.D3D12CreateDevice(
Windows.D3D12CreateDevice(
dxgiAdapter1.AsIUnknown().Get(),
D3D_FEATURE_LEVEL_11_0,
FX.__uuidof<ID3D12Device>(),
Windows.__uuidof<ID3D12Device>(),
d3D12Device.GetVoidAddressOf()).Assert();
this.graphicsDevice = GetOrCreateDevice(d3D12Device.Get(), (IDXGIAdapter*)dxgiAdapter1.Get(), &dxgiDescription1);
@@ -171,21 +170,21 @@ internal static partial class DeviceHelper
continue;
}
HRESULT createDeviceResult = FX.D3D12CreateDevice(
HRESULT createDeviceResult = Windows.D3D12CreateDevice(
dxgiAdapter1.AsIUnknown().Get(),
D3D_FEATURE_LEVEL_11_0,
FX.__uuidof<ID3D12Device>(),
Windows.__uuidof<ID3D12Device>(),
null);
if (FX.SUCCEEDED(createDeviceResult) &&
if (Windows.SUCCEEDED(createDeviceResult) &&
this.predicate?.Invoke(new GraphicsDeviceInfo(&dxgiDescription1)) != false)
{
using ComPtr<ID3D12Device> d3D12Device = default;
FX.D3D12CreateDevice(
Windows.D3D12CreateDevice(
dxgiAdapter1.AsIUnknown().Get(),
D3D_FEATURE_LEVEL_11_0,
FX.__uuidof<ID3D12Device>(),
Windows.__uuidof<ID3D12Device>(),
d3D12Device.GetVoidAddressOf()).Assert();
if (d3D12Device.Get()->IsShaderModelSupported(D3D_SHADER_MODEL_6_0))
+8 -9
ファイルの表示
@@ -4,7 +4,6 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using ComputeSharp.Core.Extensions;
using TerraFX.Interop;
using FX = TerraFX.Interop.Windows;
using HRESULT = System.Int32;
namespace ComputeSharp.Graphics.Helpers;
@@ -17,7 +16,7 @@ internal static partial class DeviceHelper
/// </summary>
private const uint IDXGIFactoryCreationFlags =
#if DEBUG
FX.DXGI_CREATE_FACTORY_DEBUG;
Windows.DXGI_CREATE_FACTORY_DEBUG;
#else
0;
#endif
@@ -32,16 +31,16 @@ internal static partial class DeviceHelper
EnableDebugMode();
FX.CreateDXGIFactory2(IDXGIFactoryCreationFlags, FX.__uuidof<IDXGIFactory4>(), dxgiFactory4.GetVoidAddressOf()).Assert();
Windows.CreateDXGIFactory2(IDXGIFactoryCreationFlags, Windows.__uuidof<IDXGIFactory4>(), dxgiFactory4.GetVoidAddressOf()).Assert();
HRESULT result = dxgiFactory4.CopyTo(dxgiFactory6);
if (result == FX.S_OK)
if (result == Windows.S_OK)
{
return;
}
if (result == FX.E_NOINTERFACE)
if (result == Windows.E_NOINTERFACE)
{
IDXGIFactory4As6Backcompat.Create(dxgiFactory4.Get(), dxgiFactory6);
@@ -62,14 +61,14 @@ internal static partial class DeviceHelper
using ComPtr<ID3D12Debug> d3D12Debug = default;
using ComPtr<ID3D12Debug1> d3D12Debug1 = default;
FX.D3D12GetDebugInterface(FX.__uuidof<ID3D12Debug>(), d3D12Debug.GetVoidAddressOf()).Assert();
Windows.D3D12GetDebugInterface(Windows.__uuidof<ID3D12Debug>(), d3D12Debug.GetVoidAddressOf()).Assert();
d3D12Debug.Get()->EnableDebugLayer();
if (FX.SUCCEEDED(d3D12Debug.CopyTo(d3D12Debug1.GetAddressOf())))
if (Windows.SUCCEEDED(d3D12Debug.CopyTo(d3D12Debug1.GetAddressOf())))
{
d3D12Debug1.Get()->SetEnableGPUBasedValidation(FX.TRUE);
d3D12Debug1.Get()->SetEnableSynchronizedCommandQueueValidation(FX.TRUE);
d3D12Debug1.Get()->SetEnableGPUBasedValidation(Windows.TRUE);
d3D12Debug1.Get()->SetEnableSynchronizedCommandQueueValidation(Windows.TRUE);
}
}
+15 -16
ファイルの表示
@@ -4,7 +4,6 @@ using ComputeSharp.Core.Extensions;
using ComputeSharp.Graphics.Extensions;
using Microsoft.Toolkit.Diagnostics;
using TerraFX.Interop;
using FX = TerraFX.Interop.Windows;
using HRESULT = System.Int32;
using static TerraFX.Interop.D3D_FEATURE_LEVEL;
using static TerraFX.Interop.D3D_SHADER_MODEL;
@@ -95,10 +94,10 @@ internal static partial class DeviceHelper
HRESULT enumAdapters1Result = dxgiFactory6.Get()->EnumAdapterByGpuPreference(
i++,
DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE,
FX.__uuidof<IDXGIAdapter1>(),
Windows.__uuidof<IDXGIAdapter1>(),
dxgiAdapter1.GetVoidAddressOf());
if (enumAdapters1Result == FX.DXGI_ERROR_NOT_FOUND)
if (enumAdapters1Result == Windows.DXGI_ERROR_NOT_FOUND)
{
return false;
}
@@ -120,23 +119,23 @@ internal static partial class DeviceHelper
// a device for adapters that would've failed at the FL11 check already.
if (d3D12Device == null)
{
HRESULT createDeviceResult = FX.D3D12CreateDevice(
HRESULT createDeviceResult = Windows.D3D12CreateDevice(
dxgiAdapter1.AsIUnknown().Get(),
D3D_FEATURE_LEVEL_11_0,
FX.__uuidof<ID3D12Device>(),
Windows.__uuidof<ID3D12Device>(),
null);
if (FX.SUCCEEDED(createDeviceResult))
if (Windows.SUCCEEDED(createDeviceResult))
{
using ComPtr<ID3D12Device> d3D12DeviceCandidate = default;
createDeviceResult = FX.D3D12CreateDevice(
createDeviceResult = Windows.D3D12CreateDevice(
dxgiAdapter1.AsIUnknown().Get(),
D3D_FEATURE_LEVEL_11_0,
FX.__uuidof<ID3D12Device>(),
Windows.__uuidof<ID3D12Device>(),
d3D12DeviceCandidate.GetVoidAddressOf());
if (FX.SUCCEEDED(createDeviceResult) &&
if (Windows.SUCCEEDED(createDeviceResult) &&
d3D12DeviceCandidate.Get()->IsShaderModelSupported(D3D_SHADER_MODEL_6_0))
{
return true;
@@ -147,13 +146,13 @@ internal static partial class DeviceHelper
{
using ComPtr<ID3D12Device> d3D12DeviceCandidate = default;
HRESULT createDeviceResult = FX.D3D12CreateDevice(
HRESULT createDeviceResult = Windows.D3D12CreateDevice(
dxgiAdapter1.AsIUnknown().Get(),
D3D_FEATURE_LEVEL_11_0,
FX.__uuidof<ID3D12Device>(),
Windows.__uuidof<ID3D12Device>(),
d3D12DeviceCandidate.GetVoidAddressOf());
if (FX.SUCCEEDED(createDeviceResult) &&
if (Windows.SUCCEEDED(createDeviceResult) &&
d3D12DeviceCandidate.Get()->IsShaderModelSupported(D3D_SHADER_MODEL_6_0))
{
d3D12DeviceCandidate.CopyTo(d3D12Device);
@@ -180,18 +179,18 @@ internal static partial class DeviceHelper
using ComPtr<IDXGIAdapter1> dxgiAdapter1 = default;
dxgiFactory6.Get()->EnumWarpAdapter(FX.__uuidof<IDXGIAdapter1>(), dxgiAdapter1.GetVoidAddressOf()).Assert();
dxgiFactory6.Get()->EnumWarpAdapter(Windows.__uuidof<IDXGIAdapter1>(), dxgiAdapter1.GetVoidAddressOf()).Assert();
dxgiAdapter1.Get()->GetDesc1(dxgiDescription1).Assert();
HRESULT createDeviceResult = FX.D3D12CreateDevice(
HRESULT createDeviceResult = Windows.D3D12CreateDevice(
dxgiAdapter1.AsIUnknown().Get(),
D3D_FEATURE_LEVEL_11_0,
FX.__uuidof<ID3D12Device>(),
Windows.__uuidof<ID3D12Device>(),
(void**)d3D12Device);
dxgiAdapter1.CopyTo(dxgiAdapter);
return FX.SUCCEEDED(createDeviceResult);
return Windows.SUCCEEDED(createDeviceResult);
}
}
+34 -34
ファイルの表示
@@ -3,7 +3,7 @@ using System.Diagnostics.Contracts;
using System.IO;
using System.Runtime.CompilerServices;
using Microsoft.Toolkit.Diagnostics;
using FX = TerraFX.Interop.Windows;
using TerraFX.Interop;
namespace ComputeSharp.Graphics.Helpers;
@@ -23,11 +23,11 @@ internal static class WICFormatHelper
public static Guid GetForType<T>()
where T : unmanaged
{
if (typeof(T) == typeof(Bgra32)) return FX.GUID_WICPixelFormat32bppBGRA;
else if (typeof(T) == typeof(Rgba32)) return FX.GUID_WICPixelFormat32bppRGBA;
else if (typeof(T) == typeof(Rgba64)) return FX.GUID_WICPixelFormat64bppRGBA;
else if (typeof(T) == typeof(R8)) return FX.GUID_WICPixelFormat8bppGray;
else if (typeof(T) == typeof(R16)) return FX.GUID_WICPixelFormat16bppGray;
if (typeof(T) == typeof(Bgra32)) return Windows.GUID_WICPixelFormat32bppBGRA;
else if (typeof(T) == typeof(Rgba32)) return Windows.GUID_WICPixelFormat32bppRGBA;
else if (typeof(T) == typeof(Rgba64)) return Windows.GUID_WICPixelFormat64bppRGBA;
else if (typeof(T) == typeof(R8)) return Windows.GUID_WICPixelFormat8bppGray;
else if (typeof(T) == typeof(R16)) return Windows.GUID_WICPixelFormat16bppGray;
else return ThrowHelper.ThrowArgumentException<Guid>("Invalid texture type");
}
@@ -42,58 +42,58 @@ internal static class WICFormatHelper
public static bool TryGetIntermediateFormatForType<T>(Guid containerFormat, out Guid intermediateFormat)
where T : unmanaged
{
if (containerFormat == FX.GUID_ContainerFormatBmp)
if (containerFormat == Windows.GUID_ContainerFormatBmp)
{
if (typeof(T) == typeof(Bgra32)) intermediateFormat = default;
else if (typeof(T) == typeof(Rgba32)) intermediateFormat = FX.GUID_WICPixelFormat32bppBGRA;
else if (typeof(T) == typeof(Rgba64)) intermediateFormat = FX.GUID_WICPixelFormat32bppBGRA;
else if (typeof(T) == typeof(R8)) intermediateFormat = FX.GUID_WICPixelFormat24bppBGR;
else if (typeof(T) == typeof(R16)) intermediateFormat = FX.GUID_WICPixelFormat24bppBGR;
else if (typeof(T) == typeof(Rgba32)) intermediateFormat = Windows.GUID_WICPixelFormat32bppBGRA;
else if (typeof(T) == typeof(Rgba64)) intermediateFormat = Windows.GUID_WICPixelFormat32bppBGRA;
else if (typeof(T) == typeof(R8)) intermediateFormat = Windows.GUID_WICPixelFormat24bppBGR;
else if (typeof(T) == typeof(R16)) intermediateFormat = Windows.GUID_WICPixelFormat24bppBGR;
else intermediateFormat = ThrowHelper.ThrowArgumentException<Guid>("Invalid texture type");
}
else if (containerFormat == FX.GUID_ContainerFormatPng)
else if (containerFormat == Windows.GUID_ContainerFormatPng)
{
if (typeof(T) == typeof(Bgra32)) intermediateFormat = default;
else if (typeof(T) == typeof(Rgba32)) intermediateFormat = FX.GUID_WICPixelFormat32bppBGRA;
else if (typeof(T) == typeof(Rgba32)) intermediateFormat = Windows.GUID_WICPixelFormat32bppBGRA;
else if (typeof(T) == typeof(Rgba64)) intermediateFormat = default;
else if (typeof(T) == typeof(R8)) intermediateFormat = default;
else if (typeof(T) == typeof(R16)) intermediateFormat = FX.GUID_WICPixelFormat8bppGray;
else if (typeof(T) == typeof(R16)) intermediateFormat = Windows.GUID_WICPixelFormat8bppGray;
else intermediateFormat = ThrowHelper.ThrowArgumentException<Guid>("Invalid texture type");
}
else if (containerFormat == FX.GUID_ContainerFormatJpeg)
else if (containerFormat == Windows.GUID_ContainerFormatJpeg)
{
if (typeof(T) == typeof(Bgra32)) intermediateFormat = FX.GUID_WICPixelFormat24bppBGR;
else if (typeof(T) == typeof(Rgba32)) intermediateFormat = FX.GUID_WICPixelFormat24bppBGR;
else if (typeof(T) == typeof(Rgba64)) intermediateFormat = FX.GUID_WICPixelFormat24bppBGR;
if (typeof(T) == typeof(Bgra32)) intermediateFormat = Windows.GUID_WICPixelFormat24bppBGR;
else if (typeof(T) == typeof(Rgba32)) intermediateFormat = Windows.GUID_WICPixelFormat24bppBGR;
else if (typeof(T) == typeof(Rgba64)) intermediateFormat = Windows.GUID_WICPixelFormat24bppBGR;
else if (typeof(T) == typeof(R8)) intermediateFormat = default;
else if (typeof(T) == typeof(R16)) intermediateFormat = FX.GUID_WICPixelFormat8bppGray;
else if (typeof(T) == typeof(R16)) intermediateFormat = Windows.GUID_WICPixelFormat8bppGray;
else intermediateFormat = ThrowHelper.ThrowArgumentException<Guid>("Invalid texture type");
}
else if (containerFormat == FX.GUID_ContainerFormatWmp)
else if (containerFormat == Windows.GUID_ContainerFormatWmp)
{
if (typeof(T) == typeof(Bgra32)) intermediateFormat = default;
else if (typeof(T) == typeof(Rgba32)) intermediateFormat = FX.GUID_WICPixelFormat32bppBGRA;
else if (typeof(T) == typeof(Rgba32)) intermediateFormat = Windows.GUID_WICPixelFormat32bppBGRA;
else if (typeof(T) == typeof(Rgba64)) intermediateFormat = default;
else if (typeof(T) == typeof(R8)) intermediateFormat = default;
else if (typeof(T) == typeof(R16)) intermediateFormat = default;
else intermediateFormat = ThrowHelper.ThrowArgumentException<Guid>("Invalid texture type");
}
else if (containerFormat == FX.GUID_ContainerFormatTiff)
else if (containerFormat == Windows.GUID_ContainerFormatTiff)
{
if (typeof(T) == typeof(Bgra32)) intermediateFormat = default;
else if (typeof(T) == typeof(Rgba32)) intermediateFormat = FX.GUID_WICPixelFormat32bppBGRA;
else if (typeof(T) == typeof(Rgba32)) intermediateFormat = Windows.GUID_WICPixelFormat32bppBGRA;
else if (typeof(T) == typeof(Rgba64)) intermediateFormat = default;
else if (typeof(T) == typeof(R8)) intermediateFormat = default;
else if (typeof(T) == typeof(R16)) intermediateFormat = default;
else intermediateFormat = ThrowHelper.ThrowArgumentException<Guid>("Invalid texture type");
}
else if (containerFormat == FX.GUID_ContainerFormatDds)
else if (containerFormat == Windows.GUID_ContainerFormatDds)
{
if (typeof(T) == typeof(Bgra32)) intermediateFormat = default;
else if (typeof(T) == typeof(Rgba32)) intermediateFormat = FX.GUID_WICPixelFormat32bppBGRA;
else if (typeof(T) == typeof(Rgba64)) intermediateFormat = FX.GUID_WICPixelFormat32bppBGRA;
else if (typeof(T) == typeof(R8)) intermediateFormat = FX.GUID_WICPixelFormat32bppBGRA;
else if (typeof(T) == typeof(R16)) intermediateFormat = FX.GUID_WICPixelFormat32bppBGRA;
else if (typeof(T) == typeof(Rgba32)) intermediateFormat = Windows.GUID_WICPixelFormat32bppBGRA;
else if (typeof(T) == typeof(Rgba64)) intermediateFormat = Windows.GUID_WICPixelFormat32bppBGRA;
else if (typeof(T) == typeof(R8)) intermediateFormat = Windows.GUID_WICPixelFormat32bppBGRA;
else if (typeof(T) == typeof(R16)) intermediateFormat = Windows.GUID_WICPixelFormat32bppBGRA;
else intermediateFormat = ThrowHelper.ThrowArgumentException<Guid>("Invalid texture type");
}
else
@@ -115,16 +115,16 @@ internal static class WICFormatHelper
{
return Path.GetExtension(filename).ToString() switch
{
".bmp" => FX.GUID_ContainerFormatBmp,
".png" => FX.GUID_ContainerFormatPng,
".bmp" => Windows.GUID_ContainerFormatBmp,
".png" => Windows.GUID_ContainerFormatPng,
".jpg" or
".jpeg" => FX.GUID_ContainerFormatJpeg,
".jpeg" => Windows.GUID_ContainerFormatJpeg,
".jxr" or
".hdp" or
".wdp" or
".wmp" => FX.GUID_ContainerFormatWmp,
".tiff" => FX.GUID_ContainerFormatTiff,
".dds" => FX.GUID_ContainerFormatDds,
".wmp" => Windows.GUID_ContainerFormatWmp,
".tiff" => Windows.GUID_ContainerFormatTiff,
".dds" => Windows.GUID_ContainerFormatDds,
_ => ThrowHelper.ThrowArgumentException<Guid>("Invalid filename"),
};
}
+5 -6
ファイルの表示
@@ -2,7 +2,6 @@
using System.Diagnostics.Contracts;
using ComputeSharp.Core.Extensions;
using TerraFX.Interop;
using FX = TerraFX.Interop.Windows;
namespace ComputeSharp.Graphics.Helpers;
@@ -22,13 +21,13 @@ internal sealed unsafe class WICHelper
private WICHelper()
{
using ComPtr<IWICImagingFactory2> wicImagingFactory2 = default;
Guid wicImagingFactor2Clsid = FX.CLSID_WICImagingFactory2;
Guid wicImagingFactor2Clsid = Windows.CLSID_WICImagingFactory2;
FX.CoCreateInstance(
Windows.CoCreateInstance(
&wicImagingFactor2Clsid,
null,
(uint)CLSCTX.CLSCTX_INPROC_SERVER,
FX.__uuidof<IWICImagingFactory2>(),
Windows.__uuidof<IWICImagingFactory2>(),
wicImagingFactory2.GetVoidAddressOf()).Assert();
this.wicImagingFactory2 = wicImagingFactory2.Move();
@@ -66,7 +65,7 @@ internal sealed unsafe class WICHelper
this.wicImagingFactory2.Get()->CreateDecoderFromFilename(
(ushort*)p,
null,
FX.GENERIC_READ,
Windows.GENERIC_READ,
WICDecodeOptions.WICDecodeMetadataCacheOnDemand,
wicBitmapDecoder.GetAddressOf()).Assert();
}
@@ -132,7 +131,7 @@ internal sealed unsafe class WICHelper
{
wicStream.Get()->InitializeFromFilename(
(ushort*)p,
FX.GENERIC_WRITE);
Windows.GENERIC_WRITE);
}
// Initialize the encoder
+1 -2
ファイルの表示
@@ -8,7 +8,6 @@ using ComputeSharp.Interop;
using Microsoft.Toolkit.Diagnostics;
using TerraFX.Interop;
using static TerraFX.Interop.D3D12_FEATURE;
using FX = TerraFX.Interop.Windows;
using ResourceType = ComputeSharp.Graphics.Resources.Enums.ResourceType;
namespace ComputeSharp.Resources;
@@ -59,7 +58,7 @@ public unsafe abstract class Buffer<T> : NativeObject
if (resourceType == ResourceType.Constant)
{
Guard.IsBetweenOrEqualTo(length, 1, FX.D3D12_REQ_CONSTANT_BUFFER_ELEMENT_COUNT, nameof(length));
Guard.IsBetweenOrEqualTo(length, 1, Windows.D3D12_REQ_CONSTANT_BUFFER_ELEMENT_COUNT, nameof(length));
}
else
{
+2 -3
ファイルの表示
@@ -12,7 +12,6 @@ using static TerraFX.Interop.D3D12_COMMAND_LIST_TYPE;
using static TerraFX.Interop.D3D12_RESOURCE_STATES;
using static TerraFX.Interop.D3D12_SRV_DIMENSION;
using static TerraFX.Interop.D3D12_UAV_DIMENSION;
using FX = TerraFX.Interop.Windows;
using ResourceType = ComputeSharp.Graphics.Resources.Enums.ResourceType;
#pragma warning disable CS0618
@@ -74,8 +73,8 @@ public unsafe abstract class Texture2D<T> : NativeObject, GraphicsResourceHelper
{
device.ThrowIfDisposed();
Guard.IsBetweenOrEqualTo(width, 1, FX.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION, nameof(width));
Guard.IsBetweenOrEqualTo(height, 1, FX.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION, nameof(height));
Guard.IsBetweenOrEqualTo(width, 1, Windows.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION, nameof(width));
Guard.IsBetweenOrEqualTo(height, 1, Windows.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION, nameof(height));
if (!device.D3D12Device->IsDxgiFormatSupported(DXGIFormatHelper.GetForType<T>(), d3D12FormatSupport))
{
+3 -4
ファイルの表示
@@ -12,7 +12,6 @@ using static TerraFX.Interop.D3D12_COMMAND_LIST_TYPE;
using static TerraFX.Interop.D3D12_RESOURCE_STATES;
using static TerraFX.Interop.D3D12_SRV_DIMENSION;
using static TerraFX.Interop.D3D12_UAV_DIMENSION;
using FX = TerraFX.Interop.Windows;
using ResourceType = ComputeSharp.Graphics.Resources.Enums.ResourceType;
#pragma warning disable CS0618
@@ -75,9 +74,9 @@ public unsafe abstract class Texture3D<T> : NativeObject, GraphicsResourceHelper
{
device.ThrowIfDisposed();
Guard.IsBetweenOrEqualTo(width, 1, FX.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(width));
Guard.IsBetweenOrEqualTo(height, 1, FX.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(height));
Guard.IsBetweenOrEqualTo(depth, 1, FX.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(depth));
Guard.IsBetweenOrEqualTo(width, 1, Windows.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(width));
Guard.IsBetweenOrEqualTo(height, 1, Windows.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(height));
Guard.IsBetweenOrEqualTo(depth, 1, Windows.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(depth));
if (!device.D3D12Device->IsDxgiFormatSupported(DXGIFormatHelper.GetForType<T>(), d3D12FormatSupport))
{
+2 -3
ファイルの表示
@@ -6,7 +6,6 @@ using ComputeSharp.Interop;
using Microsoft.Toolkit.Diagnostics;
using TerraFX.Interop;
using static TerraFX.Interop.D3D12_FORMAT_SUPPORT1;
using FX = TerraFX.Interop.Windows;
using ResourceType = ComputeSharp.Graphics.Resources.Enums.ResourceType;
namespace ComputeSharp.Resources;
@@ -50,8 +49,8 @@ public unsafe abstract class TransferTexture2D<T> : NativeObject
{
device.ThrowIfDisposed();
Guard.IsBetweenOrEqualTo(width, 1, FX.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION, nameof(width));
Guard.IsBetweenOrEqualTo(height, 1, FX.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION, nameof(height));
Guard.IsBetweenOrEqualTo(width, 1, Windows.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION, nameof(width));
Guard.IsBetweenOrEqualTo(height, 1, Windows.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION, nameof(height));
if (!device.D3D12Device->IsDxgiFormatSupported(DXGIFormatHelper.GetForType<T>(), D3D12_FORMAT_SUPPORT1_TEXTURE2D))
{
+3 -4
ファイルの表示
@@ -6,7 +6,6 @@ using ComputeSharp.Interop;
using Microsoft.Toolkit.Diagnostics;
using TerraFX.Interop;
using static TerraFX.Interop.D3D12_FORMAT_SUPPORT1;
using FX = TerraFX.Interop.Windows;
using ResourceType = ComputeSharp.Graphics.Resources.Enums.ResourceType;
namespace ComputeSharp.Resources;
@@ -51,9 +50,9 @@ public unsafe abstract class TransferTexture3D<T> : NativeObject
{
device.ThrowIfDisposed();
Guard.IsBetweenOrEqualTo(width, 1, FX.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(width));
Guard.IsBetweenOrEqualTo(height, 1, FX.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(height));
Guard.IsBetweenOrEqualTo(depth, 1, FX.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(depth));
Guard.IsBetweenOrEqualTo(width, 1, Windows.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(width));
Guard.IsBetweenOrEqualTo(height, 1, Windows.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(height));
Guard.IsBetweenOrEqualTo(depth, 1, Windows.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(depth));
if (!device.D3D12Device->IsDxgiFormatSupported(DXGIFormatHelper.GetForType<T>(), D3D12_FORMAT_SUPPORT1_TEXTURE3D))
{
+3 -3
ファイルの表示
@@ -5,12 +5,12 @@ using ComputeSharp.Core.Helpers;
using ComputeSharp.Exceptions;
using ComputeSharp.Graphics.Extensions;
using ComputeSharp.Graphics.Helpers;
using ComputeSharp.Graphics.Resources.Enums;
using ComputeSharp.Graphics.Resources.Interop;
using ComputeSharp.Resources;
using ComputeSharp.Resources.Debug;
using Microsoft.Toolkit.Diagnostics;
using FX = TerraFX.Interop.Windows;
using TerraFX.Interop;
using ResourceType = ComputeSharp.Graphics.Resources.Enums.ResourceType;
namespace ComputeSharp;
@@ -26,7 +26,7 @@ public sealed class ConstantBuffer<T> : Buffer<T>
/// <summary>
/// The alignment boundary for elements in a constant buffer.
/// </summary>
private const int ElementAlignment = FX.D3D12_COMMONSHADER_CONSTANT_BUFFER_PARTIAL_UPDATE_EXTENTS_BYTE_ALIGNMENT;
private const int ElementAlignment = Windows.D3D12_COMMONSHADER_CONSTANT_BUFFER_PARTIAL_UPDATE_EXTENTS_BYTE_ALIGNMENT;
/// <summary>
/// Creates a new <see cref="ConstantBuffer{T}"/> instance with the specified parameters.
+1 -2
ファイルの表示
@@ -1,7 +1,6 @@
using System;
using System.ComponentModel;
using TerraFX.Interop;
using FX = TerraFX.Interop.Windows;
using static TerraFX.Interop.D3D12_DESCRIPTOR_RANGE_FLAGS;
#pragma warning disable IDE0052, CS0414
@@ -46,6 +45,6 @@ public struct ResourceDescriptor
descriptor.BaseShaderRegister = offset;
descriptor.RegisterSpace = 0;
descriptor.Flags = D3D12_DESCRIPTOR_RANGE_FLAG_NONE;
descriptor.OffsetInDescriptorsFromTableStart = FX.D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND;
descriptor.OffsetInDescriptorsFromTableStart = Windows.D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND;
}
}
+3 -4
ファイルの表示
@@ -5,7 +5,6 @@ using static TerraFX.Interop.D3D12_COMPARISON_FUNC;
using static TerraFX.Interop.D3D12_FILTER;
using static TerraFX.Interop.D3D12_PIPELINE_STATE_FLAGS;
using static TerraFX.Interop.D3D12_TEXTURE_ADDRESS_MODE;
using FX = TerraFX.Interop.Windows;
namespace ComputeSharp.Shaders.Extensions;
@@ -72,7 +71,7 @@ internal static unsafe class ID3D12DeviceExtensions
// Serialize the root signature from the data just computed. When this is done
// we just work with the resulting blobs, so the input data can be unpinned.
FX.D3D12SerializeVersionedRootSignature(
Windows.D3D12SerializeVersionedRootSignature(
&d3D12VersionedRootSignatureDescription,
d3D3Blob.GetAddressOf(),
d3D3BlobError.GetAddressOf()).Assert();
@@ -82,7 +81,7 @@ internal static unsafe class ID3D12DeviceExtensions
0,
d3D3Blob.Get()->GetBufferPointer(),
d3D3Blob.Get()->GetBufferSize(),
FX.__uuidof<ID3D12RootSignature>(),
Windows.__uuidof<ID3D12RootSignature>(),
d3D12RootSignature.GetVoidAddressOf()).Assert();
return d3D12RootSignature.Move();
@@ -112,7 +111,7 @@ internal static unsafe class ID3D12DeviceExtensions
d3D12Device.CreateComputePipelineState(
&d3D12ComputePipelineStateDescription,
FX.__uuidof<ID3D12PipelineState>(),
Windows.__uuidof<ID3D12PipelineState>(),
d3D12PipelineState.GetVoidAddressOf()).Assert();
return d3D12PipelineState.Move();
+3 -4
ファイルの表示
@@ -4,7 +4,6 @@ using ComputeSharp.__Internals;
using ComputeSharp.Core.Extensions;
using ComputeSharp.Shaders.Translation;
using TerraFX.Interop;
using FX = TerraFX.Interop.Windows;
#pragma warning disable CS0618
@@ -110,9 +109,9 @@ public static class ReflectionServices
using ComPtr<IDxcUtils> dxcUtils = default;
Guid dxcLibraryClsid = FX.CLSID_DxcLibrary;
Guid dxcLibraryClsid = Windows.CLSID_DxcLibrary;
FX.DxcCreateInstance(&dxcLibraryClsid, FX.__uuidof<IDxcUtils>(), dxcUtils.GetVoidAddressOf()).Assert();
Windows.DxcCreateInstance(&dxcLibraryClsid, Windows.__uuidof<IDxcUtils>(), dxcUtils.GetVoidAddressOf()).Assert();
using ComPtr<ID3D12ShaderReflection> d3D12ShaderReflection = default;
@@ -122,7 +121,7 @@ public static class ReflectionServices
dxcUtils.Get()->CreateReflection(
&dxcBuffer,
FX.__uuidof<ID3D12ShaderReflection>(),
Windows.__uuidof<ID3D12ShaderReflection>(),
d3D12ShaderReflection.GetVoidAddressOf()).Assert();
D3D12_SHADER_DESC d3D12ShaderDescription;
+5 -6
ファイルの表示
@@ -9,7 +9,6 @@ using ComputeSharp.Shaders.Translation.Models;
using ComputeSharp.__Internals;
using Microsoft.Toolkit.Diagnostics;
using TerraFX.Interop;
using FX = TerraFX.Interop.Windows;
#pragma warning disable CS0618
@@ -122,9 +121,9 @@ internal static class ShaderRunner<T>
groupsY = Math.DivRem(y, threadsY, out int modY) + (modY == 0 ? 0 : 1),
groupsZ = Math.DivRem(z, threadsZ, out int modZ) + (modZ == 0 ? 0 : 1);
Guard.IsBetweenOrEqualTo(groupsX, 1, FX.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, nameof(groupsX));
Guard.IsBetweenOrEqualTo(groupsY, 1, FX.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, nameof(groupsX));
Guard.IsBetweenOrEqualTo(groupsZ, 1, FX.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, nameof(groupsX));
Guard.IsBetweenOrEqualTo(groupsX, 1, Windows.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, nameof(groupsX));
Guard.IsBetweenOrEqualTo(groupsY, 1, Windows.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, nameof(groupsX));
Guard.IsBetweenOrEqualTo(groupsZ, 1, Windows.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, nameof(groupsX));
ShaderKey key = new(shader.GetDispatchId(), threadsX, threadsY, threadsZ);
PipelineData? pipelineData;
@@ -178,8 +177,8 @@ internal static class ShaderRunner<T>
groupsX = Math.DivRem(x, threadsX, out int modX) + (modX == 0 ? 0 : 1),
groupsY = Math.DivRem(y, threadsY, out int modY) + (modY == 0 ? 0 : 1);
Guard.IsBetweenOrEqualTo(groupsX, 1, FX.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, nameof(groupsX));
Guard.IsBetweenOrEqualTo(groupsY, 1, FX.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, nameof(groupsX));
Guard.IsBetweenOrEqualTo(groupsX, 1, Windows.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, nameof(groupsX));
Guard.IsBetweenOrEqualTo(groupsY, 1, Windows.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, nameof(groupsX));
ShaderKey key = new(shader.GetDispatchId(), threadsX, threadsY, 1);
PipelineData? pipelineData;
+2 -2
ファイルの表示
@@ -1,7 +1,7 @@
using System;
using System.IO;
using System.Runtime.InteropServices;
using FX = TerraFX.Interop.Windows;
using TerraFX.Interop;
namespace ComputeSharp.Shaders.Translation;
@@ -23,7 +23,7 @@ internal sealed unsafe partial class ShaderCompiler
// libraries from the NuGet directory, if an RID is not in use, or we need to ensure that dxil.dll is
// loaded correctly in case the program was executed with the host being in another directory.
// This happens when doing eg. "dotnet bin\Debug\net5.0\MyApp.dll", which would crash at runtime.
FX.ResolveLibrary += (libraryName, assembly, searchPath) =>
Windows.ResolveLibrary += (libraryName, assembly, searchPath) =>
{
if (libraryName is not "dxcompiler") return IntPtr.Zero;
+4 -5
ファイルの表示
@@ -4,7 +4,6 @@ using System.Runtime.CompilerServices;
using ComputeSharp.Core.Extensions;
using ComputeSharp.Exceptions;
using TerraFX.Interop;
using FX = TerraFX.Interop.Windows;
namespace ComputeSharp.Shaders.Translation;
@@ -49,11 +48,11 @@ internal sealed unsafe partial class ShaderCompiler
using ComPtr<IDxcLibrary> dxcLibrary = default;
using ComPtr<IDxcIncludeHandler> dxcIncludeHandler = default;
Guid dxcCompilerCLGuid = FX.CLSID_DxcCompiler;
Guid dxcLibraryCLGuid = FX.CLSID_DxcLibrary;
Guid dxcCompilerCLGuid = Windows.CLSID_DxcCompiler;
Guid dxcLibraryCLGuid = Windows.CLSID_DxcLibrary;
FX.DxcCreateInstance(&dxcCompilerCLGuid, FX.__uuidof<IDxcCompiler>(), dxcCompiler.GetVoidAddressOf()).Assert();
FX.DxcCreateInstance(&dxcLibraryCLGuid, FX.__uuidof<IDxcLibrary>(), dxcLibrary.GetVoidAddressOf()).Assert();
Windows.DxcCreateInstance(&dxcCompilerCLGuid, Windows.__uuidof<IDxcCompiler>(), dxcCompiler.GetVoidAddressOf()).Assert();
Windows.DxcCreateInstance(&dxcLibraryCLGuid, Windows.__uuidof<IDxcLibrary>(), dxcLibrary.GetVoidAddressOf()).Assert();
dxcLibrary.Get()->CreateIncludeHandler(dxcIncludeHandler.GetAddressOf()).Assert();