From 87343a313762a065cd37c6446a8b6448eb9a8868 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 15 Nov 2021 19:39:33 +0100 Subject: [PATCH] Bump D3D12MA to version 2.0.0-beta3.1463073211 --- .../Backend/SwapChainApplication{T}.cs | 2 +- .../Backend/Win32ApplicationRunner.cs | 6 +- src/ComputeSharp/ComputeSharp.csproj | 2 +- .../Interop/ID3D12DeviceExtensions.cs | 4 +- .../Graphics/Helpers/D3D12FeatureHelper.cs | 2 +- .../Helpers/DeviceHelper.Enumerator.cs | 2 +- .../Helpers/DeviceHelper.IDXGIFactory6.cs | 4 +- .../Graphics/Helpers/DeviceHelper.cs | 2 +- .../Graphics/Helpers/WICFormatHelper.cs | 66 +++++++++---------- .../Graphics/Resources/Abstract/Buffer{T}.cs | 4 +- .../Resources/Abstract/Texture2D{T}.cs | 4 +- .../Resources/Abstract/Texture3D{T}.cs | 6 +- .../Abstract/TransferTexture2D{T}.cs | 4 +- .../Abstract/TransferTexture3D{T}.cs | 6 +- .../Graphics/Resources/ConstantBuffer{T}.cs | 2 +- .../Interop/__Internals/ResourceDescriptor.cs | 2 +- src/ComputeSharp/Shaders/ShaderRunner{T}.cs | 10 +-- .../InteropServicesTests.cs | 14 ++-- 18 files changed, 71 insertions(+), 71 deletions(-) diff --git a/samples/ComputeSharp.SwapChain/Backend/SwapChainApplication{T}.cs b/samples/ComputeSharp.SwapChain/Backend/SwapChainApplication{T}.cs index 04867578..db765d50 100644 --- a/samples/ComputeSharp.SwapChain/Backend/SwapChainApplication{T}.cs +++ b/samples/ComputeSharp.SwapChain/Backend/SwapChainApplication{T}.cs @@ -123,7 +123,7 @@ internal sealed class SwapChainApplication : Win32Application { using ComPtr dxgiFactory2 = default; - _ = DirectX.CreateDXGIFactory2(DirectX.DXGI_CREATE_FACTORY_DEBUG, Windows.__uuidof(), (void**)dxgiFactory2.GetAddressOf()); + _ = DirectX.CreateDXGIFactory2(DXGI.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/Win32ApplicationRunner.cs b/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs index 1f60d717..75cd8583 100644 --- a/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs +++ b/samples/ComputeSharp.SwapChain/Backend/Win32ApplicationRunner.cs @@ -60,10 +60,10 @@ internal unsafe static class Win32ApplicationRunner WNDCLASSEXW windowClassEx = new() { cbSize = (uint)sizeof(WNDCLASSEXW), - style = Windows.CS_HREDRAW | Windows.CS_VREDRAW, + style = CS.CS_HREDRAW | CS.CS_VREDRAW, lpfnWndProc = (delegate* unmanaged)(delegate* unmanaged)&WindowProc, hInstance = hInstance, - hCursor = Windows.LoadCursorW(HINSTANCE.NULL, Windows.IDC_ARROW), + hCursor = Windows.LoadCursorW(HINSTANCE.NULL, IDC.IDC_ARROW), lpszClassName = (ushort*)name }; @@ -107,7 +107,7 @@ internal unsafe static class Win32ApplicationRunner application.OnInitialize(hwnd); // Display the window - _ = Windows.ShowWindow(hwnd, Windows.SW_SHOWDEFAULT); + _ = Windows.ShowWindow(hwnd, SW.SW_SHOWDEFAULT); MSG msg = default; diff --git a/src/ComputeSharp/ComputeSharp.csproj b/src/ComputeSharp/ComputeSharp.csproj index 66955537..166a7bc1 100644 --- a/src/ComputeSharp/ComputeSharp.csproj +++ b/src/ComputeSharp/ComputeSharp.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12DeviceExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12DeviceExtensions.cs index f7cc50f6..a5d074d6 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12DeviceExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12DeviceExtensions.cs @@ -176,7 +176,7 @@ internal static unsafe class ID3D12DeviceExtensions { D3D12_SHADER_RESOURCE_VIEW_DESC d3D12ShaderResourceViewDescription = default; d3D12ShaderResourceViewDescription.ViewDimension = D3D12_SRV_DIMENSION_BUFFER; - d3D12ShaderResourceViewDescription.Shader4ComponentMapping = DirectX.D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; + d3D12ShaderResourceViewDescription.Shader4ComponentMapping = D3D12.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 = DirectX.D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; + d3D12ShaderResourceViewDescription.Shader4ComponentMapping = D3D12.D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; d3D12ShaderResourceViewDescription.Texture2D.MipLevels = uint.MaxValue; d3D12Device.CreateShaderResourceView(d3D12Resource, &d3D12ShaderResourceViewDescription, d3D12CpuDescriptorHandle); diff --git a/src/ComputeSharp/Graphics/Helpers/D3D12FeatureHelper.cs b/src/ComputeSharp/Graphics/Helpers/D3D12FeatureHelper.cs index e7188897..1b9520c8 100644 --- a/src/ComputeSharp/Graphics/Helpers/D3D12FeatureHelper.cs +++ b/src/ComputeSharp/Graphics/Helpers/D3D12FeatureHelper.cs @@ -51,7 +51,7 @@ internal static class D3D12FeatureHelper &d3D12Options7, (uint)sizeof(D3D12_FEATURE_DATA_D3D12_OPTIONS7)); - if (result == Windows.S_OK) + if (result == S.S_OK) { return D3D12_HEAP_FLAGS.D3D12_HEAP_FLAG_CREATE_NOT_ZEROED; } diff --git a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.Enumerator.cs b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.Enumerator.cs index 7023875f..1fcb0248 100644 --- a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.Enumerator.cs +++ b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.Enumerator.cs @@ -123,7 +123,7 @@ internal static partial class DeviceHelper Windows.__uuidof(), dxgiAdapter1.GetVoidAddressOf()); - if (enumAdapters1Result == Windows.DXGI_ERROR_NOT_FOUND) + if (enumAdapters1Result == DXGI.DXGI_ERROR_NOT_FOUND) { this.dxgiFactory6.Get()->EnumWarpAdapter(Windows.__uuidof(), dxgiAdapter1.GetVoidAddressOf()).Assert(); diff --git a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.IDXGIFactory6.cs b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.IDXGIFactory6.cs index 74fbccd8..71532feb 100644 --- a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.IDXGIFactory6.cs +++ b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.IDXGIFactory6.cs @@ -18,7 +18,7 @@ internal static partial class DeviceHelper /// private const uint IDXGIFactoryCreationFlags = #if DEBUG - DirectX.DXGI_CREATE_FACTORY_DEBUG; + DXGI.DXGI_CREATE_FACTORY_DEBUG; #else 0; #endif @@ -37,7 +37,7 @@ internal static partial class DeviceHelper HRESULT result = dxgiFactory4.CopyTo(dxgiFactory6); - if (result == Windows.S_OK) + if (result == S.S_OK) { return; } diff --git a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.cs b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.cs index 353497f6..28b9bbfe 100644 --- a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.cs +++ b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.cs @@ -99,7 +99,7 @@ internal static partial class DeviceHelper Windows.__uuidof(), dxgiAdapter1.GetVoidAddressOf()); - if (enumAdapters1Result == Windows.DXGI_ERROR_NOT_FOUND) + if (enumAdapters1Result == DXGI.DXGI_ERROR_NOT_FOUND) { return false; } diff --git a/src/ComputeSharp/Graphics/Helpers/WICFormatHelper.cs b/src/ComputeSharp/Graphics/Helpers/WICFormatHelper.cs index cf75c4b1..5d08fe7c 100644 --- a/src/ComputeSharp/Graphics/Helpers/WICFormatHelper.cs +++ b/src/ComputeSharp/Graphics/Helpers/WICFormatHelper.cs @@ -23,11 +23,11 @@ internal static class WICFormatHelper public static Guid GetForType() where T : unmanaged { - 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; + if (typeof(T) == typeof(Bgra32)) return GUID.GUID_WICPixelFormat32bppBGRA; + else if (typeof(T) == typeof(Rgba32)) return GUID.GUID_WICPixelFormat32bppRGBA; + else if (typeof(T) == typeof(Rgba64)) return GUID.GUID_WICPixelFormat64bppRGBA; + else if (typeof(T) == typeof(R8)) return GUID.GUID_WICPixelFormat8bppGray; + else if (typeof(T) == typeof(R16)) return GUID.GUID_WICPixelFormat16bppGray; else return ThrowHelper.ThrowArgumentException("Invalid texture type"); } @@ -42,58 +42,58 @@ internal static class WICFormatHelper public static bool TryGetIntermediateFormatForType(Guid containerFormat, out Guid intermediateFormat) where T : unmanaged { - if (containerFormat == Windows.GUID_ContainerFormatBmp) + if (containerFormat == GUID.GUID_ContainerFormatBmp) { if (typeof(T) == typeof(Bgra32)) intermediateFormat = default; - 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 if (typeof(T) == typeof(Rgba32)) intermediateFormat = GUID.GUID_WICPixelFormat32bppBGRA; + else if (typeof(T) == typeof(Rgba64)) intermediateFormat = GUID.GUID_WICPixelFormat32bppBGRA; + else if (typeof(T) == typeof(R8)) intermediateFormat = GUID.GUID_WICPixelFormat24bppBGR; + else if (typeof(T) == typeof(R16)) intermediateFormat = GUID.GUID_WICPixelFormat24bppBGR; else intermediateFormat = ThrowHelper.ThrowArgumentException("Invalid texture type"); } - else if (containerFormat == Windows.GUID_ContainerFormatPng) + else if (containerFormat == GUID.GUID_ContainerFormatPng) { if (typeof(T) == typeof(Bgra32)) intermediateFormat = default; - else if (typeof(T) == typeof(Rgba32)) intermediateFormat = Windows.GUID_WICPixelFormat32bppBGRA; + else if (typeof(T) == typeof(Rgba32)) intermediateFormat = GUID.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 = Windows.GUID_WICPixelFormat8bppGray; + else if (typeof(T) == typeof(R16)) intermediateFormat = GUID.GUID_WICPixelFormat8bppGray; else intermediateFormat = ThrowHelper.ThrowArgumentException("Invalid texture type"); } - else if (containerFormat == Windows.GUID_ContainerFormatJpeg) + else if (containerFormat == GUID.GUID_ContainerFormatJpeg) { - 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; + if (typeof(T) == typeof(Bgra32)) intermediateFormat = GUID.GUID_WICPixelFormat24bppBGR; + else if (typeof(T) == typeof(Rgba32)) intermediateFormat = GUID.GUID_WICPixelFormat24bppBGR; + else if (typeof(T) == typeof(Rgba64)) intermediateFormat = GUID.GUID_WICPixelFormat24bppBGR; else if (typeof(T) == typeof(R8)) intermediateFormat = default; - else if (typeof(T) == typeof(R16)) intermediateFormat = Windows.GUID_WICPixelFormat8bppGray; + else if (typeof(T) == typeof(R16)) intermediateFormat = GUID.GUID_WICPixelFormat8bppGray; else intermediateFormat = ThrowHelper.ThrowArgumentException("Invalid texture type"); } - else if (containerFormat == Windows.GUID_ContainerFormatWmp) + else if (containerFormat == GUID.GUID_ContainerFormatWmp) { if (typeof(T) == typeof(Bgra32)) intermediateFormat = default; - else if (typeof(T) == typeof(Rgba32)) intermediateFormat = Windows.GUID_WICPixelFormat32bppBGRA; + else if (typeof(T) == typeof(Rgba32)) intermediateFormat = GUID.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("Invalid texture type"); } - else if (containerFormat == Windows.GUID_ContainerFormatTiff) + else if (containerFormat == GUID.GUID_ContainerFormatTiff) { if (typeof(T) == typeof(Bgra32)) intermediateFormat = default; - else if (typeof(T) == typeof(Rgba32)) intermediateFormat = Windows.GUID_WICPixelFormat32bppBGRA; + else if (typeof(T) == typeof(Rgba32)) intermediateFormat = GUID.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("Invalid texture type"); } - else if (containerFormat == Windows.GUID_ContainerFormatDds) + else if (containerFormat == GUID.GUID_ContainerFormatDds) { if (typeof(T) == typeof(Bgra32)) intermediateFormat = default; - 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 if (typeof(T) == typeof(Rgba32)) intermediateFormat = GUID.GUID_WICPixelFormat32bppBGRA; + else if (typeof(T) == typeof(Rgba64)) intermediateFormat = GUID.GUID_WICPixelFormat32bppBGRA; + else if (typeof(T) == typeof(R8)) intermediateFormat = GUID.GUID_WICPixelFormat32bppBGRA; + else if (typeof(T) == typeof(R16)) intermediateFormat = GUID.GUID_WICPixelFormat32bppBGRA; else intermediateFormat = ThrowHelper.ThrowArgumentException("Invalid texture type"); } else @@ -115,16 +115,16 @@ internal static class WICFormatHelper { return Path.GetExtension(filename).ToString() switch { - ".bmp" => Windows.GUID_ContainerFormatBmp, - ".png" => Windows.GUID_ContainerFormatPng, + ".bmp" => GUID.GUID_ContainerFormatBmp, + ".png" => GUID.GUID_ContainerFormatPng, ".jpg" or - ".jpeg" => Windows.GUID_ContainerFormatJpeg, + ".jpeg" => GUID.GUID_ContainerFormatJpeg, ".jxr" or ".hdp" or ".wdp" or - ".wmp" => Windows.GUID_ContainerFormatWmp, - ".tiff" => Windows.GUID_ContainerFormatTiff, - ".dds" => Windows.GUID_ContainerFormatDds, + ".wmp" => GUID.GUID_ContainerFormatWmp, + ".tiff" => GUID.GUID_ContainerFormatTiff, + ".dds" => GUID.GUID_ContainerFormatDds, _ => ThrowHelper.ThrowArgumentException("Invalid filename"), }; } diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs index 0a361b06..dca6efdd 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs @@ -60,7 +60,7 @@ public unsafe abstract class Buffer : NativeObject if (resourceType == ResourceType.Constant) { - Guard.IsBetweenOrEqualTo(length, 1, DirectX.D3D12_REQ_CONSTANT_BUFFER_ELEMENT_COUNT, nameof(length)); + Guard.IsBetweenOrEqualTo(length, 1, D3D12.D3D12_REQ_CONSTANT_BUFFER_ELEMENT_COUNT, nameof(length)); } else { @@ -75,7 +75,7 @@ public unsafe abstract class Buffer : NativeObject } nint usableSizeInBytes = checked((nint)(length * elementSizeInBytes)); - nint effectiveSizeInBytes = resourceType == ResourceType.Constant ? AlignmentHelper.Pad(usableSizeInBytes, DirectX.D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT) : usableSizeInBytes; + nint effectiveSizeInBytes = resourceType == ResourceType.Constant ? AlignmentHelper.Pad(usableSizeInBytes, D3D12.D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT) : usableSizeInBytes; SizeInBytes = usableSizeInBytes; GraphicsDevice = device; diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs index 8b47d9a2..db46dfae 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs @@ -74,8 +74,8 @@ public unsafe abstract class Texture2D : NativeObject, GraphicsResourceHelper { device.ThrowIfDisposed(); - 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)); + Guard.IsBetweenOrEqualTo(width, 1, D3D12.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION, nameof(width)); + Guard.IsBetweenOrEqualTo(height, 1, D3D12.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 c8d8b1ea..492be47d 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/Texture3D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/Texture3D{T}.cs @@ -75,9 +75,9 @@ public unsafe abstract class Texture3D : NativeObject, GraphicsResourceHelper { device.ThrowIfDisposed(); - 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)); + Guard.IsBetweenOrEqualTo(width, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(width)); + Guard.IsBetweenOrEqualTo(height, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(height)); + Guard.IsBetweenOrEqualTo(depth, 1, D3D12.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/TransferTexture2D{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture2D{T}.cs index 169811b3..90ce33fd 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture2D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture2D{T}.cs @@ -50,8 +50,8 @@ public unsafe abstract class TransferTexture2D : NativeObject { device.ThrowIfDisposed(); - 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)); + Guard.IsBetweenOrEqualTo(width, 1, D3D12.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION, nameof(width)); + Guard.IsBetweenOrEqualTo(height, 1, D3D12.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 c137340d..f7765687 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture3D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture3D{T}.cs @@ -51,9 +51,9 @@ public unsafe abstract class TransferTexture3D : NativeObject { device.ThrowIfDisposed(); - 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)); + Guard.IsBetweenOrEqualTo(width, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(width)); + Guard.IsBetweenOrEqualTo(height, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(height)); + Guard.IsBetweenOrEqualTo(depth, 1, D3D12.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 beb59215..3bd413f7 100644 --- a/src/ComputeSharp/Graphics/Resources/ConstantBuffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/ConstantBuffer{T}.cs @@ -26,7 +26,7 @@ public sealed class ConstantBuffer : Buffer /// /// The alignment boundary for elements in a constant buffer. /// - private const int ElementAlignment = DirectX.D3D12_COMMONSHADER_CONSTANT_BUFFER_PARTIAL_UPDATE_EXTENTS_BYTE_ALIGNMENT; + private const int ElementAlignment = D3D12.D3D12_COMMONSHADER_CONSTANT_BUFFER_PARTIAL_UPDATE_EXTENTS_BYTE_ALIGNMENT; /// /// Creates a new instance with the specified parameters. diff --git a/src/ComputeSharp/Graphics/Resources/Interop/__Internals/ResourceDescriptor.cs b/src/ComputeSharp/Graphics/Resources/Interop/__Internals/ResourceDescriptor.cs index da04ea73..e0cb246b 100644 --- a/src/ComputeSharp/Graphics/Resources/Interop/__Internals/ResourceDescriptor.cs +++ b/src/ComputeSharp/Graphics/Resources/Interop/__Internals/ResourceDescriptor.cs @@ -45,6 +45,6 @@ public struct ResourceDescriptor descriptor.BaseShaderRegister = offset; descriptor.RegisterSpace = 0; descriptor.Flags = D3D12_DESCRIPTOR_RANGE_FLAG_NONE; - descriptor.OffsetInDescriptorsFromTableStart = DirectX.D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND; + descriptor.OffsetInDescriptorsFromTableStart = D3D12.D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND; } } diff --git a/src/ComputeSharp/Shaders/ShaderRunner{T}.cs b/src/ComputeSharp/Shaders/ShaderRunner{T}.cs index 0619fcf8..a86d812e 100644 --- a/src/ComputeSharp/Shaders/ShaderRunner{T}.cs +++ b/src/ComputeSharp/Shaders/ShaderRunner{T}.cs @@ -119,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, 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)); + Guard.IsBetweenOrEqualTo(groupsX, 1, D3D11.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, nameof(groupsX)); + Guard.IsBetweenOrEqualTo(groupsY, 1, D3D11.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, nameof(groupsX)); + Guard.IsBetweenOrEqualTo(groupsZ, 1, D3D11.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, nameof(groupsX)); ShaderKey key = new(shader.GetDispatchId(), threadsX, threadsY, threadsZ); PipelineData? pipelineData; @@ -174,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, 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(groupsX, 1, D3D11.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, nameof(groupsX)); + Guard.IsBetweenOrEqualTo(groupsY, 1, D3D11.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, nameof(groupsX)); ShaderKey key = new(shader.GetDispatchId(), threadsX, threadsY, 1); PipelineData? pipelineData; diff --git a/tests/ComputeSharp.Tests/InteropServicesTests.cs b/tests/ComputeSharp.Tests/InteropServicesTests.cs index bfc9a13c..fa7b36ee 100644 --- a/tests/ComputeSharp.Tests/InteropServicesTests.cs +++ b/tests/ComputeSharp.Tests/InteropServicesTests.cs @@ -32,7 +32,7 @@ public unsafe partial class InteropServicesTests int hResult = InteropServices.TryGetID3D12Device(device.Get(), Windows.__uuidof(), (void**)d3D12Device.GetAddressOf()); - Assert.AreEqual(hResult, Windows.S_OK); + Assert.AreEqual(hResult, S.S_OK); Assert.IsTrue(d3D12Device.Get() != null); luid = d3D12Device.Get()->GetAdapterLuid(); @@ -60,7 +60,7 @@ public unsafe partial class InteropServicesTests int hResult = InteropServices.TryGetID3D12Resource(buffer, Windows.__uuidof(), (void**)d3D12Resource.GetAddressOf()); - Assert.AreEqual(hResult, Windows.S_OK); + Assert.AreEqual(hResult, S.S_OK); Assert.IsTrue(d3D12Resource.Get() != null); Assert.AreEqual(d3D12Resource.Get()->GetDesc().Dimension, D3D12_RESOURCE_DIMENSION_BUFFER); } @@ -84,7 +84,7 @@ public unsafe partial class InteropServicesTests int hResult = InteropServices.TryGetID3D12Resource(buffer, Windows.__uuidof(), (void**)d3D12Resource.GetAddressOf()); - Assert.AreEqual(hResult, Windows.S_OK); + Assert.AreEqual(hResult, S.S_OK); Assert.IsTrue(d3D12Resource.Get() != null); Assert.AreEqual(d3D12Resource.Get()->GetDesc().Dimension, D3D12_RESOURCE_DIMENSION_TEXTURE2D); } @@ -108,7 +108,7 @@ public unsafe partial class InteropServicesTests int hResult = InteropServices.TryGetID3D12Resource(buffer, Windows.__uuidof(), (void**)d3D12Resource.GetAddressOf()); - Assert.AreEqual(hResult, Windows.S_OK); + Assert.AreEqual(hResult, S.S_OK); Assert.IsTrue(d3D12Resource.Get() != null); Assert.AreEqual(d3D12Resource.Get()->GetDesc().Dimension, D3D12_RESOURCE_DIMENSION_TEXTURE3D); } @@ -132,7 +132,7 @@ public unsafe partial class InteropServicesTests int hResult = InteropServices.TryGetID3D12Resource(buffer, Windows.__uuidof(), (void**)d3D12Resource.GetAddressOf()); - Assert.AreEqual(hResult, Windows.S_OK); + Assert.AreEqual(hResult, S.S_OK); Assert.IsTrue(d3D12Resource.Get() != null); Assert.AreEqual(d3D12Resource.Get()->GetDesc().Dimension, D3D12_RESOURCE_DIMENSION_BUFFER); } @@ -156,7 +156,7 @@ public unsafe partial class InteropServicesTests int hResult = InteropServices.TryGetID3D12Resource(buffer, Windows.__uuidof(), (void**)d3D12Resource.GetAddressOf()); - Assert.AreEqual(hResult, Windows.S_OK); + Assert.AreEqual(hResult, S.S_OK); Assert.IsTrue(d3D12Resource.Get() != null); Assert.AreEqual(d3D12Resource.Get()->GetDesc().Dimension, D3D12_RESOURCE_DIMENSION_BUFFER); } @@ -180,7 +180,7 @@ public unsafe partial class InteropServicesTests int hResult = InteropServices.TryGetID3D12Resource(buffer, Windows.__uuidof(), (void**)d3D12Resource.GetAddressOf()); - Assert.AreEqual(hResult, Windows.S_OK); + Assert.AreEqual(hResult, S.S_OK); Assert.IsTrue(d3D12Resource.Get() != null); Assert.AreEqual(d3D12Resource.Get()->GetDesc().Dimension, D3D12_RESOURCE_DIMENSION_BUFFER); }