Repository navigation
Migrate shader translation and remove legacy compiler paths - #90
Merged
Merged
Conversation
Sieluna
force-pushed
the
fix/compiler-pr-workflow
branch
from
October 11, 2026 11:10
ddcdb63 to
9da309b
Compare
| 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
added this pull request to stack #93
October 11, 2026 11:22
Sieluna
force-pushed
the
fix/compiler-pr-workflow
branch
from
October 11, 2026 11:36
9da309b to
f13a426
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closed #89