From 8e5a77c45d867a63a544c00a91a5145d6ce4aca5 Mon Sep 17 00:00:00 2001 From: Matt Borgerson Date: Fri, 26 Jul 2024 17:21:02 -0700 Subject: [PATCH] nv2a/vk: Fix missing scale in d32_sfloat_s8_uint pack --- hw/xbox/nv2a/pgraph/vk/surface-compute.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/xbox/nv2a/pgraph/vk/surface-compute.c b/hw/xbox/nv2a/pgraph/vk/surface-compute.c index 8c6dd17ff0..eb28a2d5b0 100644 --- a/hw/xbox/nv2a/pgraph/vk/surface-compute.c +++ b/hw/xbox/nv2a/pgraph/vk/surface-compute.c @@ -83,9 +83,10 @@ const char *pack_d32_sfloat_s8_uint_to_z24s8_glsl = "layout(binding = 1) buffer StencilIn { uint stencil_in[]; };\n" "layout(binding = 2) buffer DepthStencilOut { uint depth_stencil_out[]; };\n" "uint get_input_idx(uint idx_out) {\n" - " uint y = idx_out / width_out;\n" - " uint x = idx_out % width_out;\n" - " return (y * width_in + x) * (width_in / width_out);\n" + " uint scale = width_in / width_out;" + " uint y = (idx_out / width_out) * scale;\n" + " uint x = (idx_out % width_out) * scale;\n" + " return y * width_in + x;\n" "}\n" "void main() {\n" " uint idx_out = gl_GlobalInvocationID.x;\n"