From 2b52b45f66b74a5bc313e5e85d4b67961af05460 Mon Sep 17 00:00:00 2001 From: RSDuck Date: Wed, 19 Apr 2023 23:31:09 +0200 Subject: [PATCH] fix edge marking (polygon id is 6-bit not 5) also make the code a bit nicer --- src/GPU3D_Compute_shaders.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/GPU3D_Compute_shaders.h b/src/GPU3D_Compute_shaders.h index bcf57b2e..eaef76c9 100644 --- a/src/GPU3D_Compute_shaders.h +++ b/src/GPU3D_Compute_shaders.h @@ -1488,16 +1488,13 @@ void main() otherDepth.w = DepthResult[resultOffset+ScreenWidth]; } - uint polyId = bitfieldExtract(attr.x, 24, 5); - uvec4 otherPolyId = bitfieldExtract(otherAttr, 24, 5); + uint polyId = bitfieldExtract(attr.x, 24, 6); + uvec4 otherPolyId = bitfieldExtract(otherAttr, 24, 6); - bvec4 polyIdMatch = equal(uvec4(polyId), otherPolyId); + bvec4 polyIdMismatch = notEqual(uvec4(polyId), otherPolyId); bvec4 nearer = lessThan(uvec4(depth.x), otherDepth); - if ((!polyIdMatch.x && nearer.x) - || (!polyIdMatch.y && nearer.y) - || (!polyIdMatch.z && nearer.z) - || (!polyIdMatch.w && nearer.w)) + if (any(polyIdMismatch & nearer)) { color.x = ToonTable[polyId >> 3].b | (color.x & 0xFF000000U); attr.x = (attr.x & 0xFFFFE0FFU) | 0x00001000U;