From a70ae6af3856b85684e5fb2eec3eaf91409e35f5 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sun, 8 May 2022 19:45:47 +0200 Subject: [PATCH] Enable pixel options info in D2D1PixelShaderEffect --- .../Shaders/Interop/Effects/PixelShaderEffect.For{T}.cs | 8 ++++++++ .../PixelShaderEffect.ID2D1DrawTransformMethods.cs | 2 +- .../Shaders/Interop/Effects/PixelShaderEffect.cs | 8 ++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.For{T}.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.For{T}.cs index 57addcbc..575eb61d 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.For{T}.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.For{T}.cs @@ -64,6 +64,11 @@ internal unsafe partial struct PixelShaderEffect /// private static D2D1InputDescription* inputDescriptions; + /// + /// The pixel options for the shader. + /// + private static D2D1PixelOption pixelOptions; + /// /// The shader bytecode. /// @@ -119,6 +124,7 @@ internal unsafe partial struct PixelShaderEffect byte* bytecode = (byte*)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(For), bytecodeSize); D2D1BufferPrecision bufferPrecision = D2D1PixelShader.GetOutputBufferPrecision(); D2D1ChannelDepth channelDepth = D2D1PixelShader.GetOutputBufferChannelDepth(); + D2D1PixelOption pixelOptions = D2D1PixelShader.GetPixelOptions(); // Prepare the inputs info int inputCount = D2D1PixelShader.GetInputCount(); @@ -145,6 +151,7 @@ internal unsafe partial struct PixelShaderEffect For.inputTypes = inputTypes; For.inputDescriptionCount = inputDescriptionCount; For.inputDescriptions = inputDescriptions; + For.pixelOptions = pixelOptions; For.bytecode = bytecode; For.bytecodeSize = bytecodeSize; For.bufferPrecision = bufferPrecision; @@ -228,6 +235,7 @@ internal unsafe partial struct PixelShaderEffect inputTypes, inputDescriptionCount, inputDescriptions, + pixelOptions, bytecode, bytecodeSize, bufferPrecision, diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1DrawTransformMethods.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1DrawTransformMethods.cs index 89b281e5..f5d73715 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1DrawTransformMethods.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1DrawTransformMethods.cs @@ -324,7 +324,7 @@ partial struct PixelShaderEffect @this->d2D1DrawInfo = drawInfo; // Set the pixel shader for the effect - HRESULT hresult = drawInfo->SetPixelShader(&@this->shaderId); + HRESULT hresult = drawInfo->SetPixelShader(&@this->shaderId, (D2D1_PIXEL_OPTIONS)@this->pixelOptions); if (hresult != S.S_OK) { diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.cs index e330ab71..ae1a8732 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.cs @@ -175,6 +175,11 @@ internal unsafe partial struct PixelShaderEffect /// private D2D1InputDescription* inputDescriptions; + /// + /// The pixel options for the shader. + /// + private D2D1PixelOption pixelOptions; + /// /// The shader bytecode. /// @@ -213,6 +218,7 @@ internal unsafe partial struct PixelShaderEffect /// The buffer with the types of inputs for the shader. /// The number of available input descriptions. /// The buffer with the available input descriptions for the shader. + /// The pixel options for the shader. /// The shader bytecode. /// The size of . /// The buffer precision for the resulting output buffer. @@ -226,6 +232,7 @@ internal unsafe partial struct PixelShaderEffect D2D1PixelShaderInputType* inputTypes, int inputDescriptionCount, D2D1InputDescription* inputDescriptions, + D2D1PixelOption pixelOptions, byte* bytecode, int bytecodeSize, D2D1BufferPrecision bufferPrecision, @@ -245,6 +252,7 @@ internal unsafe partial struct PixelShaderEffect @this->inputTypes = inputTypes; @this->inputDescriptionCount = inputDescriptionCount; @this->inputDescriptions = inputDescriptions; + @this->pixelOptions = pixelOptions; @this->bytecode = bytecode; @this->bytecodeSize = bytecodeSize; @this->bufferPrecision = bufferPrecision;