Repository navigation
Conversation
…ing colors Vulkan without VK_EXT_provoking_vertex, DX9 and DX11 take flat-shaded colors from the first vertex, while on Dreamcast it's the last. For the depth-sorted triangle list, setFirstProvokingVertex() copied each triangle's last vertex colors onto its first vertex. But sortTriangles() builds these triangles from strips, so neighbors share vertices: tri0=(P0,P1,P2), tri1=(P2,P1,P3). P2 is tri0's source and tri1's destination, and the list is processed in depth order, so one triangle's flat color can overwrite another's before it's read. In strips of three or more triangles, consecutive triangles even share their first vertex. Flat-shaded translucent polygons then pick up a neighbor's color, e.g. the player shadow decals in Tony Hawk's Pro Skater 2 and Mat Hoffman's Pro BMX turn uniformly dark. Each sorted triangle has its own three slots in idx, so rotate them (a,b,c) -> (c,a,b) instead. The winding is unchanged and the provoking vertex comes first, without touching shared vertices. Strips keep the color copy, which is safe there. Adds SorterTest, which fails on the old code and passes with this change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Vulkan without VK_EXT_provoking_vertex, DX9 and DX11 take flat-shaded
colors from the first vertex, while on Dreamcast it's the last. For the
depth-sorted triangle list, setFirstProvokingVertex() copied each
triangle's last vertex colors onto its first vertex. But sortTriangles()
builds these triangles from strips, so neighbors share vertices:
tri0=(P0,P1,P2), tri1=(P2,P1,P3). P2 is tri0's source and tri1's
destination, and the list is processed in depth order, so one
triangle's flat color can overwrite another's before it's read. In
strips of three or more triangles, consecutive triangles even share
their first vertex. Flat-shaded translucent polygons then pick up a
neighbor's color, e.g. the player shadow decals in Tony Hawk's Pro
Skater 2 and Mat Hoffman's Pro BMX turn uniformly dark.
Each sorted triangle has its own three slots in idx, so rotate them
(a,b,c) -> (c,a,b) instead. The winding is unchanged and the provoking
vertex comes first, without touching shared vertices. Strips keep the
color copy, which is safe there.
Adds SorterTest, which fails on the old code and passes with this change.
Testing: SorterTest passes with this change and fails on the current sorter (3 of 3 checks red before, green after). Compiles in the libretro core and the standalone build (macOS arm64).
🤖 Generated with Claude Code