fixing FragCoord derivatives
This commit is contained in:
+2
-2
@@ -32,8 +32,8 @@
|
|||||||
|
|
||||||
// Soft dependencies
|
// Soft dependencies
|
||||||
.SPIRV_Interpreter = .{
|
.SPIRV_Interpreter = .{
|
||||||
.url = "git+https://github.com/Kbz-8/SPIRV-Interpreter#6e1fa9db32f3e596e30d60f94b2909f3609ec03a",
|
.url = "git+https://github.com/Kbz-8/SPIRV-Interpreter#32806def90a68f5f0514405d0ff8c1b0cb16772e",
|
||||||
.hash = "SPIRV_Interpreter-0.0.1-ajmpn_CXCQB0GIcZz8ioOFOW9yLr5Ka-Qir3v3Y1r5Bi",
|
.hash = "SPIRV_Interpreter-0.0.1-ajmpn0qdCQANEex9HEO44N5dcyyOjYGzPCXlzdXhvnr7",
|
||||||
.lazy = true,
|
.lazy = true,
|
||||||
},
|
},
|
||||||
//.SPIRV_Interpreter = .{
|
//.SPIRV_Interpreter = .{
|
||||||
|
|||||||
@@ -70,8 +70,14 @@ pub fn shaderInvocation(
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (rt.getBuiltinResult(.FragCoord)) |frag_coord_word| {
|
if (rt.getBuiltinResult(.FragCoord)) |frag_coord_word| {
|
||||||
const frag_coord_dx = zm.f32x4(1.0, 0.0, 0.0, 0.0);
|
const pixel_x: i32 = @intFromFloat(position[0]);
|
||||||
const frag_coord_dy = zm.f32x4(0.0, 1.0, 0.0, 0.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));
|
try rt.setDerivativeFromMemory(allocator, frag_coord_word, std.mem.asBytes(&frag_coord_dx), std.mem.asBytes(&frag_coord_dy));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user