Removed implicit __z field from pixel shaders

このコミットが含まれているのは:
Sergio Pedri committed 2021-05-11 01:54:37 +02:00
1 親 31c7058118
コミット 3aeb843023
7ファイル変更
+46 -13

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

+15
ファイルの表示
@@ -172,6 +172,21 @@ namespace ComputeSharp.SourceGenerators.SyntaxRewriters
return updatedNode.WithBody(Block(IfStatement(rangeCheckExpression, updatedNode.Body!)));
}
/// <inheritdoc/>
public override SyntaxNode? VisitIdentifierName(IdentifierNameSyntax node)
{
IdentifierNameSyntax updatedNode = (IdentifierNameSyntax)base.VisitIdentifierName(node)!;
// Since pixel shaders are only ever executed on 2D textures, the special __z field can
// be removed and replaced with just numeric literal expressions, where the value is 1.
if (updatedNode.Identifier.Text == "__z")
{
return LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(1));
}
return updatedNode;
}
}
}
}