From 445bb93296bd6da4a74aa40152aaa779170887cf Mon Sep 17 00:00:00 2001 From: Kbz-8 Date: Thu, 2 Jul 2026 02:19:11 +0200 Subject: [PATCH] fixing derivatives agains --- src/Runtime.zig | 8 +++++++- src/opcodes.zig | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Runtime.zig b/src/Runtime.zig index beb2dab..81c9d3d 100644 --- a/src/Runtime.zig +++ b/src/Runtime.zig @@ -448,7 +448,13 @@ pub fn setDerivativeFromMemory(self: *Self, allocator: std.mem.Allocator, result fn getResultTargetTypeWord(self: *const Self, result: SpvWord) RuntimeError!SpvWord { return switch ((try self.results[result].getConstVariant()).*) { - .Variable => |v| v.type_word, + .Variable => |v| switch ((try self.results[v.type_word].getConstVariant()).*) { + .Type => |t| switch (t) { + .Pointer => |p| p.target, + else => v.type_word, + }, + else => return RuntimeError.InvalidSpirV, + }, .Constant => |c| c.type_word, .FunctionParameter => |p| p.type_word, .AccessChain => |a| a.target, diff --git a/src/opcodes.zig b/src/opcodes.zig index 708ab85..97b89c0 100644 --- a/src/opcodes.zig +++ b/src/opcodes.zig @@ -2885,6 +2885,7 @@ fn MathEngine(comptime T: PrimitiveType, comptime Op: MathOp, comptime IsAtomic: .MatrixTimesMatrix, .MatrixTimesScalar, .MatrixTimesVector, + .VectorTimesScalar, .VectorTimesMatrix, => if (comptime is_int) @mulWithOverflow(op1, op2)[0] else op1 * op2, .Div => blk: { @@ -3253,7 +3254,6 @@ fn MathEngine(comptime T: PrimitiveType, comptime Op: MathOp, comptime IsAtomic: else => try vectorRoutines(dst, lhs, rhs, lane_bits), } - if (comptime IsAtomic) { try copyValue(lhs, dst); try copyValue(dst, &lhs_save.?);