From e22d076dd3afbb33177e0842ea2020dcbc408cbe Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 23 May 2022 00:16:08 +0200 Subject: [PATCH] Add D2D1PixelShader.LoadBytecode(D2D1CompileOptions options) --- .../Shaders/Interop/D2D1PixelShader.cs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs index f4c58bb9..644f16c7 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs @@ -59,6 +59,31 @@ public static class D2D1PixelShader return LoadOrCompileBytecode(shaderProfile, null); } + /// + /// Loads the bytecode from an input D2D1 pixel shader. + /// + /// The type of D2D1 pixel shader to load the bytecode for. + /// The compile options to use to get the shader bytecode. + /// A instance with the resulting shader bytecode. + /// + /// + /// If precompiled shader with the requested options does not exist, the shader will be compiled with the input options. If additional compile + /// options have been specified on the shader type (through ), they will be ignored. + /// + /// + /// If the shader needs to be recompiled, the shader profile that will be used is . + /// + /// + /// If the input shader was precompiled, the returned instance will wrap a pinned memory buffer (from the PE section). + /// If the shader was compiled at runtime, the returned instance will wrap a array with the bytecode. + /// + /// + public static ReadOnlyMemory LoadBytecode(D2D1CompileOptions options) + where T : unmanaged, ID2D1PixelShader + { + return LoadOrCompileBytecode(null, options); + } + /// /// Loads the bytecode from an input D2D1 pixel shader. ///