diff --git a/build.zig.zon b/build.zig.zon index 0230448..311fdb2 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -32,8 +32,8 @@ // Soft dependencies .SPIRV_Interpreter = .{ - .url = "git+https://github.com/Kbz-8/SPIRV-Interpreter#6fbd386ce40286ca9dcf21c994ccc46814fb9b94", - .hash = "SPIRV_Interpreter-0.0.1-ajmpn0N2CQDo-XU_Lf_Xt140wvHyoxBnzapYANEOgjdH", + .url = "git+https://github.com/Kbz-8/SPIRV-Interpreter#445bb93296bd6da4a74aa40152aaa779170887cf", + .hash = "SPIRV_Interpreter-0.0.1-ajmpn113CQDBhtMXf88no5gcMJhlricW5G_rWc7AvRS5", .lazy = true, }, //.SPIRV_Interpreter = .{ diff --git a/src/software/device/fragment.zig b/src/software/device/fragment.zig index 7c5b26e..85d764b 100644 --- a/src/software/device/fragment.zig +++ b/src/software/device/fragment.zig @@ -119,6 +119,10 @@ pub fn shaderInvocation( const entry = try rt.getEntryPointByName(shader.entry); + const processed_inputs = allocator.alloc(bool, rt.results.len) catch return SpvRuntimeError.OutOfMemory; + defer allocator.free(processed_inputs); + @memset(processed_inputs, false); + for (0..spv.SPIRV_MAX_OUTPUT_LOCATIONS) |location| { for (0..4) |component| { var input = fragment_inputs[location][component]; @@ -134,6 +138,11 @@ pub fn shaderInvocation( }, else => return err, }; + if (result_word >= processed_inputs.len) + return SpvRuntimeError.InvalidSpirV; + if (processed_inputs[result_word]) + continue; + processed_inputs[result_word] = true; const has_result_value = rt.results[result_word].variant != null; const memory_size = if (has_result_value)