Disable shader compilation if any errors are present

このコミットが含まれているのは:
Sergio Pedri committed 2022-04-24 21:04:30 +02:00
1 親 5390d8b27c
コミット fd9d8a6f65
5ファイル変更
+18 -5

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

@@ -78,8 +78,11 @@ partial class ID2D1ShaderGenerator
{
ImmutableArray<byte> bytecode = ImmutableArray<byte>.Empty;
// No embedded shader was requested
if (sourceInfo.ShaderProfile is null)
// No embedded shader was requested, or there were some errors earlier in the pipeline.
// In this case, skip the compilation, as diagnostic will be emitted for those anyway.
// Compiling would just add overhead and result in more errors, as the HLSL would be invalid.
if (sourceInfo.HasErrors ||
sourceInfo.ShaderProfile is null)
{
diagnostic = null;
+3 -1
ファイルの表示
@@ -78,11 +78,13 @@ public sealed partial class ID2D1ShaderGenerator : IIncrementalGenerator
// Get the shader profile and linking info for LoadBytecode()
D2D1ShaderProfile? shaderProfile = LoadBytecode.GetShaderProfile(item.Left.Symbol);
bool isLinkingSupported = LoadBytecode.IsSimpleInputShader(item.Left.Symbol);
bool hasErrors = !dispatchDataDiagnostics.IsDefaultOrEmpty || !hlslSourceDiagnostics.IsDefaultOrEmpty;
HlslShaderSourceInfo sourceInfo = new(
hlslSource,
shaderProfile,
isLinkingSupported);
isLinkingSupported,
hasErrors);
token.ThrowIfCancellationRequested();
+2 -1
ファイルの表示
@@ -6,4 +6,5 @@
/// <param name="HlslSource">The HLSL source.</param>
/// <param name="ShaderProfile">The shader profile to use to compile the shader, if requested.</param>
/// <param name="IsLinkingSupported">Whether the shader supports linking.</param>
internal sealed record HlslShaderSourceInfo(string HlslSource, D2D1ShaderProfile? ShaderProfile, bool IsLinkingSupported);
/// <param name="HasErrors">Whether any errors have been detected, and therefore the shader compilation should be skipped.</param>
internal sealed record HlslShaderSourceInfo(string HlslSource, D2D1ShaderProfile? ShaderProfile, bool IsLinkingSupported, bool HasErrors);