Wire up [D2D1CompileOptions] to all generated code and public APIs

Also removes the diagnostics for invalid linking setup
このコミットが含まれているのは:
Sergio Pedri committed 2022-05-22 15:50:28 +02:00
1 親 b4b8b76d2f
コミット d75993107a
10ファイル変更
+133 -68

検索条件に一致するファイルはありません

-1
ファイルの表示
@@ -51,4 +51,3 @@ CMPSD2D0041 | ComputeSharp.D2D1.Shaders | Error | [Documentation](https://github
CMPSD2D0042 | ComputeSharp.D2D1.Shaders | Error | [Documentation](https://github.com/Sergio0694/ComputeSharp)
CMPSD2D0043 | ComputeSharp.D2D1.Shaders | Error | [Documentation](https://github.com/Sergio0694/ComputeSharp)
CMPSD2D0044 | ComputeSharp.D2D1.Shaders | Error | [Documentation](https://github.com/Sergio0694/ComputeSharp)
CMPSD2D0045 | ComputeSharp.D2D1.Shaders | Error | [Documentation](https://github.com/Sergio0694/ComputeSharp)
-16
ファイルの表示
@@ -634,20 +634,4 @@ internal static class DiagnosticDescriptors
isEnabledByDefault: true,
description: "A D2D1 shader generated with ComputeSharp.D2D1 cannot use the PackMatrixColumnMajor option, as that is not compatible with the generated code used to load shader constant buffers.",
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
/// <summary>
/// Gets a <see cref="DiagnosticDescriptor"/> for the EnableLinking option being used.
/// <para>
/// Format: <c>"The D2D1 shader of type {0} is using the EnableLinking option in its [D2DCompileOptions] attribute for a non-linkable shader"</c>.
/// </para>
/// </summary>
public static readonly DiagnosticDescriptor InvalidEnableLinkingOption = new DiagnosticDescriptor(
id: "CMPSD2D0045",
title: "Invalid EnableLinking compile option",
messageFormat: "The D2D1 shader of type {0} is using the EnableLinking option in its [D2DCompileOptions] attribute for a non-linkable shader",
category: "ComputeSharp.D2D1.Shaders",
defaultSeverity: DiagnosticSeverity.Error,
isEnabledByDefault: true,
description: "A D2D1 shader generated with ComputeSharp.D2D1 cannot use the EnableLinking option if the shader is non-linkable (ie. if it has any complex inputs).",
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
}
@@ -1,5 +1,6 @@
using System;
using System.Globalization;
using System.Linq;
using ComputeSharp.__Internals;
using ComputeSharp.D2D1.__Internals;
using ComputeSharp.D2D1.SourceGenerators.Models;
@@ -39,7 +40,7 @@ partial class ID2D1ShaderGenerator
// This code produces a method declaration as follows:
//
// readonly void global::ComputeSharp.D2D1.__Internals.ID2D1Shader.LoadBytecode<TLoader>(ref TLoader loader, global::ComputeSharp.D2D1.D2D1ShaderProfile? shaderProfile)
// readonly void global::ComputeSharp.D2D1.__Internals.ID2D1Shader.LoadBytecode<TLoader>(ref TLoader loader, global::ComputeSharp.D2D1.D2D1ShaderProfile? shaderProfile, global::ComputeSharp.D2D1.D2D1CompileOptions? options)
// {
// <BODY>
// }
@@ -50,7 +51,8 @@ partial class ID2D1ShaderGenerator
.AddTypeParameterListParameters(TypeParameter(Identifier("TLoader")))
.AddParameterListParameters(
Parameter(Identifier("loader")).AddModifiers(Token(SyntaxKind.RefKeyword)).WithType(IdentifierName("TLoader")),
Parameter(Identifier("shaderProfile")).WithType(NullableType(IdentifierName("global::ComputeSharp.D2D1.D2D1ShaderProfile"))))
Parameter(Identifier("shaderProfile")).WithType(NullableType(IdentifierName("global::ComputeSharp.D2D1.D2D1ShaderProfile"))),
Parameter(Identifier("options")).WithType(NullableType(IdentifierName("global::ComputeSharp.D2D1.D2D1CompileOptions"))))
.WithBody(block);
}
@@ -62,9 +64,38 @@ partial class ID2D1ShaderGenerator
/// <returns>The <see cref="BlockSyntax"/> instance trying to retrieve the precompiled shader.</returns>
private static unsafe BlockSyntax GetShaderBytecodeBody(EmbeddedBytecodeInfo bytecodeInfo, out string? bytecodeLiterals)
{
// This method needs to handle several different scenarions, which are as follows:
// 1) If [EmbeddedBytecode] is used, then the shader is precompiled and stored as a ReadOnlySpan<byte>. In this case,
// this bytecode would have been generated with some specific D2D1ShaderProfile and D2D1CompileOptions values. So,
// a branch is generated to try to retrieve this precompiled bytecode, which can be returned if and only if the
// requested shader profile and compile options are either null, or either matches the values that have been used
// to generate that bytecode. If this is the case, then no further work is done and that binary data is returned.
// 2) If either the requested shader profile or options do not match the values used to create the shader bytecode,
// then a call to the internal D2D1ShaderCompiler.LoadDynamicBytecode API is used, to create the shader on the fly.
// 3) If [EmbeddedBytecode] is not used, then regardless of the requested profile and options, a new shader is compiled.
// 4) If this is the case and either the shader profile or the options are null, then this method will manually set the
// value being null to the default one to use. That is, D2D1ShaderProfile.PixelShader50 will be used as the target,
// and the options will be set to D2D1CompileOptions.Default (and optionally, D2D1CompileOptions.EnableLinking too).
// Get a formatted representation of the compile options being used
ExpressionSyntax optionsExpression =
ParseExpression(
bytecodeInfo.CompileOptions
.GetValueOrDefault()
.ToString(CultureInfo.InvariantCulture)
.Split(',')
.Select(static name => $"global::ComputeSharp.D2D1.D2D1CompileOptions.{name.Trim()}")
.Aggregate("", static (left, right) => left.Length > 0 ? $"{left} | {right}" : right));
// Add parantheses if needed
if (optionsExpression is BinaryExpressionSyntax)
{
optionsExpression = ParenthesizedExpression(optionsExpression);
}
// This code produces a method declaration as follows:
//
// ComputeSharp.D2D1.__Internals.D2D1ShaderCompiler.LoadDynamicBytecode(ref loader, in this, shaderProfile, <ENABLE_LINKING_SUPPORT>);
// ComputeSharp.D2D1.__Internals.D2D1ShaderCompiler.LoadDynamicBytecode(ref loader, in this, shaderProfile ?? <DEFAULT_PROFILE>, options ?? <REQUESTED_OPTIONS>);
ExpressionStatementSyntax dynamicLoadingStatement =
ExpressionStatement(
InvocationExpression(
@@ -75,8 +106,14 @@ partial class ID2D1ShaderGenerator
.AddArgumentListArguments(
Argument(IdentifierName("loader")).WithRefKindKeyword(Token(SyntaxKind.RefKeyword)),
Argument(ThisExpression()).WithRefKindKeyword(Token(SyntaxKind.InKeyword)),
Argument(IdentifierName("shaderProfile")),
Argument(LiteralExpression(bytecodeInfo.IsLinkingSupported ? SyntaxKind.TrueLiteralExpression : SyntaxKind.FalseLiteralExpression))));
Argument(BinaryExpression(
SyntaxKind.CoalesceExpression,
IdentifierName("shaderProfile"),
IdentifierName($"global::ComputeSharp.D2D1.D2D1ShaderProfile.{D2D1ShaderProfile.PixelShader50}"))),
Argument(BinaryExpression(
SyntaxKind.CoalesceExpression,
IdentifierName("options"),
optionsExpression))));
// If there is no precompiled bytecode, just return the dynamic path
if (bytecodeInfo.Bytecode.IsDefaultOrEmpty)
@@ -90,7 +127,7 @@ partial class ID2D1ShaderGenerator
// This code produces a branch as follows:
//
// if (shaderProfile is null or <SHADER_PROFILE>)
// if (shaderProfile is null or <SHADER_PROFILE> && options is null or <OPTIONS>)
// {
// global::System.ReadOnlySpan<byte> bytecode = new byte[] { __EMBEDDED_SHADER_BYTECODE };
// loader.LoadEmbeddedBytecode(bytecode);
@@ -101,16 +138,24 @@ partial class ID2D1ShaderGenerator
// having to create/parse tens of thousands of literal expression nodes for every shader.
IfStatementSyntax embeddedBranch =
IfStatement(
IsPatternExpression(
IdentifierName("shaderProfile"),
BinaryPattern(
SyntaxKind.OrPattern,
ConstantPattern(LiteralExpression(SyntaxKind.NullLiteralExpression)),
ConstantPattern(
MemberAccessExpression(
SyntaxKind.SimpleMemberAccessExpression,
IdentifierName("global::ComputeSharp.D2D1.D2D1ShaderProfile"),
IdentifierName(bytecodeInfo.ShaderProfile.GetValueOrDefault().ToString(CultureInfo.InvariantCulture)))))),
BinaryExpression(
SyntaxKind.LogicalAndExpression,
IsPatternExpression(
IdentifierName("shaderProfile"),
BinaryPattern(
SyntaxKind.OrPattern,
ConstantPattern(LiteralExpression(SyntaxKind.NullLiteralExpression)),
ConstantPattern(
MemberAccessExpression(
SyntaxKind.SimpleMemberAccessExpression,
IdentifierName("global::ComputeSharp.D2D1.D2D1ShaderProfile"),
IdentifierName(bytecodeInfo.ShaderProfile.GetValueOrDefault().ToString(CultureInfo.InvariantCulture)))))),
IsPatternExpression(
IdentifierName("options"),
BinaryPattern(
SyntaxKind.OrPattern,
ConstantPattern(LiteralExpression(SyntaxKind.NullLiteralExpression)),
ConstantPattern(optionsExpression)))),
Block(
LocalDeclarationStatement(
VariableDeclaration(
+16 -16
ファイルの表示
@@ -46,12 +46,8 @@ partial class ID2D1ShaderGenerator
/// </summary>
/// <param name="diagnostics">The collection of produced <see cref="Diagnostic"/> instances.</param>
/// <param name="structDeclarationSymbol">The input <see cref="INamedTypeSymbol"/> instance to process.</param>
/// <param name="isLinkingSupported">Whether or not linking is supported for the current shader.</param>
/// <returns>The compile options to use to compile the shader, if present.</returns>
public static D2D1CompileOptions? GetCompileOptions(
ImmutableArray<Diagnostic>.Builder diagnostics,
INamedTypeSymbol structDeclarationSymbol,
bool isLinkingSupported)
public static D2D1CompileOptions? GetCompileOptions(ImmutableArray<Diagnostic>.Builder diagnostics, INamedTypeSymbol structDeclarationSymbol)
{
if (structDeclarationSymbol.TryGetAttributeWithFullMetadataName("ComputeSharp.D2D1.D2DCompileOptionsAttribute", out AttributeData? attributeData))
{
@@ -65,14 +61,6 @@ partial class ID2D1ShaderGenerator
structDeclarationSymbol);
}
if ((options & D2D1CompileOptions.EnableLinking) != 0 && !isLinkingSupported)
{
diagnostics.Add(
InvalidEnableLinkingOption,
structDeclarationSymbol,
structDeclarationSymbol);
}
// PackMatrixRowMajor is always automatically enabled
return options | D2D1CompileOptions.PackMatrixRowMajor;
}
@@ -109,9 +97,14 @@ partial class ID2D1ShaderGenerator
/// </summary>
/// <param name="sourceInfo">The source info for the shader to compile.</param>
/// <param name="token">The <see cref="CancellationToken"/> used to cancel the operation, if needed.</param>
/// <param name="options">The effective compile options used to create the shader bytecode.</param>
/// <param name="diagnostic">The resulting diagnostic from the processing operation, if any.</param>
/// <returns>The <see cref="ImmutableArray{T}"/> instance with the compiled shader bytecode.</returns>
public static unsafe ImmutableArray<byte> GetBytecode(HlslShaderSourceInfo sourceInfo, CancellationToken token, out DiagnosticInfo? diagnostic)
public static unsafe ImmutableArray<byte> GetBytecode(
HlslShaderSourceInfo sourceInfo,
CancellationToken token,
out D2D1CompileOptions options,
out DiagnosticInfo? diagnostic)
{
ImmutableArray<byte> bytecode = ImmutableArray<byte>.Empty;
@@ -120,6 +113,7 @@ partial class ID2D1ShaderGenerator
// Compiling would just add overhead and result in more errors, as the HLSL would be invalid.
if (sourceInfo is { HasErrors: true } or { ShaderProfile: null })
{
options = default;
diagnostic = null;
goto End;
@@ -129,11 +123,15 @@ partial class ID2D1ShaderGenerator
{
token.ThrowIfCancellationRequested();
// Compile the shader bytecode
// If an explicit set of compile options is provided, use that directly. Otherwise, use the default
// options plus the option to enable linking only if the shader can potentially support it.
options = sourceInfo.CompileOptions ?? (D2D1CompileOptions.Default | (sourceInfo.IsLinkingSupported ? D2D1CompileOptions.EnableLinking : 0));
// Compile the shader bytecode using the requested parameters
using ComPtr<ID3DBlob> dxcBlobBytecode = D3DCompiler.Compile(
sourceInfo.HlslSource.AsSpan(),
sourceInfo.ShaderProfile.Value,
sourceInfo.CompileOptions ?? D2D1CompileOptions.Default);
options);
token.ThrowIfCancellationRequested();
@@ -147,10 +145,12 @@ partial class ID2D1ShaderGenerator
}
catch (Win32Exception e)
{
options = default;
diagnostic = new DiagnosticInfo(EmbeddedBytecodeFailedWithWin32Exception, e.HResult, FixupExceptionMessage(e.Message));
}
catch (FxcCompilationException e)
{
options = default;
diagnostic = new DiagnosticInfo(EmbeddedBytecodeFailedWithDxcCompilationException, FixupExceptionMessage(e.Message));
}
+13 -5
ファイルの表示
@@ -92,16 +92,16 @@ public sealed partial class ID2D1ShaderGenerator : IIncrementalGenerator
token.ThrowIfCancellationRequested();
// Get the shader profile and linking info for LoadBytecode()
bool isLinkingSupported = LoadBytecode.IsSimpleInputShader(item.Left.Symbol, inputCount);
D2D1ShaderProfile? shaderProfile = LoadBytecode.GetShaderProfile(item.Left.Symbol);
D2D1CompileOptions? compileOptions = LoadBytecode.GetCompileOptions(diagnostics, item.Left.Symbol, isLinkingSupported);
D2D1CompileOptions? compileOptions = LoadBytecode.GetCompileOptions(diagnostics, item.Left.Symbol);
bool isLinkingSupported = LoadBytecode.IsSimpleInputShader(item.Left.Symbol, inputCount);
HlslShaderSourceInfo sourceInfo = new(
hlslSource,
shaderProfile,
compileOptions,
isLinkingSupported,
diagnostics.Count > 0);
HasErrors: diagnostics.Count > 0);
token.ThrowIfCancellationRequested();
@@ -202,11 +202,19 @@ public sealed partial class ID2D1ShaderGenerator : IIncrementalGenerator
shaderBytecodeInfo
.Select(static (item, token) =>
{
ImmutableArray<byte> bytecode = LoadBytecode.GetBytecode(item.Source, token, out DiagnosticInfo? diagnostic);
ImmutableArray<byte> bytecode = LoadBytecode.GetBytecode(
item.Source,
token,
out D2D1CompileOptions options,
out DiagnosticInfo? diagnostic);
token.ThrowIfCancellationRequested();
EmbeddedBytecodeInfo bytecodeInfo = new(item.Source.HlslSource, item.Source.ShaderProfile, item.Source.IsLinkingSupported, bytecode);
EmbeddedBytecodeInfo bytecodeInfo = new(
item.Source.HlslSource,
item.Source.ShaderProfile,
options,
bytecode);
return (item.Hierarchy, bytecodeInfo, diagnostic);
});
+4 -4
ファイルの表示
@@ -11,9 +11,9 @@ namespace ComputeSharp.D2D1.SourceGenerators.Models;
/// </summary>
/// <param name="HlslSource">The HLSL source for the shader.</param>
/// <param name="ShaderProfile">The shader profile to use to compile the shader, if requested.</param>
/// <param name="IsLinkingSupported">Whether linking is supported for the current shader.</param>
/// <param name="CompileOptions">The compile options to use to compile the shader.</param>
/// <param name="Bytecode">The compiled shader bytecode, if available.</param>
internal sealed record EmbeddedBytecodeInfo(string HlslSource, D2D1ShaderProfile? ShaderProfile, bool IsLinkingSupported, ImmutableArray<byte> Bytecode)
internal sealed record EmbeddedBytecodeInfo(string HlslSource, D2D1ShaderProfile? ShaderProfile, D2D1CompileOptions? CompileOptions, ImmutableArray<byte> Bytecode)
{
/// <summary>
/// An <see cref="IEqualityComparer{T}"/> implementation for <see cref="EmbeddedBytecodeInfo"/>.
@@ -25,7 +25,7 @@ internal sealed record EmbeddedBytecodeInfo(string HlslSource, D2D1ShaderProfile
{
hashCode.Add(obj.HlslSource);
hashCode.Add(obj.ShaderProfile);
hashCode.Add(obj.IsLinkingSupported);
hashCode.Add(obj.CompileOptions);
hashCode.AddBytes(obj.Bytecode.AsSpan());
}
@@ -35,7 +35,7 @@ internal sealed record EmbeddedBytecodeInfo(string HlslSource, D2D1ShaderProfile
return
x.HlslSource == y.HlslSource &&
x.ShaderProfile == y.ShaderProfile &&
x.IsLinkingSupported == y.IsLinkingSupported &&
x.CompileOptions == y.CompileOptions &&
x.Bytecode.SequenceEqual(y.Bytecode);
}
}
+2 -1
ファイルの表示
@@ -88,9 +88,10 @@ public interface ID2D1Shader
/// <typeparam name="TLoader">The type of bytecode loader being used.</typeparam>
/// <param name="loader">The <typeparamref name="TLoader"/> instance to use to load the bytecode.</param>
/// <param name="shaderProfile">The shader profile to use to get the shader bytecode (if <see langword="null"/>, the precompiled shader will be used).</param>
/// <param name="options">The compile options to use to get the shader bytecode (if <see langword="null"/>, the precompiled shader will be used).</param>
/// <exception cref="InvalidOperationException">Thrown if a precompiled bytecode was requested (<paramref name="shaderProfile"/> is <see langword="null"/>), but it wasn't availablle.</exception>
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This method is not intended to be used directly by user code")]
void LoadBytecode<TLoader>(ref TLoader loader, D2D1ShaderProfile? shaderProfile)
void LoadBytecode<TLoader>(ref TLoader loader, D2D1ShaderProfile? shaderProfile, D2D1CompileOptions? options)
where TLoader : struct, ID2D1BytecodeLoader;
}
+32 -4
ファイルの表示
@@ -30,7 +30,7 @@ public static class D2D1PixelShader
public static ReadOnlyMemory<byte> LoadBytecode<T>()
where T : unmanaged, ID2D1PixelShader
{
return LoadOrCompileBytecode<T>(null);
return LoadOrCompileBytecode<T>(null, null);
}
/// <summary>
@@ -40,13 +40,40 @@ public static class D2D1PixelShader
/// <param name="shaderProfile">The shader profile to use to get the shader bytecode.</param>
/// <returns>A <see cref="ReadOnlyMemory{T}"/> instance with the resulting shader bytecode.</returns>
/// <remarks>
/// <para>
/// If precompiled shader for the profile does not exist, the shader will be compiled with either the custom compile options specified on the shader
/// type <typeparamref name="T"/> (through <see cref="D2DCompileOptionsAttribute"/>), or using <see cref="D2D1CompileOptions.Default"/> otherwise.
/// </para>
/// <para>
/// Additionally, in case no custom compile options are specified and the the shader type <typeparamref name="T"/>
/// supports linking, <see cref="D2D1CompileOptions.EnableLinking"/> will also be automatically added.
/// </para>
/// <para>
/// If the input shader was precompiled, the returned <see cref="ReadOnlyMemory{T}"/> instance will wrap a pinned memory buffer (from the PE section).
/// If the shader was compiled at runtime, the returned <see cref="ReadOnlyMemory{T}"/> instance will wrap a <see cref="byte"/> array with the bytecode.
/// </para>
/// </remarks>
public static ReadOnlyMemory<byte> LoadBytecode<T>(D2D1ShaderProfile shaderProfile)
where T : unmanaged, ID2D1PixelShader
{
return LoadOrCompileBytecode<T>(shaderProfile);
return LoadOrCompileBytecode<T>(shaderProfile, null);
}
/// <summary>
/// Loads the bytecode from an input D2D1 pixel shader.
/// </summary>
/// <typeparam name="T">The type of D2D1 pixel shader to load the bytecode for.</typeparam>
/// <param name="shaderProfile">The shader profile to use to get the shader bytecode.</param>
/// <param name="options">The compile options to use to get the shader bytecode.</param>
/// <returns>A <see cref="ReadOnlyMemory{T}"/> instance with the resulting shader bytecode.</returns>
/// <remarks>
/// If the input shader was precompiled, the returned <see cref="ReadOnlyMemory{T}"/> instance will wrap a pinned memory buffer (from the PE section).
/// If the shader was compiled at runtime, the returned <see cref="ReadOnlyMemory{T}"/> instance will wrap a <see cref="byte"/> array with the bytecode.
/// </remarks>
public static ReadOnlyMemory<byte> LoadBytecode<T>(D2D1ShaderProfile shaderProfile, D2D1CompileOptions options)
where T : unmanaged, ID2D1PixelShader
{
return LoadOrCompileBytecode<T>(shaderProfile, options);
}
/// <summary>
@@ -54,16 +81,17 @@ public static class D2D1PixelShader
/// </summary>
/// <typeparam name="T">The type of D2D1 pixel shader to load the bytecode for.</typeparam>
/// <param name="shaderProfile">The shader profile to use to get the shader bytecode.</param>
/// <param name="options">The compile options to use to get the shader bytecode.</param>
/// <returns>A <see cref="ReadOnlyMemory{T}"/> instance with the resulting shader bytecode.</returns>
/// <exception cref="InvalidOperationException">Thrown if the input shader has not been precompiled.</exception>
private static unsafe ReadOnlyMemory<byte> LoadOrCompileBytecode<T>(D2D1ShaderProfile? shaderProfile)
private static unsafe ReadOnlyMemory<byte> LoadOrCompileBytecode<T>(D2D1ShaderProfile? shaderProfile, D2D1CompileOptions? options)
where T : unmanaged, ID2D1PixelShader
{
D2D1ShaderBytecodeLoader bytecodeLoader = default;
Unsafe.SkipInit(out T shader);
shader.LoadBytecode(ref bytecodeLoader, shaderProfile);
shader.LoadBytecode(ref bytecodeLoader, shaderProfile, options);
using ComPtr<ID3DBlob> dynamicBytecode = bytecodeLoader.GetResultingShaderBytecode(out ReadOnlySpan<byte> precompiledBytecode);
+1 -1
ファイルの表示
@@ -29,7 +29,7 @@ public static class D2D1ReflectionServices
D2D1ShaderBytecodeLoader bytecodeLoader = default;
shader.LoadBytecode(ref bytecodeLoader, D2D1ShaderProfile.PixelShader50);
shader.LoadBytecode(ref bytecodeLoader, D2D1ShaderProfile.PixelShader50, D2D1CompileOptions.Default);
using ComPtr<ID3DBlob> dynamicBytecode = bytecodeLoader.GetResultingShaderBytecode(out ReadOnlySpan<byte> precompiledBytecode);
+4 -4
ファイルの表示
@@ -21,8 +21,8 @@ public static class D2D1ShaderCompiler
/// <param name="loader">The <typeparamref name="TLoader"/> instance to use to load the bytecode.</param>
/// <param name="shader">The input <typeparamref name="T"/> instance representing the D2D1 shader to run.</param>
/// <param name="shaderProfile">The shader profile to use to compile the shader.</param>
/// <param name="enableLinkingSupport">Whether to enable linking support for the shader.</param>
public static unsafe void LoadDynamicBytecode<TLoader, T>(ref TLoader loader, in T shader, D2D1ShaderProfile? shaderProfile, bool enableLinkingSupport)
/// <param name="options">The compiler options to use to compile the shader.</param>
public static unsafe void LoadDynamicBytecode<TLoader, T>(ref TLoader loader, in T shader, D2D1ShaderProfile shaderProfile, D2D1CompileOptions options)
where TLoader : struct, ID2D1BytecodeLoader
where T : struct, ID2D1Shader
{
@@ -30,8 +30,8 @@ public static class D2D1ShaderCompiler
using ComPtr<ID3DBlob> d3DBlobBytecode = Shaders.Translation.D3DCompiler.Compile(
hlslSource.AsSpan(),
shaderProfile ?? D2D1ShaderProfile.PixelShader50,
D2D1CompileOptions.Default | (enableLinkingSupport ? D2D1CompileOptions.EnableLinking : 0));
shaderProfile,
options);
loader.LoadDynamicBytecode((IntPtr)d3DBlobBytecode.Get());
}