From bd64c50ce29ab7fd7f8798b3d8d09b9f679714ea Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Fri, 29 Apr 2022 02:10:11 +0200 Subject: [PATCH] Fix ID2D1Effect.LoadConstantBuffer crash with empty buffers --- .../Shaders/Dispatching/D2D1EffectDispatchDataLoader.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ComputeSharp.D2D1/Shaders/Dispatching/D2D1EffectDispatchDataLoader.cs b/src/ComputeSharp.D2D1/Shaders/Dispatching/D2D1EffectDispatchDataLoader.cs index e5697042..69b06622 100644 --- a/src/ComputeSharp.D2D1/Shaders/Dispatching/D2D1EffectDispatchDataLoader.cs +++ b/src/ComputeSharp.D2D1/Shaders/Dispatching/D2D1EffectDispatchDataLoader.cs @@ -32,6 +32,11 @@ internal readonly unsafe struct D2D1EffectDispatchDataLoader : ID2D1DispatchData /// public void LoadConstantBuffer(ReadOnlySpan data) { + if (data.IsEmpty) + { + return; + } + this.d2D1Effect->SetValue( index: 0, type: D2D1_PROPERTY_TYPE.D2D1_PROPERTY_TYPE_BLOB,