From dd9705ef31f3359f8d41a88b58cdc42599c733c4 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Tue, 4 Aug 2020 13:20:45 +1000 Subject: [PATCH] GPU/HW: Fix last row of oversized writes not applying Combined with the wrap changes, fixes Namco Museum motherboard scene. --- src/core/gpu_hw_shadergen.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/core/gpu_hw_shadergen.cpp b/src/core/gpu_hw_shadergen.cpp index a961c82f3..d966e5ab8 100644 --- a/src/core/gpu_hw_shadergen.cpp +++ b/src/core/gpu_hw_shadergen.cpp @@ -1095,8 +1095,12 @@ std::string GPU_HW_ShaderGen::GenerateVRAMWriteFragmentShader(bool use_ssbo) uint2 coords = uint2(uint(v_pos.x) / RESOLUTION_SCALE, fixYCoord(uint(v_pos.y)) / RESOLUTION_SCALE); // make sure it's not oversized and out of range - if (VECTOR_LT(coords, u_base_coords) && VECTOR_GE(coords, u_end_coords)) + if ((coords.x < u_base_coords.x && coords.x >= u_end_coords.x) || + (coords.y < u_base_coords.y && coords.y >= u_end_coords.y)) + { discard; + } + // find offset from the start of the row/column uint2 offset; @@ -1130,8 +1134,11 @@ std::string GPU_HW_ShaderGen::GenerateVRAMCopyFragmentShader() uint2 dst_coords = uint2(v_pos.xy); // make sure it's not oversized and out of range - if (VECTOR_LT(dst_coords, u_dst_coords) && VECTOR_GE(dst_coords, u_end_coords)) + if ((dst_coords.x < u_dst_coords.x && dst_coords.x >= u_end_coords.x) || + (dst_coords.y < u_dst_coords.y && dst_coords.y >= u_end_coords.y)) + { discard; + } // find offset from the start of the row/column uint2 offset;