[rlsw] Fix alpha tracking for persistent current colors#5964
Conversation
|
@Bigfoot71 please, could you takee a look to this PR? |
There was a problem hiding this comment.
I propose that we also remove RLSW.primitive.hasColorAlpha |= (color[3] < 1.0f); from sw_immediate_set_color(), and doing this check only in sw_immediate_push_vertex()
| for (int i = 0; i < 4; i++) vertex->color[i] = RLSW.primitive.color[i]; | ||
| for (int i = 0; i < 2; i++) vertex->texcoord[i] = RLSW.primitive.texcoord[i]; | ||
| RLSW.primitive.hasColorAlpha |= (vertex->color[3] < 1.0f); |
There was a problem hiding this comment.
And while we're at it, we could also make the intent explicit, for example:
// Track whether any vertex in this primitive has alpha < 1.0
RLSW.primitive.hasColorAlpha |= (vertex->color[3] < 1.0f);|
Yes, there is indeed a logic issue, and the proposed fix is correct. I just suggested removing a line that becomes unnecessary with this change, and perhaps adding a comment to make the intent explicit for everyone. Otherwise, looks good to me. |
|
@iztanos please, could you implement and test proposed changes? thanks! |
cae03aa to
aa5e02a
Compare
|
Updated, thanks for the review @Bigfoot71. I removed the old I also added the small comment you suggested near the new check. Rebased on current |
Fixes #5961.
This follows the root-cause analysis from @HurricanVD in #5961.
The issue suggested preserving
hasColorAlphafrom the persistent current colorat primitive boundaries. This PR takes a slightly narrower approach: it updates
hasColorAlphawhen a vertex copies the current color.That keeps the flag tied to the primitive contents themselves. A primitive is
marked as containing alpha only if one of its submitted vertices actually has
alpha below
1.0f, while persistent translucent colors still remain correctlytracked across multiple primitives.