Skip to content

Migrate shader translation and remove legacy compiler paths - #90

Merged
Sieluna merged 4 commits into
masterfrom
fix/compiler-pr-workflow
Oct 12, 2026
Merged

Sieluna merged 4 commits into
masterfrom
fix/compiler-pr-workflow

Conversation

@Sieluna

@Sieluna Sieluna commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Closed #89

@Sieluna Sieluna closed this Oct 8, 2026
@Sieluna Sieluna reopened this Oct 11, 2026
@Sieluna
Sieluna force-pushed the fix/compiler-pr-workflow branch from ddcdb63 to 9da309b Compare October 11, 2026 11:10
@Sieluna Sieluna changed the title Restore the compiler changes to the PR workflow Migrate shader translation and remove legacy compiler paths Oct 11, 2026
bool exits = statement switch
{
Statement.Break => true,
Statement.If branch => Rewrite(branch.Accept) | Rewrite(branch.Reject),
args.Add(pair.Image); args.Add(pair.Sampler); args.Add(coordinate); if (layer is not null) args.Add(layer); if (depth is not null) args.Add(depth);
if (compare && operands.Level is not null)
{
if (!ConstantEvaluator.TryEvaluate(operands.Level, out var level) || level is not Expression.Literal literal || System.Convert.ToDouble(literal.Value) != 0) throw Error("WGSL comparison sampling only supports level zero.");
}
return scalar.Kind switch
{
ScalarKind.Bool => new Expression.Literal(literal.Value is bool boolean ? boolean : Floating(literal.Value) != 0, type),
{
double x = Floating(a.Value), y = Floating(b.Value);
if (op is "<" or ">" or "<=" or ">=" or "==" or "!=") return Expression.Bool(op switch
{ "<" => x < y, ">" => x > y, "<=" => x <= y, ">=" => x >= y, "==" => x == y, _ => x != y });
{
double x = Floating(a.Value), y = Floating(b.Value);
if (op is "<" or ">" or "<=" or ">=" or "==" or "!=") return Expression.Bool(op switch
{ "<" => x < y, ">" => x > y, "<=" => x <= y, ">=" => x >= y, "==" => x == y, _ => x != y });
private DescriptorValue ScalarDescriptor(uint id)
{
if (descriptorValues.TryGetValue(id, out var cached)) return cached;
if (!definitions.TryGetValue(id, out var i) || !types.TryGetValue(i.Operands[0], out var type) || (Op)type.Opcode != Op.TypeInt)
}
private Part IndexPart(uint id)
{
if (!definitions.TryGetValue(id, out var i) || !types.TryGetValue(i.Operands[0], out var type) || (Op)type.Opcode != Op.TypeInt)
public sealed record TaskDispatch(SsaValue Dimensions, string Payload, SourceSpan Span = default) : ControlFlowTerminator;
public sealed record Unreachable(SourceSpan Span = default) : ControlFlowTerminator;
public sealed record InvocationKill(SourceSpan Span = default, bool ExplicitTermination = false) : ControlFlowTerminator;
public ShaderEffects Effects => this is TaskDispatch ? ShaderBuiltinEffects.Barrier(true) | ShaderEffects.InvocationTermination
public sealed record Unreachable(SourceSpan Span = default) : ControlFlowTerminator;
public sealed record InvocationKill(SourceSpan Span = default, bool ExplicitTermination = false) : ControlFlowTerminator;
public ShaderEffects Effects => this is TaskDispatch ? ShaderBuiltinEffects.Barrier(true) | ShaderEffects.InvocationTermination
: this is InvocationKill ? ShaderEffects.Convergent | ShaderEffects.InvocationTermination : ShaderEffects.None;
if (bitcast) return Bitcast(input, type);
if (input is Expression.Construct c && type is ShaderType.Vector vector)
return new Expression.Construct(type, c.Components.Select(e => ConvertCore(e, vector.Component, bitcast)).ToArray());
if (input is Expression.Construct matrix && type is ShaderType.Matrix m && !bitcast)
@Sieluna Sieluna self-assigned this Oct 11, 2026
@Sieluna
Sieluna added this pull request to stack #93 October 11, 2026 11:22
@Sieluna
Sieluna force-pushed the fix/compiler-pr-workflow branch from 9da309b to f13a426 Compare October 11, 2026 11:36
@Sieluna Sieluna added the enhancement New feature or request label Oct 11, 2026
@Sieluna
Sieluna merged commit eba89b0 into master Oct 12, 2026
10 checks passed
@Sieluna
Sieluna deleted the fix/compiler-pr-workflow branch October 12, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Restore the compiler changes to the PR workflow

1 participant