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 26d86426..5098a14e 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.For{T}.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.For{T}.cs @@ -128,7 +128,7 @@ internal unsafe partial struct PixelShaderEffect // Prepare the inputs info int inputCount = D2D1PixelShader.GetInputCount(); - D2D1PixelShaderInputType* inputTypes = (D2D1PixelShaderInputType*)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(For), inputCount); + D2D1PixelShaderInputType* inputTypes = (D2D1PixelShaderInputType*)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(For), sizeof(D2D1PixelShaderInputType) * inputCount); for (int i = 0; i < inputCount; i++) { @@ -138,7 +138,7 @@ internal unsafe partial struct PixelShaderEffect // Prepare the input descriptions ReadOnlyMemory inputDescriptionsInfo = D2D1PixelShader.GetInputDescriptions(); int inputDescriptionCount = inputDescriptionsInfo.Length; - D2D1InputDescription* inputDescriptions = (D2D1InputDescription*)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(For), inputDescriptionCount); + D2D1InputDescription* inputDescriptions = (D2D1InputDescription*)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(For), sizeof(D2D1InputDescription) * inputDescriptionCount); inputDescriptionsInfo.Span.CopyTo(new Span(inputDescriptions, inputDescriptionCount));