fix edge marking (polygon id is 6-bit not 5)

also make the code a bit nicer
This commit is contained in:
RSDuck 2023-04-19 23:31:09 +02:00
parent ddad9b5526
commit 2b52b45f66
1 changed files with 4 additions and 7 deletions

View File

@ -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;