diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShaderEffect.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShaderEffect.cs
index 76d4cf26..3e0be2a2 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShaderEffect.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShaderEffect.cs
@@ -1,13 +1,16 @@
using System;
using System.Globalization;
using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
using System.Text;
using ComputeSharp.D2D1.Extensions;
using ComputeSharp.D2D1.Helpers;
using ComputeSharp.D2D1.Interop.Effects;
using ComputeSharp.D2D1.Shaders.Interop.Buffers;
+using ComputeSharp.D2D1.Shaders.Interop.Effects.ResourceManagers;
using ComputeSharp.D2D1.Shaders.Loaders;
using TerraFX.Interop.DirectX;
+using TerraFX.Interop.Windows;
#pragma warning disable CS0618
@@ -532,4 +535,28 @@ public static unsafe class D2D1PixelShaderEffect
data: (byte*)&resourceTextureManager,
dataSize: (uint)sizeof(void*));
}
+
+ ///
+ /// Sets the resource texture manager from an input D2D1 effect, by calling ID2D1Effect::SetValue.
+ ///
+ /// A pointer to the ID2D1Effect instance to use.
+ /// The input instance..
+ /// The index of the resource texture to assign the resource texture manager to.
+ /// For more info, see .
+ public static void SetResourceTextureManagerForD2D1Effect(void* d2D1Effect, D2D1ResourceTextureManager resourceTextureManager, int index)
+ {
+ // TODO: validate args
+
+ using ComPtr resourceTextureManager2 = default;
+
+ Guid uuidOfResourceTextureManager = ID2D1ResourceTextureManager.Guid;
+
+ _ = ((ICustomQueryInterface)resourceTextureManager).GetInterface(ref uuidOfResourceTextureManager, out *(IntPtr*)resourceTextureManager2.GetAddressOf());
+
+ ((ID2D1Effect*)d2D1Effect)->SetValue(
+ index: D2D1PixelShaderEffectProperty.ResourceTextureManager0 + (uint)index,
+ type: D2D1_PROPERTY_TYPE.D2D1_PROPERTY_TYPE_IUNKNOWN,
+ data: (byte*)resourceTextureManager2.GetAddressOf(),
+ dataSize: (uint)sizeof(void*));
+ }
}