working on example
Some checks failed
Build / build (push) Failing after 36s
Test / build (push) Failing after 55s

This commit is contained in:
2026-01-21 00:35:48 +01:00
parent df711a196a
commit c5225e3a45
8 changed files with 171 additions and 124 deletions

View File

@@ -169,6 +169,7 @@ pub const RuntimeDispatcher = block: {
.ConvertFToU = ConversionEngine(.Float, .UInt).op,
.ConvertSToF = ConversionEngine(.SInt, .Float).op,
.ConvertUToF = ConversionEngine(.UInt, .Float).op,
.CopyMemory = opCopyMemory,
.FAdd = MathEngine(.Float, .Add).op,
.FConvert = ConversionEngine(.Float, .Float).op,
.FDiv = MathEngine(.Float, .Div).op,
@@ -631,22 +632,10 @@ fn opAccessChain(_: std.mem.Allocator, word_count: SpvWord, rt: *Runtime) Runtim
switch (member_value.*) {
.Int => |i| {
switch (value_ptr.*) {
.Vector => |v| {
.Vector, .Matrix, .Array, .Structure => |v| {
if (i.uint32 > v.len) return RuntimeError.InvalidSpirV;
value_ptr = &v[i.uint32];
},
.Matrix => |m| {
if (i.uint32 > m.len) return RuntimeError.InvalidSpirV;
value_ptr = &m[i.uint32];
},
.Array => |a| {
if (i.uint32 > a.len) return RuntimeError.InvalidSpirV;
value_ptr = &a[i.uint32];
},
.Structure => |s| {
if (i.uint32 > s.len) return RuntimeError.InvalidSpirV;
value_ptr = &s[i.uint32];
},
else => return RuntimeError.InvalidSpirV,
}
},
@@ -752,6 +741,12 @@ fn opConstant(allocator: std.mem.Allocator, word_count: SpvWord, rt: *Runtime) R
}
}
fn opCopyMemory(_: std.mem.Allocator, _: SpvWord, rt: *Runtime) RuntimeError!void {
const target = try rt.it.next();
const source = try rt.it.next();
copyValue(try rt.results[target].getValue(), try rt.results[source].getValue());
}
fn opDecorate(allocator: std.mem.Allocator, _: SpvWord, rt: *Runtime) RuntimeError!void {
const target = try rt.it.next();
const decoration_type = try rt.it.nextAs(spv.SpvDecoration);