From b54fcdb5194a5c8bbe4bbc836768df8dc4e6f87e Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Tue, 20 Aug 2019 01:20:03 +0200 Subject: [PATCH] Fixed a bug in the constant shader APIs --- src/ComputeSharp.Graphics/Buffers/ConstantBuffer{T}.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ComputeSharp.Graphics/Buffers/ConstantBuffer{T}.cs b/src/ComputeSharp.Graphics/Buffers/ConstantBuffer{T}.cs index 9a7d76fc..152c3681 100644 --- a/src/ComputeSharp.Graphics/Buffers/ConstantBuffer{T}.cs +++ b/src/ComputeSharp.Graphics/Buffers/ConstantBuffer{T}.cs @@ -58,7 +58,7 @@ namespace ComputeSharp.Graphics.Buffers ref T tout = ref span.GetPinnableReference(); // Copy the padded data to the target span, removing the padding - for (int i = 0; i < Size; i++) + for (int i = 0; i < count; i++) { ref byte rsource = ref Unsafe.Add(ref tin, i * PaddedElementSizeInBytes); Unsafe.Add(ref tout, i) = Unsafe.As(ref rsource); @@ -87,7 +87,7 @@ namespace ComputeSharp.Graphics.Buffers ref byte tout = ref temporarySpan.GetPinnableReference(); // Copy the input data to the temporary array and add the padding - for (int i = 0; i < Size; i++) + for (int i = 0; i < count; i++) { ref byte rtarget = ref Unsafe.Add(ref tout, i * PaddedElementSizeInBytes); Unsafe.As(ref rtarget) = Unsafe.Add(ref tin, i);