From 39731944bd5751e924483b742bbef8dad0f7cae0 Mon Sep 17 00:00:00 2001 From: David Hall Date: Mon, 3 Feb 2025 16:56:15 -0700 Subject: [PATCH] Bug fixes in D3D12_BLEND_DESC.ctor() and D3D12_DEPTH_STENCIL_DESC alignment --- PInvoke/Direct3D12/D3D12.Struct.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PInvoke/Direct3D12/D3D12.Struct.cs b/PInvoke/Direct3D12/D3D12.Struct.cs index 8a4d964ad..ef795201f 100644 --- a/PInvoke/Direct3D12/D3D12.Struct.cs +++ b/PInvoke/Direct3D12/D3D12.Struct.cs @@ -402,7 +402,9 @@ public D3D12_BLEND_DESC() LogicOp = D3D12_LOGIC_OP.D3D12_LOGIC_OP_NOOP, RenderTargetWriteMask = D3D12_COLOR_WRITE_ENABLE.D3D12_COLOR_WRITE_ENABLE_ALL }; - SetRenderTarget(def); + _RenderTarget = new D3D12_RENDER_TARGET_BLEND_DESC[8]; + for (var i = 0; i < 8; i++) + _RenderTarget[i] = def; } } @@ -1121,7 +1123,7 @@ public D3D12_CPU_DESCRIPTOR_HANDLE Offset(int offsetScaledByIncrementSize) // BOOL DepthEnable; D3D12_DEPTH_WRITE_MASK DepthWriteMask; D3D12_COMPARISON_FUNC DepthFunc; BOOL StencilEnable; UINT8 StencilReadMask; // UINT8 StencilWriteMask; D3D12_DEPTH_STENCILOP_DESC FrontFace; D3D12_DEPTH_STENCILOP_DESC BackFace; } D3D12_DEPTH_STENCIL_DESC; [PInvokeData("d3d12.h", MSDNShortId = "NS:d3d12.D3D12_DEPTH_STENCIL_DESC")] - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 4)] public struct D3D12_DEPTH_STENCIL_DESC { /// Specifies whether to enable depth testing. Set this member to TRUE to enable depth testing.