From b7c383399fdca22edf642715183e7830e415f1eb Mon Sep 17 00:00:00 2001 From: David Hall Date: Tue, 14 Jan 2025 18:17:45 -0700 Subject: [PATCH] More little updates --- PInvoke/Direct3D12/D3D12.Struct.cs | 222 ++++++++++------------------- PInvoke/Direct3D12/D3D12.cs | 171 ++++++++++++++++++---- 2 files changed, 220 insertions(+), 173 deletions(-) diff --git a/PInvoke/Direct3D12/D3D12.Struct.cs b/PInvoke/Direct3D12/D3D12.Struct.cs index e6577082b..81d8a183b 100644 --- a/PInvoke/Direct3D12/D3D12.Struct.cs +++ b/PInvoke/Direct3D12/D3D12.Struct.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; -using System.Security.Cryptography; namespace Vanara.PInvoke; @@ -650,7 +649,7 @@ public struct D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS /// /// The memory pointed to must be in state D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE. /// - public D3D12_GPU_VIRTUAL_ADDRESS InstanceDescs { get => (ulong)union; set => union = (IntPtr)value; } + public D3D12_GPU_VIRTUAL_ADDRESS InstanceDescs { readonly get => (ulong)union; set => union = (IntPtr)value; } /// /// @@ -786,12 +785,12 @@ private struct UNION /// /// Specifies a 4-entry array of float values, determining the RGBA value. The order of RGBA matches the order used with ClearRenderTargetView. /// - public float[] Color { get => (float[])u.Color; set => u.Color = value; } + public float[] Color { readonly get => (float[])u.Color; set => u.Color = value; } /// /// Specifies one member of D3D12_DEPTH_STENCIL_VALUE. These values match the semantics of Depth and Stencil in ClearDepthStencilView. /// - public D3D12_DEPTH_STENCIL_VALUE DepthStencil { get => u.DepthStencil; set => u.DepthStencil = value; } + public D3D12_DEPTH_STENCIL_VALUE DepthStencil { readonly get => u.DepthStencil; set => u.DepthStencil = value; } /// Initializes a new instance of the struct. /// Specifies one member of the DXGI_FORMAT enum. @@ -824,13 +823,7 @@ Format is DXGI_FORMAT.DXGI_FORMAT_D24_UNORM_S8_UINT or DXGI_FORMAT.DXGI_FORMAT_D u.Color.Equals(other.u.Color); /// - public override int GetHashCode() - { - int hashCode = -390594502; - hashCode = hashCode * -1521134295 + Format.GetHashCode(); - hashCode = hashCode * -1521134295 + u.Color.GetHashCode(); - return hashCode; - } + public override int GetHashCode() => (Format, u.Color).GetHashCode(); /// Implements the operator op_Equality. /// The left. @@ -4049,15 +4042,7 @@ public D3D12_HEAP_DESC(in D3D12_RESOURCE_ALLOCATION_INFO resAllocInfo, D3D12_CPU public bool Equals(D3D12_HEAP_DESC other) => SizeInBytes == other.SizeInBytes && Properties.Equals(other.Properties) && Alignment == other.Alignment && Flags == other.Flags; /// - public override int GetHashCode() - { - int hashCode = -1327957844; - hashCode = hashCode * -1521134295 + SizeInBytes.GetHashCode(); - hashCode = hashCode * -1521134295 + Properties.GetHashCode(); - hashCode = hashCode * -1521134295 + Alignment.GetHashCode(); - hashCode = hashCode * -1521134295 + Flags.GetHashCode(); - return hashCode; - } + public override int GetHashCode() => (SizeInBytes, Properties, Alignment, Flags).GetHashCode(); /// Implements the operator op_Equality. /// The left. @@ -4209,16 +4194,7 @@ D3D12_HEAP_TYPE.D3D12_HEAP_TYPE_GPU_UPLOAD or D3D12_HEAP_TYPE.D3D12_HEAP_TYPE_CU public bool Equals(D3D12_HEAP_PROPERTIES other) => Type == other.Type && CPUPageProperty == other.CPUPageProperty && MemoryPoolPreference == other.MemoryPoolPreference && CreationNodeMask == other.CreationNodeMask && VisibleNodeMask == other.VisibleNodeMask; /// - public override int GetHashCode() - { - int hashCode = -856471406; - hashCode = hashCode * -1521134295 + Type.GetHashCode(); - hashCode = hashCode * -1521134295 + CPUPageProperty.GetHashCode(); - hashCode = hashCode * -1521134295 + MemoryPoolPreference.GetHashCode(); - hashCode = hashCode * -1521134295 + CreationNodeMask.GetHashCode(); - hashCode = hashCode * -1521134295 + VisibleNodeMask.GetHashCode(); - return hashCode; - } + public override int GetHashCode() => (Type, CPUPageProperty, MemoryPoolPreference, CreationNodeMask, VisibleNodeMask).GetHashCode(); /// Implements the operator op_Equality. /// The left. @@ -5139,19 +5115,51 @@ public struct D3D12_RANGE_UINT64(ulong begin, ulong end) /// you always set MultisampleEnable to TRUE whenever you render on MSAA render targets. /// /// + /// Initializes a new instance of the struct. + /// A D3D12_FILL_MODE-typed value that specifies the fill mode to use when rendering. + /// + /// A D3D12_CULL_MODE-typed value that specifies that triangles facing the specified direction are not drawn. + /// + /// + /// Determines if a triangle is front- or back-facing. If this member is TRUE, a triangle will be considered front-facing if + /// its vertices are counter-clockwise on the render target and considered back-facing if they are clockwise. If this parameter is + /// FALSE, the opposite is true. + /// + /// Depth value added to a given pixel. For info about depth bias, see Depth Bias. + /// Maximum depth bias of a pixel. For info about depth bias, see Depth Bias. + /// Scalar on a given pixel's slope. For info about depth bias, see Depth Bias. + /// Specifies whether to enable clipping based on distance. + /// + /// Specifies whether to use the quadrilateral or alpha line anti-aliasing algorithm on multisample antialiasing (MSAA) render + /// targets. Set to TRUE to use the quadrilateral line anti-aliasing algorithm and to FALSE to use the alpha line + /// anti-aliasing algorithm. For more info about this member, see Remarks. + /// + /// + /// Specifies whether to enable line antialiasing; only applies if doing line drawing and MultisampleEnable is FALSE. + /// For more info about this member, see Remarks. + /// + /// + /// The sample count that is forced while UAV rendering or rasterizing. Valid values are 0, 1, 4, 8, and optionally 16. 0 indicates + /// that the sample count is not forced. + /// + /// + /// A D3D12_CONSERVATIVE_RASTERIZATION_MODE-typed value that identifies whether conservative rasterization is on or off. + /// // https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ns-d3d12-d3d12_rasterizer_desc typedef struct D3D12_RASTERIZER_DESC { // D3D12_FILL_MODE FillMode; D3D12_CULL_MODE CullMode; BOOL FrontCounterClockwise; INT DepthBias; FLOAT DepthBiasClamp; FLOAT // SlopeScaledDepthBias; BOOL DepthClipEnable; BOOL MultisampleEnable; BOOL AntialiasedLineEnable; UINT ForcedSampleCount; // D3D12_CONSERVATIVE_RASTERIZATION_MODE ConservativeRaster; } D3D12_RASTERIZER_DESC; [PInvokeData("d3d12.h", MSDNShortId = "NS:d3d12.D3D12_RASTERIZER_DESC")] [StructLayout(LayoutKind.Sequential)] - public struct D3D12_RASTERIZER_DESC + public struct D3D12_RASTERIZER_DESC(D3D12.D3D12_FILL_MODE fillMode, D3D12.D3D12_CULL_MODE cullMode, bool frontCounterClockwise, int depthBias, + float depthBiasClamp, float slopeScaledDepthBias, bool depthClipEnable, bool multisampleEnable, + bool antialiasedLineEnable, uint forcedSampleCount, D3D12.D3D12_CONSERVATIVE_RASTERIZATION_MODE conservativeRaster) { /// A D3D12_FILL_MODE-typed value that specifies the fill mode to use when rendering. - public D3D12_FILL_MODE FillMode; + public D3D12_FILL_MODE FillMode = fillMode; /// A D3D12_CULL_MODE-typed value that specifies that triangles facing the specified direction are not drawn. - public D3D12_CULL_MODE CullMode; + public D3D12_CULL_MODE CullMode = cullMode; /// /// Determines if a triangle is front- or back-facing. If this member is TRUE, a triangle will be considered front-facing if @@ -5159,16 +5167,16 @@ public struct D3D12_RASTERIZER_DESC /// FALSE, the opposite is true. /// [MarshalAs(UnmanagedType.Bool)] - public bool FrontCounterClockwise; + public bool FrontCounterClockwise = frontCounterClockwise; /// Depth value added to a given pixel. For info about depth bias, see Depth Bias. - public int DepthBias; + public int DepthBias = depthBias; /// Maximum depth bias of a pixel. For info about depth bias, see Depth Bias. - public float DepthBiasClamp; + public float DepthBiasClamp = depthBiasClamp; /// Scalar on a given pixel's slope. For info about depth bias, see Depth Bias. - public float SlopeScaledDepthBias; + public float SlopeScaledDepthBias = slopeScaledDepthBias; /// /// Specifies whether to enable clipping based on distance. @@ -5187,7 +5195,7 @@ public struct D3D12_RASTERIZER_DESC /// /// [MarshalAs(UnmanagedType.Bool)] - public bool DepthClipEnable; + public bool DepthClipEnable = depthClipEnable; /// /// Specifies whether to use the quadrilateral or alpha line anti-aliasing algorithm on multisample antialiasing (MSAA) render @@ -5195,14 +5203,14 @@ public struct D3D12_RASTERIZER_DESC /// anti-aliasing algorithm. For more info about this member, see Remarks. /// [MarshalAs(UnmanagedType.Bool)] - public bool MultisampleEnable; + public bool MultisampleEnable = multisampleEnable; /// /// Specifies whether to enable line antialiasing; only applies if doing line drawing and MultisampleEnable is FALSE. /// For more info about this member, see Remarks. /// [MarshalAs(UnmanagedType.Bool)] - public bool AntialiasedLineEnable; + public bool AntialiasedLineEnable = antialiasedLineEnable; /// /// Type: UINT @@ -5213,12 +5221,12 @@ public struct D3D12_RASTERIZER_DESC /// If you want to render with ForcedSampleCount set to 1 or greater, you must follow these guidelines: Otherwise, /// rendering behavior is undefined. /// - public uint ForcedSampleCount; + public uint ForcedSampleCount = forcedSampleCount; /// /// A D3D12_CONSERVATIVE_RASTERIZATION_MODE-typed value that identifies whether conservative rasterization is on or off. /// - public D3D12_CONSERVATIVE_RASTERIZATION_MODE ConservativeRaster; + public D3D12_CONSERVATIVE_RASTERIZATION_MODE ConservativeRaster = conservativeRaster; /// Initializes a new instance of the struct with standard (not default) values. public D3D12_RASTERIZER_DESC() : @@ -5227,53 +5235,6 @@ public D3D12_RASTERIZER_DESC() : D3D12_CONSERVATIVE_RASTERIZATION_MODE.D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF) { } - - /// Initializes a new instance of the struct. - /// A D3D12_FILL_MODE-typed value that specifies the fill mode to use when rendering. - /// - /// A D3D12_CULL_MODE-typed value that specifies that triangles facing the specified direction are not drawn. - /// - /// - /// Determines if a triangle is front- or back-facing. If this member is TRUE, a triangle will be considered front-facing if - /// its vertices are counter-clockwise on the render target and considered back-facing if they are clockwise. If this parameter is - /// FALSE, the opposite is true. - /// - /// Depth value added to a given pixel. For info about depth bias, see Depth Bias. - /// Maximum depth bias of a pixel. For info about depth bias, see Depth Bias. - /// Scalar on a given pixel's slope. For info about depth bias, see Depth Bias. - /// Specifies whether to enable clipping based on distance. - /// - /// Specifies whether to use the quadrilateral or alpha line anti-aliasing algorithm on multisample antialiasing (MSAA) render - /// targets. Set to TRUE to use the quadrilateral line anti-aliasing algorithm and to FALSE to use the alpha line - /// anti-aliasing algorithm. For more info about this member, see Remarks. - /// - /// - /// Specifies whether to enable line antialiasing; only applies if doing line drawing and MultisampleEnable is FALSE. - /// For more info about this member, see Remarks. - /// - /// - /// The sample count that is forced while UAV rendering or rasterizing. Valid values are 0, 1, 4, 8, and optionally 16. 0 indicates - /// that the sample count is not forced. - /// - /// - /// A D3D12_CONSERVATIVE_RASTERIZATION_MODE-typed value that identifies whether conservative rasterization is on or off. - /// - public D3D12_RASTERIZER_DESC(D3D12_FILL_MODE fillMode, D3D12_CULL_MODE cullMode, bool frontCounterClockwise, int depthBias, - float depthBiasClamp, float slopeScaledDepthBias, bool depthClipEnable, bool multisampleEnable, - bool antialiasedLineEnable, uint forcedSampleCount, D3D12_CONSERVATIVE_RASTERIZATION_MODE conservativeRaster) - { - FillMode = fillMode; - CullMode = cullMode; - FrontCounterClockwise = frontCounterClockwise; - DepthBias = depthBias; - DepthBiasClamp = depthBiasClamp; - SlopeScaledDepthBias = slopeScaledDepthBias; - DepthClipEnable = depthClipEnable; - MultisampleEnable = multisampleEnable; - AntialiasedLineEnable = antialiasedLineEnable; - ForcedSampleCount = forcedSampleCount; - ConservativeRaster = conservativeRaster; - } } /// Represents an axis-aligned bounding box (AABB) used as raytracing geometry. @@ -5721,7 +5682,7 @@ public struct D3D12_RAYTRACING_INSTANCE_DESC /// Type: UINT : 24 /// An arbitrary 24-bit value that can be accessed using the InstanceID intrinsic function in supported shader types. /// - public uint InstanceID { get => (uint)(bits & 0xFFFFFF); set => bits = (bits & 0xFFFFFFFFFF000000) | value; } + public uint InstanceID { readonly get => (uint)(bits & 0xFFFFFF); set => bits = (bits & 0xFFFFFFFFFF000000) | value; } /// /// Type: UINT : 8 @@ -5731,7 +5692,7 @@ public struct D3D12_RAYTRACING_INSTANCE_DESC /// see, the InstanceInclusionMask parameter to the TraceRay function. /// /// - public uint InstanceMask { get => (uint)((bits >> 24) & 0xFF); set => bits = (bits & 0xFFFFFFFF00FFFFFF) | ((ulong)value << 24); } + public uint InstanceMask { readonly get => (uint)((bits >> 24) & 0xFF); set => bits = (bits & 0xFFFFFFFF00FFFFFF) | ((ulong)value << 24); } /// /// Type: UINT : 24 @@ -5739,13 +5700,13 @@ public struct D3D12_RAYTRACING_INSTANCE_DESC /// An arbitrary 24-bit value representing per-instance contribution to add into shader table indexing to select the hit group to use. /// /// - public uint InstanceContributionToHitGroupIndex { get => (uint)((bits >> 32) & 0xFFFFFF); set => bits = (bits & 0xFF000000FFFFFFFF) | ((ulong)value << 32); } + public uint InstanceContributionToHitGroupIndex { readonly get => (uint)((bits >> 32) & 0xFFFFFF); set => bits = (bits & 0xFF000000FFFFFFFF) | ((ulong)value << 32); } /// /// Type: UINT : 8 /// An 8-bit mask representing flags from D3D12_RAYTRACING_INSTANCE_FLAGS to apply to the instance. /// - public D3D12_RAYTRACING_INSTANCE_FLAGS Flags { get => (D3D12_RAYTRACING_INSTANCE_FLAGS)((bits >> 56) & 0xFF); set => bits = (bits & 0x00FFFFFFFFFFFFFF) | ((ulong)value << 56); } + public D3D12_RAYTRACING_INSTANCE_FLAGS Flags { readonly get => (D3D12_RAYTRACING_INSTANCE_FLAGS)((bits >> 56) & 0xFF); set => bits = (bits & 0x00FFFFFFFFFFFFFF) | ((ulong)value << 56); } /// /// Type: D3D12_GPU_VIRTUAL_ADDRESS @@ -6609,7 +6570,8 @@ public bool Equals(D3D12_RESOURCE_DESC other) => Dimension == other.Dimension && /// The resource alloc information. /// The flags. /// - public static D3D12_RESOURCE_DESC Buffer(in D3D12_RESOURCE_ALLOCATION_INFO resAllocInfo, D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAGS.D3D12_RESOURCE_FLAG_NONE) => new(D3D12_RESOURCE_DIMENSION.D3D12_RESOURCE_DIMENSION_BUFFER, resAllocInfo.Alignment, resAllocInfo.SizeInBytes, + public static D3D12_RESOURCE_DESC Buffer(in D3D12_RESOURCE_ALLOCATION_INFO resAllocInfo, D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAGS.D3D12_RESOURCE_FLAG_NONE) => + new(D3D12_RESOURCE_DIMENSION.D3D12_RESOURCE_DIMENSION_BUFFER, resAllocInfo.Alignment, resAllocInfo.SizeInBytes, 1, 1, 1, DXGI_FORMAT.DXGI_FORMAT_UNKNOWN, 1, 0, D3D12_TEXTURE_LAYOUT.D3D12_TEXTURE_LAYOUT_ROW_MAJOR, flags); /// Creates a buffer instance. @@ -6617,8 +6579,9 @@ public bool Equals(D3D12_RESOURCE_DESC other) => Dimension == other.Dimension && /// The flags. /// The alignment. /// - public static D3D12_RESOURCE_DESC Buffer(ulong width, D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAGS.D3D12_RESOURCE_FLAG_NONE, ulong alignment = 0) => new(D3D12_RESOURCE_DIMENSION.D3D12_RESOURCE_DIMENSION_BUFFER, alignment, width, 1, 1, 1, - DXGI_FORMAT.DXGI_FORMAT_UNKNOWN, 1, 0, D3D12_TEXTURE_LAYOUT.D3D12_TEXTURE_LAYOUT_ROW_MAJOR, flags); + public static D3D12_RESOURCE_DESC Buffer(ulong width, D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAGS.D3D12_RESOURCE_FLAG_NONE, ulong alignment = 0) => + new(D3D12_RESOURCE_DIMENSION.D3D12_RESOURCE_DIMENSION_BUFFER, alignment, width, 1, 1, 1, + DXGI_FORMAT.DXGI_FORMAT_UNKNOWN, 1, 0, D3D12_TEXTURE_LAYOUT.D3D12_TEXTURE_LAYOUT_ROW_MAJOR, flags); /// Creates a 1D texture instance. /// The format. @@ -6631,7 +6594,8 @@ public bool Equals(D3D12_RESOURCE_DESC other) => Dimension == other.Dimension && /// public static D3D12_RESOURCE_DESC Tex1D(DXGI_FORMAT format, ulong width, ushort arraySize = 1, ushort mipLevels = 0, D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAGS.D3D12_RESOURCE_FLAG_NONE, - D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT.D3D12_TEXTURE_LAYOUT_UNKNOWN, ulong alignment = 0) => new(D3D12_RESOURCE_DIMENSION.D3D12_RESOURCE_DIMENSION_TEXTURE1D, alignment, width, 1, arraySize, + D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT.D3D12_TEXTURE_LAYOUT_UNKNOWN, ulong alignment = 0) => + new(D3D12_RESOURCE_DIMENSION.D3D12_RESOURCE_DIMENSION_TEXTURE1D, alignment, width, 1, arraySize, mipLevels, format, 1, 0, layout, flags); /// Creates a 2D texture instance. @@ -6648,7 +6612,8 @@ public static D3D12_RESOURCE_DESC Tex1D(DXGI_FORMAT format, ulong width, ushort /// public static D3D12_RESOURCE_DESC Tex2D(DXGI_FORMAT format, ulong width, uint height, ushort arraySize = 1, ushort mipLevels = 0, uint sampleCount = 1, uint sampleQuality = 0, D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAGS.D3D12_RESOURCE_FLAG_NONE, - D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT.D3D12_TEXTURE_LAYOUT_UNKNOWN, ulong alignment = 0) => new(D3D12_RESOURCE_DIMENSION.D3D12_RESOURCE_DIMENSION_TEXTURE2D, alignment, width, height, arraySize, + D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT.D3D12_TEXTURE_LAYOUT_UNKNOWN, ulong alignment = 0) => + new(D3D12_RESOURCE_DIMENSION.D3D12_RESOURCE_DIMENSION_TEXTURE2D, alignment, width, height, arraySize, mipLevels, format, sampleCount, sampleQuality, layout, flags); /// Creates a 3D texture instance. @@ -6663,7 +6628,8 @@ public static D3D12_RESOURCE_DESC Tex2D(DXGI_FORMAT format, ulong width, uint he /// public static D3D12_RESOURCE_DESC Tex3D(DXGI_FORMAT format, ulong width, uint height, ushort depth, ushort mipLevels = 0, D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAGS.D3D12_RESOURCE_FLAG_NONE, - D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT.D3D12_TEXTURE_LAYOUT_UNKNOWN, ulong alignment = 0) => new(D3D12_RESOURCE_DIMENSION.D3D12_RESOURCE_DIMENSION_TEXTURE3D, alignment, width, height, depth, + D3D12_TEXTURE_LAYOUT layout = D3D12_TEXTURE_LAYOUT.D3D12_TEXTURE_LAYOUT_UNKNOWN, ulong alignment = 0) => + new(D3D12_RESOURCE_DIMENSION.D3D12_RESOURCE_DIMENSION_TEXTURE3D, alignment, width, height, depth, mipLevels, format, 1, 0, layout, flags); /// Gets the depth. @@ -6682,21 +6648,7 @@ public static D3D12_RESOURCE_DESC Tex3D(DXGI_FORMAT format, ulong width, uint he public uint CalcSubresource(uint MipSlice, uint ArraySlice, uint PlaneSlice) => D3D12CalcSubresource(MipSlice, ArraySlice, PlaneSlice, MipLevels, ArraySize); /// - public override int GetHashCode() - { - int hashCode = 1420403684; - hashCode = hashCode * -1521134295 + Dimension.GetHashCode(); - hashCode = hashCode * -1521134295 + Alignment.GetHashCode(); - hashCode = hashCode * -1521134295 + Width.GetHashCode(); - hashCode = hashCode * -1521134295 + Height.GetHashCode(); - hashCode = hashCode * -1521134295 + DepthOrArraySize.GetHashCode(); - hashCode = hashCode * -1521134295 + MipLevels.GetHashCode(); - hashCode = hashCode * -1521134295 + Format.GetHashCode(); - hashCode = hashCode * -1521134295 + SampleDesc.GetHashCode(); - hashCode = hashCode * -1521134295 + Layout.GetHashCode(); - hashCode = hashCode * -1521134295 + Flags.GetHashCode(); - return hashCode; - } + public override int GetHashCode() => (Dimension, Alignment, Width, Height, DepthOrArraySize, MipLevels, Format, SampleDesc, Layout, Flags).GetHashCode(); } /// Describes a resource, such as a texture, including a mip region. This structure is used in several methods. @@ -6819,22 +6771,7 @@ public static D3D12_RESOURCE_DESC1 Tex3D(DXGI_FORMAT format, ulong width, uint h public uint CalcSubresource(uint MipSlice, uint ArraySlice, uint PlaneSlice) => D3D12_RESOURCE_DESC.D3D12CalcSubresource(MipSlice, ArraySlice, PlaneSlice, MipLevels, ArraySize); /// - public override int GetHashCode() - { - int hashCode = 1420403684; - hashCode = hashCode * -1521134295 + Dimension.GetHashCode(); - hashCode = hashCode * -1521134295 + Alignment.GetHashCode(); - hashCode = hashCode * -1521134295 + Width.GetHashCode(); - hashCode = hashCode * -1521134295 + Height.GetHashCode(); - hashCode = hashCode * -1521134295 + DepthOrArraySize.GetHashCode(); - hashCode = hashCode * -1521134295 + MipLevels.GetHashCode(); - hashCode = hashCode * -1521134295 + Format.GetHashCode(); - hashCode = hashCode * -1521134295 + SampleDesc.GetHashCode(); - hashCode = hashCode * -1521134295 + Layout.GetHashCode(); - hashCode = hashCode * -1521134295 + Flags.GetHashCode(); - hashCode = hashCode * -1521134295 + SamplerFeedbackMipRegion.GetHashCode(); - return hashCode; - } + public override int GetHashCode() => (Dimension, Alignment, Width, Height, DepthOrArraySize, MipLevels, Format, SampleDesc, Layout, Flags, SamplerFeedbackMipRegion).GetHashCode(); /// /// Fills in the mipmap and alignment values of pDesc when either members are zero. Used to replace an implicit field to an explicit @@ -7133,18 +7070,18 @@ private struct UNION /// A D3D12_ROOT_DESCRIPTOR_TABLE structure that describes the layout of a descriptor table as a collection of descriptor /// ranges that appear one after the other in a descriptor heap. /// - public D3D12_ROOT_DESCRIPTOR_TABLE DescriptorTable { get => u.DescriptorTable; set => u = new UNION { DescriptorTable = value }; } + public D3D12_ROOT_DESCRIPTOR_TABLE DescriptorTable { readonly get => u.DescriptorTable; set => u = new UNION { DescriptorTable = value }; } /// /// A D3D12_ROOT_CONSTANTS structure that describes constants inline in the root signature that appear in shaders as one /// constant buffer. /// - public D3D12_ROOT_CONSTANTS Constants { get => u.Constants; set => u = new UNION { Constants = value }; } + public D3D12_ROOT_CONSTANTS Constants { readonly get => u.Constants; set => u = new UNION { Constants = value }; } /// /// A D3D12_ROOT_DESCRIPTOR structure that describes descriptors inline in the root signature that appear in shaders. /// - public D3D12_ROOT_DESCRIPTOR Descriptor { get => u.Descriptor; set => u = new UNION { Descriptor = value }; } + public D3D12_ROOT_DESCRIPTOR Descriptor { readonly get => u.Descriptor; set => u = new UNION { Descriptor = value }; } /// Initializes with a descriptor table. /// The descriptor ranges. @@ -7271,18 +7208,18 @@ private struct UNION /// A D3D12_ROOT_DESCRIPTOR_TABLE1 structure that describes the layout of a descriptor table as a collection of descriptor /// ranges that appear one after the other in a descriptor heap. /// - public D3D12_ROOT_DESCRIPTOR_TABLE1 DescriptorTable { get => u.DescriptorTable; set => u = new UNION { DescriptorTable = value }; } + public D3D12_ROOT_DESCRIPTOR_TABLE1 DescriptorTable { readonly get => u.DescriptorTable; set => u = new UNION { DescriptorTable = value }; } /// /// A D3D12_ROOT_CONSTANTS structure that describes constants inline in the root signature that appear in shaders as one /// constant buffer. /// - public D3D12_ROOT_CONSTANTS Constants { get => u.Constants; set => u = new UNION { Constants = value }; } + public D3D12_ROOT_CONSTANTS Constants { readonly get => u.Constants; set => u = new UNION { Constants = value }; } /// /// A D3D12_ROOT_DESCRIPTOR1 structure that describes descriptors inline in the root signature that appear in shaders. /// - public D3D12_ROOT_DESCRIPTOR1 Descriptor { get => u.Descriptor; set => u = new UNION { Descriptor = value }; } + public D3D12_ROOT_DESCRIPTOR1 Descriptor { readonly get => u.Descriptor; set => u = new UNION { Descriptor = value }; } /// Initializes with a descriptor table. /// The descriptor ranges. @@ -7444,8 +7381,7 @@ public D3D12_ROOT_SIGNATURE_DESC([Optional] D3D12_ROOT_PARAMETER[]? pParameters, if (NumStaticSamplers == 0) { this.pStaticSamplers = default; - this.pParameters = NumParameters > 0 ? (ArrayPointer)(memoryHandle = SafeCoTaskMemHandle.CreateFromList(pParameters!)) : default; - memoryHandle = SafeCoTaskMemHandle.Null; + this.pParameters = memoryHandle = NumParameters > 0 ? SafeCoTaskMemHandle.CreateFromList(pParameters!) : SafeCoTaskMemHandle.Null; } else { @@ -7525,8 +7461,7 @@ public D3D12_ROOT_SIGNATURE_DESC1([Optional] D3D12_ROOT_PARAMETER1[]? pParameter if (NumStaticSamplers == 0) { this.pStaticSamplers = default; - this.pParameters = NumParameters > 0 ? (ArrayPointer)(memoryHandle = SafeCoTaskMemHandle.CreateFromList(pParameters!)) : default; - memoryHandle = SafeCoTaskMemHandle.Null; + this.pParameters = memoryHandle = NumParameters > 0 ? SafeCoTaskMemHandle.CreateFromList(pParameters!) : SafeCoTaskMemHandle.Null; } else { @@ -7603,8 +7538,7 @@ public D3D12_ROOT_SIGNATURE_DESC2([Optional] D3D12_ROOT_PARAMETER1[]? pParameter if (NumStaticSamplers == 0) { this.pStaticSamplers = default; - this.pParameters = NumParameters > 0 ? (ArrayPointer)(memoryHandle = SafeCoTaskMemHandle.CreateFromList(pParameters!)) : default; - memoryHandle = SafeCoTaskMemHandle.Null; + this.pParameters = memoryHandle = NumParameters > 0 ? SafeCoTaskMemHandle.CreateFromList(pParameters!) : SafeCoTaskMemHandle.Null; } else { @@ -9294,12 +9228,12 @@ public struct D3D12_TEXTURE_COPY_LOCATION /// Specifies a texture layout, with offset, dimensions, and pitches, for the hardware to understand how to treat a section of a /// buffer resource as a multi-dimensional texture. To fill-in the correct data for a CopyTextureRegion call, see D3D12_PLACED_SUBRESOURCE_FOOTPRINT. /// - public D3D12_PLACED_SUBRESOURCE_FOOTPRINT PlacedFootprint { get => _union.PlacedFootprint; set => _union.PlacedFootprint = value; } + public D3D12_PLACED_SUBRESOURCE_FOOTPRINT PlacedFootprint { readonly get => _union.PlacedFootprint; set => _union.PlacedFootprint = value; } /// /// Specifies the index of the subresource of an arrayed, mip-mapped, or planar texture should be used for the copy operation. /// - public uint SubresourceIndex { get => _union.SubresourceIndex; set => _union.SubresourceIndex = value; } + public uint SubresourceIndex { readonly get => _union.SubresourceIndex; set => _union.SubresourceIndex = value; } [StructLayout(LayoutKind.Explicit)] private struct UNION diff --git a/PInvoke/Direct3D12/D3D12.cs b/PInvoke/Direct3D12/D3D12.cs index e5b30ad6d..aa118f7c4 100644 --- a/PInvoke/Direct3D12/D3D12.cs +++ b/PInvoke/Direct3D12/D3D12.cs @@ -1,5 +1,5 @@ -global using static Vanara.PInvoke.DXGI; global using static Vanara.PInvoke.D3DCompiler; +global using static Vanara.PInvoke.DXGI; global using D3D12_BOX = Vanara.PInvoke.DXGI.D3D10_BOX; global using D3D12_GPU_VIRTUAL_ADDRESS = System.UInt64; global using D3D12_RECT = Vanara.PInvoke.RECT; @@ -1291,8 +1291,98 @@ public static partial class D3D12 /// public const int D3D12_WORK_GRAPHS_MAX_NODE_DEPTH = 32; + private const int D3D12_ANISOTROPIC_FILTERING_BIT = 0x40; + private const int D3D12_FILTER_REDUCTION_TYPE_MASK = 0x3; + private const int D3D12_FILTER_REDUCTION_TYPE_SHIFT = 7; + private const int D3D12_FILTER_TYPE_MASK = 0x3; + private const int D3D12_MAG_FILTER_SHIFT = 2; + private const int D3D12_MIN_FILTER_SHIFT = 4; + private const int D3D12_MIP_FILTER_SHIFT = 0; + private const int D3D12_SHADER_COMPONENT_MAPPING_ALWAYS_SET_BIT_AVOIDING_ZEROMEM_MISTAKES = 1 << (D3D12_SHADER_COMPONENT_MAPPING_SHIFT * 4); + private const int D3D12_SHADER_COMPONENT_MAPPING_MASK = 0x7; + private const int D3D12_SHADER_COMPONENT_MAPPING_SHIFT = 3; + private const int D3D12_SHADING_RATE_VALID_MASK = 3; + private const int D3D12_SHADING_RATE_X_AXIS_SHIFT = 2; private const string Lib_D3D12 = "d3d12.dll"; + /// + [PInvokeData("d3d12.h")] + public static D3D12_FILTER_REDUCTION_TYPE D3D12_DECODE_FILTER_REDUCTION(D3D12_FILTER D3D12Filter) => + (D3D12_FILTER_REDUCTION_TYPE)(((uint)D3D12Filter >> unchecked(D3D12_FILTER_REDUCTION_TYPE_SHIFT)) & D3D12_FILTER_REDUCTION_TYPE_MASK); + + /// + [PInvokeData("d3d12.h")] + public static bool D3D12_DECODE_IS_ANISOTROPIC_FILTER(D3D12_FILTER D3D12Filter) => ((uint)D3D12Filter & D3D12_ANISOTROPIC_FILTERING_BIT) != 0 + && D3D12_FILTER_TYPE.D3D12_FILTER_TYPE_LINEAR == D3D12_DECODE_MIN_FILTER(D3D12Filter) + && D3D12_FILTER_TYPE.D3D12_FILTER_TYPE_LINEAR == D3D12_DECODE_MAG_FILTER(D3D12Filter) + && D3D12_FILTER_TYPE.D3D12_FILTER_TYPE_LINEAR == D3D12_DECODE_MIP_FILTER(D3D12Filter); + + /// + [PInvokeData("d3d12.h")] + public static bool D3D12_DECODE_IS_COMPARISON_FILTER(D3D12_FILTER D3D12Filter) => + D3D12_DECODE_FILTER_REDUCTION(D3D12Filter) == D3D12_FILTER_REDUCTION_TYPE.D3D12_FILTER_REDUCTION_TYPE_COMPARISON; + + /// + [PInvokeData("d3d12.h")] + public static D3D12_FILTER_TYPE D3D12_DECODE_MAG_FILTER(D3D12_FILTER D3D12Filter) => + (D3D12_FILTER_TYPE)(((uint)D3D12Filter >> unchecked(D3D12_MAG_FILTER_SHIFT)) & D3D12_FILTER_TYPE_MASK); + + /// + [PInvokeData("d3d12.h")] + public static D3D12_FILTER_TYPE D3D12_DECODE_MIN_FILTER(D3D12_FILTER D3D12Filter) => + (D3D12_FILTER_TYPE)(((uint)D3D12Filter >> unchecked(D3D12_MIN_FILTER_SHIFT)) & D3D12_FILTER_TYPE_MASK); + + /// + [PInvokeData("d3d12.h")] + public static D3D12_FILTER_TYPE D3D12_DECODE_MIP_FILTER(D3D12_FILTER D3D12Filter) => + (D3D12_FILTER_TYPE)(((uint)D3D12Filter >> unchecked(D3D12_MIP_FILTER_SHIFT)) & D3D12_FILTER_TYPE_MASK); + + /// + [PInvokeData("d3d12.h")] + public static D3D12_SHADER_COMPONENT_MAPPING D3D12_DECODE_SHADER_4_COMPONENT_MAPPING(int ComponentToExtract, uint Mapping) => + (D3D12_SHADER_COMPONENT_MAPPING)((Mapping >> (unchecked(D3D12_SHADER_COMPONENT_MAPPING_SHIFT) * ComponentToExtract)) & D3D12_SHADER_COMPONENT_MAPPING_MASK); + + /// + [PInvokeData("d3d12.h")] + public static D3D12_FILTER D3D12_ENCODE_ANISOTROPIC_FILTER(D3D12_FILTER_REDUCTION_TYPE reduction) => + (D3D12_FILTER)(D3D12_ANISOTROPIC_FILTERING_BIT | (uint)D3D12_ENCODE_BASIC_FILTER(D3D12_FILTER_TYPE.D3D12_FILTER_TYPE_LINEAR, + D3D12_FILTER_TYPE.D3D12_FILTER_TYPE_LINEAR, D3D12_FILTER_TYPE.D3D12_FILTER_TYPE_LINEAR, reduction)); + + /// + [PInvokeData("d3d12.h")] + public static D3D12_FILTER D3D12_ENCODE_BASIC_FILTER(D3D12_FILTER_TYPE min, D3D12_FILTER_TYPE mag, D3D12_FILTER_TYPE mip, + D3D12_FILTER_REDUCTION_TYPE reduction) => (D3D12_FILTER)((((uint)min & D3D12_FILTER_TYPE_MASK) << unchecked(D3D12_MIN_FILTER_SHIFT)) + | (((uint)mag & D3D12_FILTER_TYPE_MASK) << unchecked(D3D12_MAG_FILTER_SHIFT)) + | (((uint)mip & D3D12_FILTER_TYPE_MASK) << unchecked(D3D12_MIP_FILTER_SHIFT)) + | (((uint)reduction & D3D12_FILTER_REDUCTION_TYPE_MASK) << unchecked(D3D12_FILTER_REDUCTION_TYPE_SHIFT))); + + /// + [PInvokeData("d3d12.h")] + public static D3D12_FILTER D3D12_ENCODE_MIN_MAG_ANISOTROPIC_MIP_POINT_FILTER(D3D12_FILTER_REDUCTION_TYPE reduction) => + (D3D12_FILTER)D3D12_ANISOTROPIC_FILTERING_BIT | D3D12_ENCODE_BASIC_FILTER(D3D12_FILTER_TYPE.D3D12_FILTER_TYPE_LINEAR, + D3D12_FILTER_TYPE.D3D12_FILTER_TYPE_LINEAR, D3D12_FILTER_TYPE.D3D12_FILTER_TYPE_POINT, reduction); + + /// + [PInvokeData("d3d12.h")] + public static uint D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(D3D12_SHADER_COMPONENT_MAPPING Src0, D3D12_SHADER_COMPONENT_MAPPING Src1, + D3D12_SHADER_COMPONENT_MAPPING Src2, D3D12_SHADER_COMPONENT_MAPPING Src3) => ((uint)Src0 & D3D12_SHADER_COMPONENT_MAPPING_MASK) + | (((uint)Src1 & D3D12_SHADER_COMPONENT_MAPPING_MASK) << unchecked(D3D12_SHADER_COMPONENT_MAPPING_SHIFT)) + | (((uint)Src2 & D3D12_SHADER_COMPONENT_MAPPING_MASK) << (unchecked(D3D12_SHADER_COMPONENT_MAPPING_SHIFT) * 2)) + | (((uint)Src3 & D3D12_SHADER_COMPONENT_MAPPING_MASK) << (unchecked(D3D12_SHADER_COMPONENT_MAPPING_SHIFT) * 3)) + | D3D12_SHADER_COMPONENT_MAPPING_ALWAYS_SET_BIT_AVOIDING_ZEROMEM_MISTAKES; + + /// + [PInvokeData("d3d12.h")] + public static uint D3D12_GET_COARSE_SHADING_RATE_X_AXIS(uint x) => (x >> unchecked(D3D12_SHADING_RATE_X_AXIS_SHIFT)) & D3D12_SHADING_RATE_VALID_MASK; + + /// + [PInvokeData("d3d12.h")] + public static uint D3D12_GET_COARSE_SHADING_RATE_Y_AXIS(uint y) => y & D3D12_SHADING_RATE_VALID_MASK; + + /// + [PInvokeData("d3d12.h")] + public static uint D3D12_MAKE_COARSE_SHADING_RATE(uint x, uint y) => (x << unchecked(D3D12_SHADING_RATE_X_AXIS_SHIFT)) | y; + /// Creates a device that represents the display adapter. /// /// Type: IUnknown* @@ -1917,7 +2007,7 @@ public static extern HRESULT D3D12EnableExperimentalFeatures(uint NumFeatures, [ [PInvokeData("d3d12.h", MSDNShortId = "NF:d3d12.D3D12SerializeRootSignature")] [DllImport(Lib_D3D12, SetLastError = false, ExactSpelling = true), Obsolete("This function has been superceded by D3D12SerializeVersionedRootSignature as of the Windows 10 Anniversary Update (14393).")] public static extern HRESULT D3D12SerializeRootSignature(in D3D12_ROOT_SIGNATURE_DESC pRootSignature, - [In] D3D_ROOT_SIGNATURE_VERSION Version, out ID3DBlob ppBlob, out ID3DBlob? ppErrorBlob); + [In] D3D_ROOT_SIGNATURE_VERSION Version, out ID3DBlob ppBlob, [Out, Optional] IUnknownPointer ppErrorBlob); /// Serializes a root signature of any version that can be passed to ID3D12Device::CreateRootSignature. /// @@ -1967,7 +2057,7 @@ public static extern HRESULT D3D12SerializeRootSignature(in D3D12_ROOT_SIGNATURE [PInvokeData("d3d12.h", MSDNShortId = "NF:d3d12.D3D12SerializeVersionedRootSignature")] [DllImport(Lib_D3D12, SetLastError = false, ExactSpelling = true)] public static extern HRESULT D3D12SerializeVersionedRootSignature(in D3D12_VERSIONED_ROOT_SIGNATURE_DESC pRootSignature, - out ID3DBlob ppBlob, out ID3DBlob? ppErrorBlob); + out ID3DBlob ppBlob, [Out, Optional] IUnknownPointer ppErrorBlob); /// /// Helps enable root signature 1.1 features when they are available, and does not require maintaining two code paths for building root @@ -2003,21 +2093,61 @@ public static extern HRESULT D3D12SerializeVersionedRootSignature(in D3D12_VERSI /// This function was released to coincide with the Windows 10 Anniversary Update (14393). In order to support Windows 10 versions prior /// to this, use of this function requires d3d12.lib be set up for delay loading. /// - // https://learn.microsoft.com/en-us/windows/win32/direct3d12/d3dx12serializeversionedrootsignature HRESULT inline - // D3DX12SerializeVersionedRootSignature( _In_ const D3D12_VERSIONED_ROOT_SIGNATURE_DESC *pRootSignatureDesc, D3D_ROOT_SIGNATURE_VERSION - // MaxVersion, _Out_ ID3DBlob **ppBlob, _Out_opt_ ID3DBlob **ppErrorBlob ); [PInvokeData("D3dx12.h")] public static HRESULT D3DX12SerializeVersionedRootSignature(in D3D12_VERSIONED_ROOT_SIGNATURE_DESC pRootSignatureDesc, D3D_ROOT_SIGNATURE_VERSION MaxVersion, out ID3DBlob? ppBlob, out ID3DBlob? ppErrorBlob) { - ppBlob = ppErrorBlob = null; + unsafe + { + IntPtr err = IntPtr.Zero; + HRESULT hr = D3DX12SerializeVersionedRootSignature(pRootSignatureDesc, MaxVersion, out ppBlob, (IntPtr)(void*)&err); + ppErrorBlob = err != IntPtr.Zero ? (ID3DBlob)Marshal.GetObjectForIUnknown(err) : null; + return hr; + } + } + + /// + /// Helps enable root signature 1.1 features when they are available, and does not require maintaining two code paths for building root + /// signatures. This helper method reconstructs a version 1.0 root signature when version 1.1 is not supported. + /// + /// + /// Type: const D3D12_VERSIONED_ROOT_SIGNATURE_DESC* + /// Specifies a D3D12_VERSIONED_ROOT_SIGNATURE_DESC that contains a description of any version of a root signature. + /// + /// + /// Type: D3D_ROOT_SIGNATURE_VERSION + /// Specifies the maximum supported D3D_ROOT_SIGNATURE_VERSION. + /// + /// + /// Type: ID3DBlob** + /// + /// A pointer to a memory block that receives a pointer to the ID3DBlob interface that you can use to access the + /// serialized root signature. + /// + /// + /// + /// Type: HRESULT + /// Returns S_OK if successful; otherwise, returns one of the Direct3D 12 Return Codes. + /// + /// + /// This function was released to coincide with the Windows 10 Anniversary Update (14393). In order to support Windows 10 versions prior + /// to this, use of this function requires d3d12.lib be set up for delay loading. + /// + [PInvokeData("D3dx12.h")] + public static HRESULT D3DX12SerializeVersionedRootSignature(in D3D12_VERSIONED_ROOT_SIGNATURE_DESC pRootSignatureDesc, + D3D_ROOT_SIGNATURE_VERSION MaxVersion, out ID3DBlob? ppBlob) => D3DX12SerializeVersionedRootSignature(pRootSignatureDesc, MaxVersion, out ppBlob, default); + + private static HRESULT D3DX12SerializeVersionedRootSignature(in D3D12_VERSIONED_ROOT_SIGNATURE_DESC pRootSignatureDesc, + D3D_ROOT_SIGNATURE_VERSION MaxVersion, out ID3DBlob? ppBlob, [Out] IntPtr ppErrorBlob) + { + ppBlob = null; switch (MaxVersion) { case D3D_ROOT_SIGNATURE_VERSION.D3D_ROOT_SIGNATURE_VERSION_1_0: switch (pRootSignatureDesc.Version) { case D3D_ROOT_SIGNATURE_VERSION.D3D_ROOT_SIGNATURE_VERSION_1_0: - return D3D12SerializeRootSignature(pRootSignatureDesc.Desc_1_0, D3D_ROOT_SIGNATURE_VERSION.D3D_ROOT_SIGNATURE_VERSION_1, out ppBlob, out ppErrorBlob); + return D3D12SerializeRootSignature(pRootSignatureDesc.Desc_1_0, D3D_ROOT_SIGNATURE_VERSION.D3D_ROOT_SIGNATURE_VERSION_1, out ppBlob, ppErrorBlob); case D3D_ROOT_SIGNATURE_VERSION.D3D_ROOT_SIGNATURE_VERSION_1_1: case D3D_ROOT_SIGNATURE_VERSION.D3D_ROOT_SIGNATURE_VERSION_1_2: @@ -2115,7 +2245,7 @@ public static HRESULT D3DX12SerializeVersionedRootSignature(in D3D12_VERSIONED_R if (hr.Succeeded) { D3D12_ROOT_SIGNATURE_DESC desc_1_0 = new(desc_1_1.NumParameters, pParameters, desc_1_1.NumStaticSamplers, pStaticSamplers == default ? (IntPtr)desc_1_1.pStaticSamplers : ppSamplers, desc_1_1.Flags); - hr = D3D12SerializeRootSignature(desc_1_0, D3D_ROOT_SIGNATURE_VERSION.D3D_ROOT_SIGNATURE_VERSION_1, out ppBlob, out ppErrorBlob); + hr = D3D12SerializeRootSignature(desc_1_0, D3D_ROOT_SIGNATURE_VERSION.D3D_ROOT_SIGNATURE_VERSION_1, out ppBlob, ppErrorBlob); } return hr; @@ -2126,13 +2256,12 @@ public static HRESULT D3DX12SerializeVersionedRootSignature(in D3D12_VERSIONED_R } break; - case D3D_ROOT_SIGNATURE_VERSION.D3D_ROOT_SIGNATURE_VERSION_1_1: switch (pRootSignatureDesc.Version) { case D3D_ROOT_SIGNATURE_VERSION.D3D_ROOT_SIGNATURE_VERSION_1_0: case D3D_ROOT_SIGNATURE_VERSION.D3D_ROOT_SIGNATURE_VERSION_1_1: - return D3D12SerializeVersionedRootSignature(pRootSignatureDesc, out ppBlob, out ppErrorBlob); + return D3D12SerializeVersionedRootSignature(pRootSignatureDesc, out ppBlob, ppErrorBlob); case D3D_ROOT_SIGNATURE_VERSION.D3D_ROOT_SIGNATURE_VERSION_1_2: { @@ -2170,7 +2299,7 @@ public static HRESULT D3DX12SerializeVersionedRootSignature(in D3D12_VERSIONED_R { D3D12_VERSIONED_ROOT_SIGNATURE_DESC desc = new(desc_1_1); if (pStaticSamplers != default) desc.Desc_1_1.pStaticSamplers = ppStaticSamplers; - hr = D3D12SerializeVersionedRootSignature(desc, out ppBlob, out ppErrorBlob); + hr = D3D12SerializeVersionedRootSignature(desc, out ppBlob, ppErrorBlob); } return hr; @@ -2183,7 +2312,7 @@ public static HRESULT D3DX12SerializeVersionedRootSignature(in D3D12_VERSIONED_R case D3D_ROOT_SIGNATURE_VERSION.D3D_ROOT_SIGNATURE_VERSION_1_2: default: - return D3D12SerializeVersionedRootSignature(pRootSignatureDesc, out ppBlob, out ppErrorBlob); + return D3D12SerializeVersionedRootSignature(pRootSignatureDesc, out ppBlob, ppErrorBlob); } return HRESULT.E_INVALIDARG; @@ -2204,20 +2333,4 @@ public class D3D12SDKConfiguration { } /// CLSID_D3D12Tools [ComImport, Guid("e38216b1-3c8c-4833-aa09-0a06b65d96c8"), ClassInterface(ClassInterfaceType.None)] public class D3D12Tools { } - - /* - D3D12_DECODE_FILTER_REDUCTION - D3D12_DECODE_IS_ANISOTROPIC_FILTER - D3D12_DECODE_IS_COMPARISON_FILTER - D3D12_DECODE_MAG_FILTER - D3D12_DECODE_MIN_FILTER - D3D12_DECODE_MIP_FILTER - D3D12_DECODE_SHADER_4_COMPONENT_MAPPING - D3D12_ENCODE_ANISOTROPIC_FILTER - D3D12_ENCODE_BASIC_FILTER - D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING - D3D12_GET_COARSE_SHADING_RATE_X_AXIS - D3D12_GET_COARSE_SHADING_RATE_Y_AXIS - D3D12_MAKE_COARSE_SHADING_RATE - */ } \ No newline at end of file