fixing FragCoord derivatives
Test / build_and_test (push) Successful in 1m35s
Build / build (push) Successful in 3m10s

This commit is contained in:
2026-07-04 01:49:17 +02:00
parent bfc5c3933c
commit e6538d221f
2 changed files with 10 additions and 4 deletions
+2 -2
View File
@@ -32,8 +32,8 @@
// Soft dependencies
.SPIRV_Interpreter = .{
.url = "git+https://github.com/Kbz-8/SPIRV-Interpreter#6e1fa9db32f3e596e30d60f94b2909f3609ec03a",
.hash = "SPIRV_Interpreter-0.0.1-ajmpn_CXCQB0GIcZz8ioOFOW9yLr5Ka-Qir3v3Y1r5Bi",
.url = "git+https://github.com/Kbz-8/SPIRV-Interpreter#32806def90a68f5f0514405d0ff8c1b0cb16772e",
.hash = "SPIRV_Interpreter-0.0.1-ajmpn0qdCQANEex9HEO44N5dcyyOjYGzPCXlzdXhvnr7",
.lazy = true,
},
//.SPIRV_Interpreter = .{
+8 -2
View File
@@ -70,8 +70,14 @@ pub fn shaderInvocation(
};
if (rt.getBuiltinResult(.FragCoord)) |frag_coord_word| {
const frag_coord_dx = zm.f32x4(1.0, 0.0, 0.0, 0.0);
const frag_coord_dy = zm.f32x4(0.0, 1.0, 0.0, 0.0);
const pixel_x: i32 = @intFromFloat(position[0]);
const pixel_y: i32 = @intFromFloat(position[1]);
const dx: f32 = if (@mod(pixel_x, 2) == 0) 1.0 else -1.0;
const dy: f32 = if (@mod(pixel_y, 2) == 0) 1.0 else -1.0;
rt.derivative_sign_x = dx;
rt.derivative_sign_y = dy;
const frag_coord_dx = zm.f32x4(dx, 0.0, 0.0, 0.0);
const frag_coord_dy = zm.f32x4(0.0, dy, 0.0, 0.0);
try rt.setDerivativeFromMemory(allocator, frag_coord_word, std.mem.asBytes(&frag_coord_dx), std.mem.asBytes(&frag_coord_dy));
}