diff --git a/samples/ComputeSharp.SwapChain/Backend/SwapChainApplication{T}.cs b/samples/ComputeSharp.SwapChain/Backend/SwapChainApplication{T}.cs index ea816a6e..04867578 100644 --- a/samples/ComputeSharp.SwapChain/Backend/SwapChainApplication{T}.cs +++ b/samples/ComputeSharp.SwapChain/Backend/SwapChainApplication{T}.cs @@ -1,6 +1,9 @@ using System; using ComputeSharp.Interop; -using TerraFX.Interop; +using TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; + +#pragma warning disable CA1416 namespace ComputeSharp.SwapChain.Backend; @@ -120,7 +123,7 @@ internal sealed class SwapChainApplication : Win32Application { using ComPtr dxgiFactory2 = default; - _ = Windows.CreateDXGIFactory2(Windows.DXGI_CREATE_FACTORY_DEBUG, Windows.__uuidof(), (void**)dxgiFactory2.GetAddressOf()); + _ = DirectX.CreateDXGIFactory2(DirectX.DXGI_CREATE_FACTORY_DEBUG, Windows.__uuidof(), (void**)dxgiFactory2.GetAddressOf()); DXGI_SWAP_CHAIN_DESC1 dxgiSwapChainDesc1 = default; dxgiSwapChainDesc1.AlphaMode = DXGI_ALPHA_MODE.DXGI_ALPHA_MODE_IGNORE; diff --git a/samples/ComputeSharp.SwapChain/Backend/Win32Application.cs b/samples/ComputeSharp.SwapChain/Backend/Win32Application.cs index 2dfe60da..a097a84b 100644 --- a/samples/ComputeSharp.SwapChain/Backend/Win32Application.cs +++ b/samples/ComputeSharp.SwapChain/Backend/Win32Application.cs @@ -1,5 +1,5 @@ using System; -using TerraFX.Interop; +using TerraFX.Interop.Windows; namespace ComputeSharp.SwapChain.Backend; diff --git a/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs b/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs index 8f301650..1f60d717 100644 --- a/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs +++ b/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs @@ -4,7 +4,7 @@ using System.Drawing; using System.Reflection; using System.Runtime.InteropServices; using System.Threading; -using TerraFX.Interop; +using TerraFX.Interop.Windows; namespace ComputeSharp.SwapChain.Backend; @@ -73,7 +73,7 @@ internal unsafe static class Win32ApplicationRunner Rectangle windowRect = new(0, 0, 1280, 720); // Set the target window size - _ = Windows.AdjustWindowRect((RECT*)&windowRect, Windows.WS_OVERLAPPEDWINDOW, Windows.FALSE); + _ = Windows.AdjustWindowRect((RECT*)&windowRect, WS.WS_OVERLAPPEDWINDOW, Windows.FALSE); uint height = (uint)(windowRect.Bottom - windowRect.Top); uint width = (uint)(windowRect.Right - windowRect.Left); @@ -83,7 +83,7 @@ internal unsafe static class Win32ApplicationRunner 0, windowClassEx.lpszClassName, (ushort*)windowTitle, - Windows.WS_OVERLAPPEDWINDOW, + WS.WS_OVERLAPPEDWINDOW, Windows.CW_USEDEFAULT, Windows.CW_USEDEFAULT, (int)width, @@ -137,7 +137,7 @@ internal unsafe static class Win32ApplicationRunner renderThread.Start((application, tokenSource.Token)); // Process any messages in the queue - while (msg.message != Windows.WM_QUIT) + while (msg.message != WM.WM_QUIT) { if (Windows.PeekMessageW(&msg, HWND.NULL, 0, 0, Windows.PM_REMOVE) != 0) { @@ -150,7 +150,7 @@ internal unsafe static class Win32ApplicationRunner } // Also listen to Escape and 'Q' to quit - if (msg.message == Windows.WM_KEYUP && (msg.wParam == (WPARAM)Windows.VK_ESCAPE || msg.wParam == 'Q')) + if (msg.message == WM.WM_KEYUP && (msg.wParam == (WPARAM)VK.VK_ESCAPE || msg.wParam == 'Q')) { _ = Windows.DestroyWindow(hwnd); } @@ -178,7 +178,7 @@ internal unsafe static class Win32ApplicationRunner switch (uMsg) { // Change the paused state on window activation - case Windows.WM_ACTIVATE: + case WM.WM_ACTIVATE: { if (Windows.LOWORD(wParam) == Windows.WA_INACTIVE) { @@ -192,7 +192,7 @@ internal unsafe static class Win32ApplicationRunner } // Change the paused state when ESC is pressed - case Windows.WM_KEYDOWN: + case WM.WM_KEYDOWN: { if ((ConsoleKey)wParam == ConsoleKey.Escape) { @@ -213,7 +213,7 @@ internal unsafe static class Win32ApplicationRunner } // Window resize started - case Windows.WM_ENTERSIZEMOVE: + case WM.WM_ENTERSIZEMOVE: { isResizing = true; @@ -221,7 +221,7 @@ internal unsafe static class Win32ApplicationRunner } // Window resize completed - case Windows.WM_EXITSIZEMOVE: + case WM.WM_EXITSIZEMOVE: { isResizing = false; application.OnResize(); @@ -230,7 +230,7 @@ internal unsafe static class Win32ApplicationRunner } // Size update - case Windows.WM_SIZE: + case WM.WM_SIZE: { if (!isResizing && wParam != Windows.SIZE_MINIMIZED) { @@ -241,13 +241,13 @@ internal unsafe static class Win32ApplicationRunner } // Size and position of the window (needed to enable the borderless mode) - case Windows.WM_NCCALCSIZE: + case WM.WM_NCCALCSIZE: { return 0; } // Enable dragging the window - case Windows.WM_NCHITTEST: + case WM.WM_NCHITTEST: { POINT point; RECT rect; @@ -292,7 +292,7 @@ internal unsafe static class Win32ApplicationRunner } // Restore the drop shadow - case Windows.WM_DWMCOMPOSITIONCHANGED: + case WM.WM_DWMCOMPOSITIONCHANGED: { MARGINS margins = default; margins.cxLeftWidth = -1; @@ -306,7 +306,7 @@ internal unsafe static class Win32ApplicationRunner } // Shutdown - case Windows.WM_DESTROY: + case WM.WM_DESTROY: { Windows.PostQuitMessage(0); return 0; diff --git a/src/ComputeSharp/ComputeSharp.csproj b/src/ComputeSharp/ComputeSharp.csproj index 223d3a4e..66955537 100644 --- a/src/ComputeSharp/ComputeSharp.csproj +++ b/src/ComputeSharp/ComputeSharp.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/ComputeSharp/Graphics/Commands/CommandList.cs b/src/ComputeSharp/Graphics/Commands/CommandList.cs index 37fca894..54f1c790 100644 --- a/src/ComputeSharp/Graphics/Commands/CommandList.cs +++ b/src/ComputeSharp/Graphics/Commands/CommandList.cs @@ -1,8 +1,9 @@ using System; using System.Diagnostics.Contracts; using System.Runtime.CompilerServices; -using TerraFX.Interop; -using static TerraFX.Interop.D3D12_COMMAND_LIST_TYPE; +using TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; +using static TerraFX.Interop.DirectX.D3D12_COMMAND_LIST_TYPE; namespace ComputeSharp.Graphics.Commands; diff --git a/src/ComputeSharp/Graphics/Commands/Interop/ID3D12CommandListPool.cs b/src/ComputeSharp/Graphics/Commands/Interop/ID3D12CommandListPool.cs index 167282d2..cd46d8d1 100644 --- a/src/ComputeSharp/Graphics/Commands/Interop/ID3D12CommandListPool.cs +++ b/src/ComputeSharp/Graphics/Commands/Interop/ID3D12CommandListPool.cs @@ -3,7 +3,8 @@ using System.Collections.Generic; using System.Runtime.CompilerServices; using ComputeSharp.Core.Extensions; using ComputeSharp.Graphics.Extensions; -using TerraFX.Interop; +using TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; namespace ComputeSharp.Graphics.Commands.Interop; diff --git a/src/ComputeSharp/Graphics/Commands/Interop/ID3D12DescriptorHandleAllocator.cs b/src/ComputeSharp/Graphics/Commands/Interop/ID3D12DescriptorHandleAllocator.cs index 2b1df78a..ca2bbeb3 100644 --- a/src/ComputeSharp/Graphics/Commands/Interop/ID3D12DescriptorHandleAllocator.cs +++ b/src/ComputeSharp/Graphics/Commands/Interop/ID3D12DescriptorHandleAllocator.cs @@ -1,8 +1,9 @@ using System; using ComputeSharp.Graphics.Extensions; using Microsoft.Toolkit.Diagnostics; -using TerraFX.Interop; -using static TerraFX.Interop.D3D12_DESCRIPTOR_HEAP_TYPE; +using TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; +using static TerraFX.Interop.DirectX.D3D12_DESCRIPTOR_HEAP_TYPE; namespace ComputeSharp.Graphics.Commands.Interop; diff --git a/src/ComputeSharp/Graphics/Commands/PipelineData.cs b/src/ComputeSharp/Graphics/Commands/PipelineData.cs index 53416b0d..6d075f19 100644 --- a/src/ComputeSharp/Graphics/Commands/PipelineData.cs +++ b/src/ComputeSharp/Graphics/Commands/PipelineData.cs @@ -1,5 +1,6 @@ using ComputeSharp.Interop; -using TerraFX.Interop; +using TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; namespace ComputeSharp.Graphics.Commands; diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/AllocatorExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Interop/AllocatorExtensions.cs index aa1fbfa0..4502b004 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/AllocatorExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/AllocatorExtensions.cs @@ -1,12 +1,13 @@ using ComputeSharp.Core.Extensions; using Microsoft.Toolkit.Diagnostics; -using TerraFX.Interop; -using static TerraFX.Interop.D3D12_CPU_PAGE_PROPERTY; -using static TerraFX.Interop.D3D12_HEAP_TYPE; -using static TerraFX.Interop.D3D12_MEMORY_POOL; -using static TerraFX.Interop.D3D12_RESOURCE_FLAGS; -using static TerraFX.Interop.D3D12_RESOURCE_STATES; -using static TerraFX.Interop.D3D12MA_ALLOCATION_FLAGS; +using TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; +using static TerraFX.Interop.DirectX.D3D12_CPU_PAGE_PROPERTY; +using static TerraFX.Interop.DirectX.D3D12_HEAP_TYPE; +using static TerraFX.Interop.DirectX.D3D12_MEMORY_POOL; +using static TerraFX.Interop.DirectX.D3D12_RESOURCE_FLAGS; +using static TerraFX.Interop.DirectX.D3D12_RESOURCE_STATES; +using static TerraFX.Interop.DirectX.D3D12MA_ALLOCATION_FLAGS; using ResourceType = ComputeSharp.Graphics.Resources.Enums.ResourceType; namespace ComputeSharp.Graphics.Extensions; diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/ComPtrExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Interop/ComPtrExtensions.cs index 1a87e316..e589b564 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/ComPtrExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/ComPtrExtensions.cs @@ -1,6 +1,6 @@ using System.Diagnostics.Contracts; using System.Runtime.CompilerServices; -using TerraFX.Interop; +using TerraFX.Interop.Windows; namespace ComputeSharp.Core.Extensions; @@ -17,11 +17,11 @@ internal static class ComPtrExtensions /// A instance of type . [MethodImpl(MethodImplOptions.AggressiveInlining)] public static unsafe uint AddRef(this ComPtr ptr) - where T : unmanaged + where T : unmanaged, IUnknown.Interface { if (ptr.Get() is not null) { - return ((IUnknown*)ptr.Get())->AddRef(); + return ptr.Get()->AddRef(); } return 0; @@ -36,11 +36,11 @@ internal static class ComPtrExtensions /// A instance of type . [MethodImpl(MethodImplOptions.AggressiveInlining)] public static unsafe uint Release(this ref ComPtr ptr) - where T : unmanaged + where T : unmanaged, IUnknown.Interface { if (ptr.Get() is not null) { - uint count = ((IUnknown*)ptr.Get())->Release(); + uint count = ptr.Get()->Release(); if (count == 0) { @@ -66,7 +66,7 @@ internal static class ComPtrExtensions [Pure] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static unsafe ref readonly ComPtr AsIUnknown(this in ComPtr ptr) - where T : unmanaged + where T : unmanaged, IUnknown.Interface { return ref Unsafe.As, ComPtr>(ref Unsafe.AsRef(in ptr)); } @@ -81,7 +81,7 @@ internal static class ComPtrExtensions [Pure] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static unsafe void** GetVoidAddressOf(this in ComPtr ptr) - where T : unmanaged + where T : unmanaged, IUnknown.Interface { return (void**)Unsafe.AsPointer(ref Unsafe.AsRef(in ptr)); } @@ -94,7 +94,7 @@ internal static class ComPtrExtensions /// The moved instance. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static unsafe ComPtr Move(this in ComPtr ptr) - where T : unmanaged + where T : unmanaged, IUnknown.Interface { ComPtr copy = default; diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/HResultExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Interop/HResultExtensions.cs index 7832dfe0..0c2bcadf 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/HResultExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/HResultExtensions.cs @@ -5,7 +5,7 @@ using System.Runtime.CompilerServices; using ComputeSharp.Graphics.Helpers; #endif using Microsoft.Toolkit.Diagnostics; -using TerraFX.Interop; +using TerraFX.Interop.Windows; namespace ComputeSharp.Core.Extensions; diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12DeviceExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12DeviceExtensions.cs index bbc772f9..f7cc50f6 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12DeviceExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12DeviceExtensions.cs @@ -2,17 +2,17 @@ using System.Diagnostics.Contracts; using System.Runtime.CompilerServices; using ComputeSharp.Core.Extensions; -using ComputeSharp.Interop; -using TerraFX.Interop; -using static TerraFX.Interop.D3D12_COMMAND_QUEUE_FLAGS; -using static TerraFX.Interop.D3D12_COMMAND_QUEUE_PRIORITY; -using static TerraFX.Interop.D3D12_DESCRIPTOR_HEAP_FLAGS; -using static TerraFX.Interop.D3D12_DESCRIPTOR_HEAP_TYPE; -using static TerraFX.Interop.D3D12_FEATURE; -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 TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; +using static TerraFX.Interop.DirectX.D3D12_COMMAND_QUEUE_FLAGS; +using static TerraFX.Interop.DirectX.D3D12_COMMAND_QUEUE_PRIORITY; +using static TerraFX.Interop.DirectX.D3D12_DESCRIPTOR_HEAP_FLAGS; +using static TerraFX.Interop.DirectX.D3D12_DESCRIPTOR_HEAP_TYPE; +using static TerraFX.Interop.DirectX.D3D12_FEATURE; +using static TerraFX.Interop.DirectX.D3D12_FENCE_FLAGS; +using static TerraFX.Interop.DirectX.D3D12_MESSAGE_ID; +using static TerraFX.Interop.DirectX.D3D12_SRV_DIMENSION; +using static TerraFX.Interop.DirectX.D3D12_UAV_DIMENSION; namespace ComputeSharp.Graphics.Extensions; @@ -176,7 +176,7 @@ internal static unsafe class ID3D12DeviceExtensions { D3D12_SHADER_RESOURCE_VIEW_DESC d3D12ShaderResourceViewDescription = default; d3D12ShaderResourceViewDescription.ViewDimension = D3D12_SRV_DIMENSION_BUFFER; - d3D12ShaderResourceViewDescription.Shader4ComponentMapping = Windows.D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; + d3D12ShaderResourceViewDescription.Shader4ComponentMapping = DirectX.D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; d3D12ShaderResourceViewDescription.Buffer.NumElements = bufferSize; d3D12ShaderResourceViewDescription.Buffer.StructureByteStride = elementSize; @@ -201,7 +201,7 @@ internal static unsafe class ID3D12DeviceExtensions D3D12_SHADER_RESOURCE_VIEW_DESC d3D12ShaderResourceViewDescription = default; d3D12ShaderResourceViewDescription.ViewDimension = d3D12SrvDimension; d3D12ShaderResourceViewDescription.Format = dxgiFormat; - d3D12ShaderResourceViewDescription.Shader4ComponentMapping = Windows.D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; + d3D12ShaderResourceViewDescription.Shader4ComponentMapping = DirectX.D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; d3D12ShaderResourceViewDescription.Texture2D.MipLevels = uint.MaxValue; d3D12Device.CreateShaderResourceView(d3D12Resource, &d3D12ShaderResourceViewDescription, d3D12CpuDescriptorHandle); diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12GraphicsCommandListExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12GraphicsCommandListExtensions.cs index 25f7a512..9e52abec 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12GraphicsCommandListExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12GraphicsCommandListExtensions.cs @@ -1,5 +1,5 @@ using System; -using TerraFX.Interop; +using TerraFX.Interop.DirectX; namespace ComputeSharp.Graphics.Extensions; diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12ResourceExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12ResourceExtensions.cs index 9a262d1a..3d46e96e 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12ResourceExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12ResourceExtensions.cs @@ -3,7 +3,7 @@ using System.Diagnostics; using System.Runtime.CompilerServices; using ComputeSharp.Core.Extensions; using ComputeSharp.Graphics.Resources.Interop; -using TerraFX.Interop; +using TerraFX.Interop.DirectX; namespace ComputeSharp.Graphics.Extensions; diff --git a/src/ComputeSharp/Graphics/GraphicsDevice.cs b/src/ComputeSharp/Graphics/GraphicsDevice.cs index 2970de18..9f3947fb 100644 --- a/src/ComputeSharp/Graphics/GraphicsDevice.cs +++ b/src/ComputeSharp/Graphics/GraphicsDevice.cs @@ -9,11 +9,12 @@ using ComputeSharp.Graphics.Extensions; using ComputeSharp.Graphics.Helpers; using ComputeSharp.Interop; using Microsoft.Toolkit.Diagnostics; -using TerraFX.Interop; -using static TerraFX.Interop.D3D12_COMMAND_LIST_TYPE; -using static TerraFX.Interop.D3D12_FEATURE; -using static TerraFX.Interop.D3D12_FORMAT_SUPPORT1; -using static TerraFX.Interop.DXGI_ADAPTER_FLAG; +using TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; +using static TerraFX.Interop.DirectX.D3D12_COMMAND_LIST_TYPE; +using static TerraFX.Interop.DirectX.D3D12_FEATURE; +using static TerraFX.Interop.DirectX.D3D12_FORMAT_SUPPORT1; +using static TerraFX.Interop.DirectX.DXGI_ADAPTER_FLAG; namespace ComputeSharp; diff --git a/src/ComputeSharp/Graphics/GraphicsDeviceInfo.cs b/src/ComputeSharp/Graphics/GraphicsDeviceInfo.cs index 9b077b67..d66a86c5 100644 --- a/src/ComputeSharp/Graphics/GraphicsDeviceInfo.cs +++ b/src/ComputeSharp/Graphics/GraphicsDeviceInfo.cs @@ -1,5 +1,5 @@ -using TerraFX.Interop; -using static TerraFX.Interop.DXGI_ADAPTER_FLAG; +using TerraFX.Interop.DirectX; +using static TerraFX.Interop.DirectX.DXGI_ADAPTER_FLAG; namespace ComputeSharp; diff --git a/src/ComputeSharp/Graphics/Helpers/D3D12FeatureHelper.cs b/src/ComputeSharp/Graphics/Helpers/D3D12FeatureHelper.cs index f196faa7..e7188897 100644 --- a/src/ComputeSharp/Graphics/Helpers/D3D12FeatureHelper.cs +++ b/src/ComputeSharp/Graphics/Helpers/D3D12FeatureHelper.cs @@ -1,8 +1,9 @@ using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Runtime.CompilerServices; -using TerraFX.Interop; -using static TerraFX.Interop.D3D12_FEATURE; +using TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; +using static TerraFX.Interop.DirectX.D3D12_FEATURE; namespace ComputeSharp.Graphics.Helpers; diff --git a/src/ComputeSharp/Graphics/Helpers/DXGIFormatHelper.cs b/src/ComputeSharp/Graphics/Helpers/DXGIFormatHelper.cs index f9eddcfe..76081fcc 100644 --- a/src/ComputeSharp/Graphics/Helpers/DXGIFormatHelper.cs +++ b/src/ComputeSharp/Graphics/Helpers/DXGIFormatHelper.cs @@ -2,8 +2,8 @@ using System.Numerics; using System.Runtime.CompilerServices; using Microsoft.Toolkit.Diagnostics; -using TerraFX.Interop; -using static TerraFX.Interop.DXGI_FORMAT; +using TerraFX.Interop.DirectX; +using static TerraFX.Interop.DirectX.DXGI_FORMAT; namespace ComputeSharp.Graphics.Helpers; diff --git a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.Enumerator.cs b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.Enumerator.cs index 8c711bbf..7023875f 100644 --- a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.Enumerator.cs +++ b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.Enumerator.cs @@ -4,11 +4,13 @@ using System.Collections.Generic; using ComputeSharp.Core.Extensions; using ComputeSharp.Graphics.Extensions; using ComputeSharp.Interop; -using TerraFX.Interop; -using HRESULT = System.Int32; -using static TerraFX.Interop.D3D_FEATURE_LEVEL; -using static TerraFX.Interop.D3D_SHADER_MODEL; -using static TerraFX.Interop.DXGI_GPU_PREFERENCE; +using TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; +using static TerraFX.Interop.DirectX.D3D_FEATURE_LEVEL; +using static TerraFX.Interop.DirectX.D3D_SHADER_MODEL; +using static TerraFX.Interop.DirectX.DXGI_GPU_PREFERENCE; + +#pragma warning disable CA1416 namespace ComputeSharp.Graphics.Helpers; @@ -129,7 +131,7 @@ internal static partial class DeviceHelper dxgiAdapter1.Get()->GetDesc1(&dxgiDescription1).Assert(); - HRESULT createDeviceResult = Windows.D3D12CreateDevice( + HRESULT createDeviceResult = DirectX.D3D12CreateDevice( dxgiAdapter1.AsIUnknown().Get(), D3D_FEATURE_LEVEL_11_0, Windows.__uuidof(), @@ -140,7 +142,7 @@ internal static partial class DeviceHelper { using ComPtr d3D12Device = default; - Windows.D3D12CreateDevice( + DirectX.D3D12CreateDevice( dxgiAdapter1.AsIUnknown().Get(), D3D_FEATURE_LEVEL_11_0, Windows.__uuidof(), @@ -170,7 +172,7 @@ internal static partial class DeviceHelper continue; } - HRESULT createDeviceResult = Windows.D3D12CreateDevice( + HRESULT createDeviceResult = DirectX.D3D12CreateDevice( dxgiAdapter1.AsIUnknown().Get(), D3D_FEATURE_LEVEL_11_0, Windows.__uuidof(), @@ -181,7 +183,7 @@ internal static partial class DeviceHelper { using ComPtr d3D12Device = default; - Windows.D3D12CreateDevice( + DirectX.D3D12CreateDevice( dxgiAdapter1.AsIUnknown().Get(), D3D_FEATURE_LEVEL_11_0, Windows.__uuidof(), diff --git a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.Factory.cs b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.Factory.cs index 992c8152..eb8d0c48 100644 --- a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.Factory.cs +++ b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.Factory.cs @@ -2,7 +2,8 @@ #if DEBUG using ComputeSharp.Graphics.Extensions; #endif -using TerraFX.Interop; +using TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; namespace ComputeSharp.Graphics.Helpers; diff --git a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs index 4884f5ca..4bab8ef4 100644 --- a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs +++ b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs @@ -4,8 +4,8 @@ using System; using System.Diagnostics; using System.Runtime.InteropServices; using System.Text; -using TerraFX.Interop; -using static TerraFX.Interop.D3D12_MESSAGE_SEVERITY; +using TerraFX.Interop.DirectX; +using static TerraFX.Interop.DirectX.D3D12_MESSAGE_SEVERITY; namespace ComputeSharp.Graphics.Helpers; diff --git a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.IDXGIFactory6.cs b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.IDXGIFactory6.cs index d3c3493c..74fbccd8 100644 --- a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.IDXGIFactory6.cs +++ b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.IDXGIFactory6.cs @@ -3,8 +3,10 @@ using System.Diagnostics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.Core.Extensions; -using TerraFX.Interop; -using HRESULT = System.Int32; +using TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; + +#pragma warning disable CA1416 namespace ComputeSharp.Graphics.Helpers; @@ -16,7 +18,7 @@ internal static partial class DeviceHelper /// private const uint IDXGIFactoryCreationFlags = #if DEBUG - Windows.DXGI_CREATE_FACTORY_DEBUG; + DirectX.DXGI_CREATE_FACTORY_DEBUG; #else 0; #endif @@ -31,7 +33,7 @@ internal static partial class DeviceHelper EnableDebugMode(); - Windows.CreateDXGIFactory2(IDXGIFactoryCreationFlags, Windows.__uuidof(), dxgiFactory4.GetVoidAddressOf()).Assert(); + DirectX.CreateDXGIFactory2(IDXGIFactoryCreationFlags, Windows.__uuidof(), dxgiFactory4.GetVoidAddressOf()).Assert(); HRESULT result = dxgiFactory4.CopyTo(dxgiFactory6); @@ -40,7 +42,7 @@ internal static partial class DeviceHelper return; } - if (result == Windows.E_NOINTERFACE) + if (result == E.E_NOINTERFACE) { IDXGIFactory4As6Backcompat.Create(dxgiFactory4.Get(), dxgiFactory6); @@ -61,7 +63,7 @@ internal static partial class DeviceHelper using ComPtr d3D12Debug = default; using ComPtr d3D12Debug1 = default; - Windows.D3D12GetDebugInterface(Windows.__uuidof(), d3D12Debug.GetVoidAddressOf()).Assert(); + DirectX.D3D12GetDebugInterface(Windows.__uuidof(), d3D12Debug.GetVoidAddressOf()).Assert(); d3D12Debug.Get()->EnableDebugLayer(); diff --git a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.cs b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.cs index ecd4383b..353497f6 100644 --- a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.cs +++ b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.cs @@ -3,11 +3,13 @@ using System.Diagnostics.Contracts; using ComputeSharp.Core.Extensions; using ComputeSharp.Graphics.Extensions; using Microsoft.Toolkit.Diagnostics; -using TerraFX.Interop; -using HRESULT = System.Int32; -using static TerraFX.Interop.D3D_FEATURE_LEVEL; -using static TerraFX.Interop.D3D_SHADER_MODEL; -using static TerraFX.Interop.DXGI_GPU_PREFERENCE; +using TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; +using static TerraFX.Interop.DirectX.D3D_FEATURE_LEVEL; +using static TerraFX.Interop.DirectX.D3D_SHADER_MODEL; +using static TerraFX.Interop.DirectX.DXGI_GPU_PREFERENCE; + +#pragma warning disable CA1416 namespace ComputeSharp.Graphics.Helpers; @@ -119,7 +121,7 @@ internal static partial class DeviceHelper // a device for adapters that would've failed at the FL11 check already. if (d3D12Device == null) { - HRESULT createDeviceResult = Windows.D3D12CreateDevice( + HRESULT createDeviceResult = DirectX.D3D12CreateDevice( dxgiAdapter1.AsIUnknown().Get(), D3D_FEATURE_LEVEL_11_0, Windows.__uuidof(), @@ -129,7 +131,7 @@ internal static partial class DeviceHelper { using ComPtr d3D12DeviceCandidate = default; - createDeviceResult = Windows.D3D12CreateDevice( + createDeviceResult = DirectX.D3D12CreateDevice( dxgiAdapter1.AsIUnknown().Get(), D3D_FEATURE_LEVEL_11_0, Windows.__uuidof(), @@ -146,7 +148,7 @@ internal static partial class DeviceHelper { using ComPtr d3D12DeviceCandidate = default; - HRESULT createDeviceResult = Windows.D3D12CreateDevice( + HRESULT createDeviceResult = DirectX.D3D12CreateDevice( dxgiAdapter1.AsIUnknown().Get(), D3D_FEATURE_LEVEL_11_0, Windows.__uuidof(), @@ -183,7 +185,7 @@ internal static partial class DeviceHelper dxgiAdapter1.Get()->GetDesc1(dxgiDescription1).Assert(); - HRESULT createDeviceResult = Windows.D3D12CreateDevice( + HRESULT createDeviceResult = DirectX.D3D12CreateDevice( dxgiAdapter1.AsIUnknown().Get(), D3D_FEATURE_LEVEL_11_0, Windows.__uuidof(), diff --git a/src/ComputeSharp/Graphics/Helpers/WICFormatHelper.cs b/src/ComputeSharp/Graphics/Helpers/WICFormatHelper.cs index 96c44060..cf75c4b1 100644 --- a/src/ComputeSharp/Graphics/Helpers/WICFormatHelper.cs +++ b/src/ComputeSharp/Graphics/Helpers/WICFormatHelper.cs @@ -3,7 +3,7 @@ using System.Diagnostics.Contracts; using System.IO; using System.Runtime.CompilerServices; using Microsoft.Toolkit.Diagnostics; -using TerraFX.Interop; +using TerraFX.Interop.Windows; namespace ComputeSharp.Graphics.Helpers; diff --git a/src/ComputeSharp/Graphics/Helpers/WICHelper.cs b/src/ComputeSharp/Graphics/Helpers/WICHelper.cs index 6b321c7c..1090d5bb 100644 --- a/src/ComputeSharp/Graphics/Helpers/WICHelper.cs +++ b/src/ComputeSharp/Graphics/Helpers/WICHelper.cs @@ -1,7 +1,10 @@ using System; using System.Diagnostics.Contracts; +using System.Runtime.CompilerServices; using ComputeSharp.Core.Extensions; -using TerraFX.Interop; +using TerraFX.Interop.Windows; + +#pragma warning disable CA1416 namespace ComputeSharp.Graphics.Helpers; @@ -21,10 +24,9 @@ internal sealed unsafe class WICHelper private WICHelper() { using ComPtr wicImagingFactory2 = default; - Guid wicImagingFactor2Clsid = Windows.CLSID_WICImagingFactory2; Windows.CoCreateInstance( - &wicImagingFactor2Clsid, + (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in CLSID.CLSID_WICImagingFactory2)), null, (uint)CLSCTX.CLSCTX_INPROC_SERVER, Windows.__uuidof(), diff --git a/src/ComputeSharp/Graphics/Helpers/__Internals/GraphicsResourceHelper.cs b/src/ComputeSharp/Graphics/Helpers/__Internals/GraphicsResourceHelper.cs index 89a703f2..fb40d83b 100644 --- a/src/ComputeSharp/Graphics/Helpers/__Internals/GraphicsResourceHelper.cs +++ b/src/ComputeSharp/Graphics/Helpers/__Internals/GraphicsResourceHelper.cs @@ -3,7 +3,7 @@ using System.ComponentModel; using System.Runtime.CompilerServices; using ComputeSharp.Resources; using Microsoft.Toolkit.Diagnostics; -using TerraFX.Interop; +using TerraFX.Interop.DirectX; namespace ComputeSharp.__Internals; diff --git a/src/ComputeSharp/Graphics/Luid.cs b/src/ComputeSharp/Graphics/Luid.cs index 89db2015..7eccacb2 100644 --- a/src/ComputeSharp/Graphics/Luid.cs +++ b/src/ComputeSharp/Graphics/Luid.cs @@ -1,7 +1,7 @@ using System; using System.Diagnostics.Contracts; using System.Runtime.CompilerServices; -using TerraFX.Interop; +using TerraFX.Interop.Windows; namespace ComputeSharp; diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs index 9a3c57e5..0a361b06 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs @@ -7,8 +7,9 @@ using ComputeSharp.Graphics.Extensions; using ComputeSharp.Graphics.Helpers; using ComputeSharp.Interop; using Microsoft.Toolkit.Diagnostics; -using TerraFX.Interop; -using static TerraFX.Interop.D3D12_FEATURE; +using TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; +using static TerraFX.Interop.DirectX.D3D12_FEATURE; using ResourceType = ComputeSharp.Graphics.Resources.Enums.ResourceType; namespace ComputeSharp.Resources; @@ -59,7 +60,7 @@ public unsafe abstract class Buffer : NativeObject if (resourceType == ResourceType.Constant) { - Guard.IsBetweenOrEqualTo(length, 1, Windows.D3D12_REQ_CONSTANT_BUFFER_ELEMENT_COUNT, nameof(length)); + Guard.IsBetweenOrEqualTo(length, 1, DirectX.D3D12_REQ_CONSTANT_BUFFER_ELEMENT_COUNT, nameof(length)); } else { @@ -74,7 +75,7 @@ public unsafe abstract class Buffer : NativeObject } nint usableSizeInBytes = checked((nint)(length * elementSizeInBytes)); - nint effectiveSizeInBytes = resourceType == ResourceType.Constant ? AlignmentHelper.Pad(usableSizeInBytes, Windows.D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT) : usableSizeInBytes; + nint effectiveSizeInBytes = resourceType == ResourceType.Constant ? AlignmentHelper.Pad(usableSizeInBytes, DirectX.D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT) : usableSizeInBytes; SizeInBytes = usableSizeInBytes; GraphicsDevice = device; diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/StructuredBuffer{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/StructuredBuffer{T}.cs index 83fd562e..e510e336 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/StructuredBuffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/StructuredBuffer{T}.cs @@ -3,8 +3,9 @@ using ComputeSharp.Graphics.Extensions; using ComputeSharp.Graphics.Helpers; using ComputeSharp.Graphics.Resources.Interop; using Microsoft.Toolkit.Diagnostics; -using TerraFX.Interop; -using static TerraFX.Interop.D3D12_COMMAND_LIST_TYPE; +using TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; +using static TerraFX.Interop.DirectX.D3D12_COMMAND_LIST_TYPE; using ResourceType = ComputeSharp.Graphics.Resources.Enums.ResourceType; namespace ComputeSharp.Resources; diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs index 57b8220d..8b47d9a2 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs @@ -7,11 +7,12 @@ using ComputeSharp.Graphics.Helpers; using ComputeSharp.Graphics.Resources.Interop; using ComputeSharp.Interop; using Microsoft.Toolkit.Diagnostics; -using TerraFX.Interop; -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 TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; +using static TerraFX.Interop.DirectX.D3D12_COMMAND_LIST_TYPE; +using static TerraFX.Interop.DirectX.D3D12_RESOURCE_STATES; +using static TerraFX.Interop.DirectX.D3D12_SRV_DIMENSION; +using static TerraFX.Interop.DirectX.D3D12_UAV_DIMENSION; using ResourceType = ComputeSharp.Graphics.Resources.Enums.ResourceType; #pragma warning disable CS0618 @@ -73,8 +74,8 @@ public unsafe abstract class Texture2D : NativeObject, GraphicsResourceHelper { device.ThrowIfDisposed(); - 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)); + Guard.IsBetweenOrEqualTo(width, 1, DirectX.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION, nameof(width)); + Guard.IsBetweenOrEqualTo(height, 1, DirectX.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION, nameof(height)); if (!device.D3D12Device->IsDxgiFormatSupported(DXGIFormatHelper.GetForType(), d3D12FormatSupport)) { diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/Texture3D{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/Texture3D{T}.cs index 883c180e..c8d8b1ea 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/Texture3D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/Texture3D{T}.cs @@ -7,11 +7,12 @@ using ComputeSharp.Graphics.Helpers; using ComputeSharp.Graphics.Resources.Interop; using ComputeSharp.Interop; using Microsoft.Toolkit.Diagnostics; -using TerraFX.Interop; -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 TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; +using static TerraFX.Interop.DirectX.D3D12_COMMAND_LIST_TYPE; +using static TerraFX.Interop.DirectX.D3D12_RESOURCE_STATES; +using static TerraFX.Interop.DirectX.D3D12_SRV_DIMENSION; +using static TerraFX.Interop.DirectX.D3D12_UAV_DIMENSION; using ResourceType = ComputeSharp.Graphics.Resources.Enums.ResourceType; #pragma warning disable CS0618 @@ -74,9 +75,9 @@ public unsafe abstract class Texture3D : NativeObject, GraphicsResourceHelper { device.ThrowIfDisposed(); - 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)); + Guard.IsBetweenOrEqualTo(width, 1, DirectX.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(width)); + Guard.IsBetweenOrEqualTo(height, 1, DirectX.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(height)); + Guard.IsBetweenOrEqualTo(depth, 1, DirectX.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(depth)); if (!device.D3D12Device->IsDxgiFormatSupported(DXGIFormatHelper.GetForType(), d3D12FormatSupport)) { diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/TransferBuffer{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/TransferBuffer{T}.cs index fd9ab1d9..00ff3ae7 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/TransferBuffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/TransferBuffer{T}.cs @@ -5,7 +5,8 @@ using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Extensions; using ComputeSharp.Interop; using Microsoft.Toolkit.Diagnostics; -using TerraFX.Interop; +using TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; using ResourceType = ComputeSharp.Graphics.Resources.Enums.ResourceType; namespace ComputeSharp.Resources; diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture2D{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture2D{T}.cs index 80526093..169811b3 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture2D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture2D{T}.cs @@ -4,8 +4,9 @@ using ComputeSharp.Graphics.Extensions; using ComputeSharp.Graphics.Helpers; using ComputeSharp.Interop; using Microsoft.Toolkit.Diagnostics; -using TerraFX.Interop; -using static TerraFX.Interop.D3D12_FORMAT_SUPPORT1; +using TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; +using static TerraFX.Interop.DirectX.D3D12_FORMAT_SUPPORT1; using ResourceType = ComputeSharp.Graphics.Resources.Enums.ResourceType; namespace ComputeSharp.Resources; @@ -49,8 +50,8 @@ public unsafe abstract class TransferTexture2D : NativeObject { device.ThrowIfDisposed(); - 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)); + Guard.IsBetweenOrEqualTo(width, 1, DirectX.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION, nameof(width)); + Guard.IsBetweenOrEqualTo(height, 1, DirectX.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION, nameof(height)); if (!device.D3D12Device->IsDxgiFormatSupported(DXGIFormatHelper.GetForType(), D3D12_FORMAT_SUPPORT1_TEXTURE2D)) { diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture3D{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture3D{T}.cs index e5a72cad..c137340d 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture3D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture3D{T}.cs @@ -4,8 +4,9 @@ using ComputeSharp.Graphics.Extensions; using ComputeSharp.Graphics.Helpers; using ComputeSharp.Interop; using Microsoft.Toolkit.Diagnostics; -using TerraFX.Interop; -using static TerraFX.Interop.D3D12_FORMAT_SUPPORT1; +using TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; +using static TerraFX.Interop.DirectX.D3D12_FORMAT_SUPPORT1; using ResourceType = ComputeSharp.Graphics.Resources.Enums.ResourceType; namespace ComputeSharp.Resources; @@ -50,9 +51,9 @@ public unsafe abstract class TransferTexture3D : NativeObject { device.ThrowIfDisposed(); - 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)); + Guard.IsBetweenOrEqualTo(width, 1, DirectX.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(width)); + Guard.IsBetweenOrEqualTo(height, 1, DirectX.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(height)); + Guard.IsBetweenOrEqualTo(depth, 1, DirectX.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(depth)); if (!device.D3D12Device->IsDxgiFormatSupported(DXGIFormatHelper.GetForType(), D3D12_FORMAT_SUPPORT1_TEXTURE3D)) { diff --git a/src/ComputeSharp/Graphics/Resources/ConstantBuffer{T}.cs b/src/ComputeSharp/Graphics/Resources/ConstantBuffer{T}.cs index 38aa3b47..beb59215 100644 --- a/src/ComputeSharp/Graphics/Resources/ConstantBuffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/ConstantBuffer{T}.cs @@ -9,7 +9,7 @@ using ComputeSharp.Graphics.Resources.Interop; using ComputeSharp.Resources; using ComputeSharp.Resources.Debug; using Microsoft.Toolkit.Diagnostics; -using TerraFX.Interop; +using TerraFX.Interop.DirectX; using ResourceType = ComputeSharp.Graphics.Resources.Enums.ResourceType; namespace ComputeSharp; @@ -26,7 +26,7 @@ public sealed class ConstantBuffer : Buffer /// /// The alignment boundary for elements in a constant buffer. /// - private const int ElementAlignment = Windows.D3D12_COMMONSHADER_CONSTANT_BUFFER_PARTIAL_UPDATE_EXTENTS_BYTE_ALIGNMENT; + private const int ElementAlignment = DirectX.D3D12_COMMONSHADER_CONSTANT_BUFFER_PARTIAL_UPDATE_EXTENTS_BYTE_ALIGNMENT; /// /// Creates a new instance with the specified parameters. diff --git a/src/ComputeSharp/Graphics/Resources/Enums/ResourceType.cs b/src/ComputeSharp/Graphics/Resources/Enums/ResourceType.cs index 4dadf0c1..3c61b131 100644 --- a/src/ComputeSharp/Graphics/Resources/Enums/ResourceType.cs +++ b/src/ComputeSharp/Graphics/Resources/Enums/ResourceType.cs @@ -8,35 +8,35 @@ internal enum ResourceType /// /// A constant resource, with items aligned to 16 bytes, used for individual values or very small arrays. /// This is only supported for buffers and is mapped to a . - /// Resources of this type are located in . + /// Resources of this type are located in . /// Constant, /// /// A readonly resource, that can store arbitrary arrays of values and can only be read from by the GPU. /// This is mapped to either or . - /// Resources of this type are located in . + /// Resources of this type are located in . /// ReadOnly, /// /// A read write resource, that can store arbitrary arrays with both read and write access for the GPU. /// This is mapped to either or . - /// Resources of this type are located in . + /// Resources of this type are located in . /// ReadWrite, /// /// A readback resource, used temporarily to read data back from and resources. /// This has no direct mapping to a type in HLSL, as it's only used for copy operations. - /// Resources of this type are located in . + /// Resources of this type are located in . /// ReadBack, /// /// A transfer resource, used temporarily to set data to and resources. /// This has no direct mapping to a type in HLSL, as it's only used for copy operations (like ). - /// Resources of this type are located in . + /// Resources of this type are located in . /// Upload } diff --git a/src/ComputeSharp/Graphics/Resources/Interop/ID3D12ResourceMap.cs b/src/ComputeSharp/Graphics/Resources/Interop/ID3D12ResourceMap.cs index 17732cd2..e5b71cfb 100644 --- a/src/ComputeSharp/Graphics/Resources/Interop/ID3D12ResourceMap.cs +++ b/src/ComputeSharp/Graphics/Resources/Interop/ID3D12ResourceMap.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.CompilerServices; using ComputeSharp.Graphics.Extensions; -using TerraFX.Interop; +using TerraFX.Interop.DirectX; namespace ComputeSharp.Graphics.Resources.Interop; diff --git a/src/ComputeSharp/Graphics/Resources/Interop/__Internals/ResourceDescriptor.cs b/src/ComputeSharp/Graphics/Resources/Interop/__Internals/ResourceDescriptor.cs index 028f3613..da04ea73 100644 --- a/src/ComputeSharp/Graphics/Resources/Interop/__Internals/ResourceDescriptor.cs +++ b/src/ComputeSharp/Graphics/Resources/Interop/__Internals/ResourceDescriptor.cs @@ -1,7 +1,7 @@ using System; using System.ComponentModel; -using TerraFX.Interop; -using static TerraFX.Interop.D3D12_DESCRIPTOR_RANGE_FLAGS; +using TerraFX.Interop.DirectX; +using static TerraFX.Interop.DirectX.D3D12_DESCRIPTOR_RANGE_FLAGS; #pragma warning disable IDE0052, CS0414 @@ -45,6 +45,6 @@ public struct ResourceDescriptor descriptor.BaseShaderRegister = offset; descriptor.RegisterSpace = 0; descriptor.Flags = D3D12_DESCRIPTOR_RANGE_FLAG_NONE; - descriptor.OffsetInDescriptorsFromTableStart = Windows.D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND; + descriptor.OffsetInDescriptorsFromTableStart = DirectX.D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND; } } diff --git a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T,TPixel}.cs b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T,TPixel}.cs index a3a6d81d..2e8ec3e4 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T,TPixel}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T,TPixel}.cs @@ -4,7 +4,7 @@ using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; using ComputeSharp.Resources.Debug; -using static TerraFX.Interop.D3D12_FORMAT_SUPPORT1; +using static TerraFX.Interop.DirectX.D3D12_FORMAT_SUPPORT1; #pragma warning disable CS0618 diff --git a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T}.cs b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T}.cs index f2f71afc..a59b1919 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T}.cs @@ -3,7 +3,7 @@ using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; using ComputeSharp.Resources.Debug; -using static TerraFX.Interop.D3D12_FORMAT_SUPPORT1; +using static TerraFX.Interop.DirectX.D3D12_FORMAT_SUPPORT1; namespace ComputeSharp; diff --git a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T,TPixel}.cs b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T,TPixel}.cs index a5c64fef..a97300b5 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T,TPixel}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T,TPixel}.cs @@ -4,7 +4,7 @@ using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; using ComputeSharp.Resources.Debug; -using static TerraFX.Interop.D3D12_FORMAT_SUPPORT1; +using static TerraFX.Interop.DirectX.D3D12_FORMAT_SUPPORT1; #pragma warning disable CS0618 diff --git a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T}.cs b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T}.cs index 2a5fc5a9..9d7082b7 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T}.cs @@ -3,7 +3,7 @@ using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; using ComputeSharp.Resources.Debug; -using static TerraFX.Interop.D3D12_FORMAT_SUPPORT1; +using static TerraFX.Interop.DirectX.D3D12_FORMAT_SUPPORT1; namespace ComputeSharp; diff --git a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T,TPixel}.cs b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T,TPixel}.cs index 96aadf00..09472c1e 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T,TPixel}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T,TPixel}.cs @@ -4,7 +4,7 @@ using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; using ComputeSharp.Resources.Debug; -using static TerraFX.Interop.D3D12_FORMAT_SUPPORT1; +using static TerraFX.Interop.DirectX.D3D12_FORMAT_SUPPORT1; #pragma warning disable CS0618 diff --git a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T}.cs b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T}.cs index 617863b5..f341e786 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T}.cs @@ -3,7 +3,7 @@ using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; using ComputeSharp.Resources.Debug; -using static TerraFX.Interop.D3D12_FORMAT_SUPPORT1; +using static TerraFX.Interop.DirectX.D3D12_FORMAT_SUPPORT1; namespace ComputeSharp; diff --git a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T,TPixel}.cs b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T,TPixel}.cs index 27d6e2a0..25765ebe 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T,TPixel}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T,TPixel}.cs @@ -4,7 +4,7 @@ using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; using ComputeSharp.Resources.Debug; -using static TerraFX.Interop.D3D12_FORMAT_SUPPORT1; +using static TerraFX.Interop.DirectX.D3D12_FORMAT_SUPPORT1; #pragma warning disable CS0618 diff --git a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T}.cs b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T}.cs index af759c96..1e5e6f89 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T}.cs @@ -3,7 +3,7 @@ using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; using ComputeSharp.Resources.Debug; -using static TerraFX.Interop.D3D12_FORMAT_SUPPORT1; +using static TerraFX.Interop.DirectX.D3D12_FORMAT_SUPPORT1; namespace ComputeSharp; diff --git a/src/ComputeSharp/Shaders/Dispatching/ComputeShaderDispatchDataLoader.cs b/src/ComputeSharp/Shaders/Dispatching/ComputeShaderDispatchDataLoader.cs index e7e70812..b565ad62 100644 --- a/src/ComputeSharp/Shaders/Dispatching/ComputeShaderDispatchDataLoader.cs +++ b/src/ComputeSharp/Shaders/Dispatching/ComputeShaderDispatchDataLoader.cs @@ -2,7 +2,7 @@ using System.Runtime.CompilerServices; using ComputeSharp.Graphics.Extensions; using ComputeSharp.__Internals; -using TerraFX.Interop; +using TerraFX.Interop.DirectX; using System.Runtime.InteropServices; #pragma warning disable CS0618 diff --git a/src/ComputeSharp/Shaders/Dispatching/PixelShaderDispatchDataLoader.cs b/src/ComputeSharp/Shaders/Dispatching/PixelShaderDispatchDataLoader.cs index 6bc27fb7..2c8792e0 100644 --- a/src/ComputeSharp/Shaders/Dispatching/PixelShaderDispatchDataLoader.cs +++ b/src/ComputeSharp/Shaders/Dispatching/PixelShaderDispatchDataLoader.cs @@ -1,9 +1,9 @@ using System; using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; using ComputeSharp.Graphics.Extensions; using ComputeSharp.__Internals; -using TerraFX.Interop; -using System.Runtime.InteropServices; +using TerraFX.Interop.DirectX; #pragma warning disable CS0618 diff --git a/src/ComputeSharp/Shaders/Dispatching/ShaderDispatchMetadataLoader.cs b/src/ComputeSharp/Shaders/Dispatching/ShaderDispatchMetadataLoader.cs index 9f56d2ce..4dc6de76 100644 --- a/src/ComputeSharp/Shaders/Dispatching/ShaderDispatchMetadataLoader.cs +++ b/src/ComputeSharp/Shaders/Dispatching/ShaderDispatchMetadataLoader.cs @@ -4,7 +4,8 @@ using System.Runtime.InteropServices; using ComputeSharp.Shaders.Extensions; using ComputeSharp.__Internals; using Microsoft.Toolkit.Diagnostics; -using TerraFX.Interop; +using TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; #pragma warning disable CS0618 diff --git a/src/ComputeSharp/Shaders/Extensions/ID3D12DeviceExtensions.cs b/src/ComputeSharp/Shaders/Extensions/ID3D12DeviceExtensions.cs index a5979b2c..122ad5c9 100644 --- a/src/ComputeSharp/Shaders/Extensions/ID3D12DeviceExtensions.cs +++ b/src/ComputeSharp/Shaders/Extensions/ID3D12DeviceExtensions.cs @@ -1,10 +1,11 @@ using System; using ComputeSharp.Core.Extensions; -using TerraFX.Interop; -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 TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; +using static TerraFX.Interop.DirectX.D3D12_COMPARISON_FUNC; +using static TerraFX.Interop.DirectX.D3D12_FILTER; +using static TerraFX.Interop.DirectX.D3D12_PIPELINE_STATE_FLAGS; +using static TerraFX.Interop.DirectX.D3D12_TEXTURE_ADDRESS_MODE; namespace ComputeSharp.Shaders.Extensions; @@ -71,7 +72,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. - Windows.D3D12SerializeVersionedRootSignature( + DirectX.D3D12SerializeVersionedRootSignature( &d3D12VersionedRootSignatureDescription, d3D3Blob.GetAddressOf(), d3D3BlobError.GetAddressOf()).Assert(); diff --git a/src/ComputeSharp/Shaders/Interop/ReflectionServices.cs b/src/ComputeSharp/Shaders/Interop/ReflectionServices.cs index d7b6c39c..2d9467c4 100644 --- a/src/ComputeSharp/Shaders/Interop/ReflectionServices.cs +++ b/src/ComputeSharp/Shaders/Interop/ReflectionServices.cs @@ -3,7 +3,8 @@ using System.Runtime.CompilerServices; using ComputeSharp.__Internals; using ComputeSharp.Core.Extensions; using ComputeSharp.Shaders.Translation; -using TerraFX.Interop; +using TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; #pragma warning disable CS0618 @@ -109,9 +110,10 @@ public static class ReflectionServices using ComPtr dxcUtils = default; - Guid dxcLibraryClsid = Windows.CLSID_DxcLibrary; - - Windows.DxcCreateInstance(&dxcLibraryClsid, Windows.__uuidof(), dxcUtils.GetVoidAddressOf()).Assert(); + DirectX.DxcCreateInstance( + (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in CLSID.CLSID_DxcLibrary)), + Windows.__uuidof(), + dxcUtils.GetVoidAddressOf()).Assert(); using ComPtr d3D12ShaderReflection = default; diff --git a/src/ComputeSharp/Shaders/ShaderRunner{T}.cs b/src/ComputeSharp/Shaders/ShaderRunner{T}.cs index 58bb4df9..0619fcf8 100644 --- a/src/ComputeSharp/Shaders/ShaderRunner{T}.cs +++ b/src/ComputeSharp/Shaders/ShaderRunner{T}.cs @@ -8,7 +8,8 @@ using ComputeSharp.Shaders.Translation; using ComputeSharp.Shaders.Translation.Models; using ComputeSharp.__Internals; using Microsoft.Toolkit.Diagnostics; -using TerraFX.Interop; +using TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; #pragma warning disable CS0618 @@ -118,9 +119,9 @@ internal static class ShaderRunner int groupsY = Math.DivRem(y, threadsY, out int modY) + (modY == 0 ? 0 : 1); int groupsZ = Math.DivRem(z, threadsZ, out int modZ) + (modZ == 0 ? 0 : 1); - 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)); + Guard.IsBetweenOrEqualTo(groupsX, 1, DirectX.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, nameof(groupsX)); + Guard.IsBetweenOrEqualTo(groupsY, 1, DirectX.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, nameof(groupsX)); + Guard.IsBetweenOrEqualTo(groupsZ, 1, DirectX.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, nameof(groupsX)); ShaderKey key = new(shader.GetDispatchId(), threadsX, threadsY, threadsZ); PipelineData? pipelineData; @@ -173,8 +174,8 @@ internal static class ShaderRunner int groupsX = Math.DivRem(x, threadsX, out int modX) + (modX == 0 ? 0 : 1); int groupsY = Math.DivRem(y, threadsY, out int modY) + (modY == 0 ? 0 : 1); - 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(groupsX, 1, DirectX.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, nameof(groupsX)); + Guard.IsBetweenOrEqualTo(groupsY, 1, DirectX.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, nameof(groupsX)); ShaderKey key = new(shader.GetDispatchId(), threadsX, threadsY, 1); PipelineData? pipelineData; diff --git a/src/ComputeSharp/Shaders/Translation/Models/CachedShader.cs b/src/ComputeSharp/Shaders/Translation/Models/CachedShader.cs index 1144b691..2afec884 100644 --- a/src/ComputeSharp/Shaders/Translation/Models/CachedShader.cs +++ b/src/ComputeSharp/Shaders/Translation/Models/CachedShader.cs @@ -1,7 +1,8 @@ using System.Runtime.CompilerServices; using ComputeSharp.Graphics.Commands; using ComputeSharp.Interop; -using TerraFX.Interop; +using TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; namespace ComputeSharp.Shaders.Translation.Models; diff --git a/src/ComputeSharp/Shaders/Translation/ShaderCompiler.LibraryLoading.cs b/src/ComputeSharp/Shaders/Translation/ShaderCompiler.LibraryLoading.cs index b0ee3aae..64e4bd3a 100644 --- a/src/ComputeSharp/Shaders/Translation/ShaderCompiler.LibraryLoading.cs +++ b/src/ComputeSharp/Shaders/Translation/ShaderCompiler.LibraryLoading.cs @@ -2,7 +2,7 @@ using System.IO; using System.Runtime.InteropServices; using Microsoft.Toolkit.Diagnostics; -using TerraFX.Interop; +using TerraFX.Interop.Windows; namespace ComputeSharp.Shaders.Translation; diff --git a/src/ComputeSharp/Shaders/Translation/ShaderCompiler.cs b/src/ComputeSharp/Shaders/Translation/ShaderCompiler.cs index 92432853..21da886d 100644 --- a/src/ComputeSharp/Shaders/Translation/ShaderCompiler.cs +++ b/src/ComputeSharp/Shaders/Translation/ShaderCompiler.cs @@ -3,7 +3,8 @@ using System.Diagnostics.Contracts; using System.Runtime.CompilerServices; using ComputeSharp.Core.Extensions; using ComputeSharp.Exceptions; -using TerraFX.Interop; +using TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; namespace ComputeSharp.Shaders.Translation; @@ -43,11 +44,15 @@ internal sealed unsafe partial class ShaderCompiler using ComPtr dxcLibrary = default; using ComPtr dxcIncludeHandler = default; - Guid dxcCompilerCLGuid = Windows.CLSID_DxcCompiler; - Guid dxcLibraryCLGuid = Windows.CLSID_DxcLibrary; + DirectX.DxcCreateInstance( + (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in CLSID.CLSID_DxcCompiler)), + Windows.__uuidof(), + dxcCompiler.GetVoidAddressOf()).Assert(); - Windows.DxcCreateInstance(&dxcCompilerCLGuid, Windows.__uuidof(), dxcCompiler.GetVoidAddressOf()).Assert(); - Windows.DxcCreateInstance(&dxcLibraryCLGuid, Windows.__uuidof(), dxcLibrary.GetVoidAddressOf()).Assert(); + DirectX.DxcCreateInstance( + (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in CLSID.CLSID_DxcLibrary)), + Windows.__uuidof(), + dxcLibrary.GetVoidAddressOf()).Assert(); dxcLibrary.Get()->CreateIncludeHandler(dxcIncludeHandler.GetAddressOf()).Assert(); diff --git a/tests/ComputeSharp.Tests.Internals/ShaderCompilerTests.cs b/tests/ComputeSharp.Tests.Internals/ShaderCompilerTests.cs index 8a38c67a..4e487777 100644 --- a/tests/ComputeSharp.Tests.Internals/ShaderCompilerTests.cs +++ b/tests/ComputeSharp.Tests.Internals/ShaderCompilerTests.cs @@ -1,7 +1,8 @@ using ComputeSharp.Exceptions; using ComputeSharp.Shaders.Translation; using Microsoft.VisualStudio.TestTools.UnitTesting; -using TerraFX.Interop; +using TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; namespace ComputeSharp.Tests.Internals; diff --git a/tests/ComputeSharp.Tests/InteropServicesTests.cs b/tests/ComputeSharp.Tests/InteropServicesTests.cs index cc163ea1..bfc9a13c 100644 --- a/tests/ComputeSharp.Tests/InteropServicesTests.cs +++ b/tests/ComputeSharp.Tests/InteropServicesTests.cs @@ -4,8 +4,9 @@ using ComputeSharp.Resources; using ComputeSharp.Tests.Attributes; using ComputeSharp.Tests.Extensions; using Microsoft.VisualStudio.TestTools.UnitTesting; -using TerraFX.Interop; -using static TerraFX.Interop.D3D12_RESOURCE_DIMENSION; +using TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; +using static TerraFX.Interop.DirectX.D3D12_RESOURCE_DIMENSION; namespace ComputeSharp.Tests;