From 7b02a1156e9952740469f15b74b1a94862f64bc1 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Tue, 24 May 2022 01:28:32 +0200 Subject: [PATCH] Skip recompilation in D2D1ReflectionServices APIs --- .../Shaders/Interop/D2D1ReflectionServices.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ReflectionServices.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ReflectionServices.cs index ed93b63e..16aa8a6a 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ReflectionServices.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ReflectionServices.cs @@ -20,6 +20,14 @@ public static class D2D1ReflectionServices /// /// The type of D2D1 shader to retrieve info for. /// The resulting instance. + /// + /// If the target shader type is precompiled (ie. it's annotated with ), that bytecode will + /// be reused to reflect on the shader, so the same shader profile and compile options will be reused, which can make the returned metadata more accurate. + /// + /// If the shader is not precompiled, it will be compiled on the fly using the default settings for both the shader profile and the compile options. That is, + /// and (with linking optionally enabled if supported by the shader type). + /// + /// public static unsafe D2D1ShaderInfo GetShaderInfo() where T : struct, ID2D1PixelShader { @@ -29,7 +37,7 @@ public static class D2D1ReflectionServices D2D1ShaderBytecodeLoader bytecodeLoader = default; - shader.LoadBytecode(ref bytecodeLoader, D2D1ShaderProfile.PixelShader50, D2D1CompileOptions.Default); + shader.LoadBytecode(ref bytecodeLoader, null, null); using ComPtr dynamicBytecode = bytecodeLoader.GetResultingShaderBytecode(out ReadOnlySpan precompiledBytecode);