Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@veka0
Copy link
Contributor

@veka0 veka0 commented Jul 3, 2025

This PR aims to solve the problem of ambiguous blending factors with the same values

#define GU_SRC_COLOR (0)
#define GU_DST_COLOR (0)
#define GU_ONE_MINUS_SRC_COLOR (1)
#define GU_ONE_MINUS_DST_COLOR (1)

by deprecating & replacing them with different macros

#define GU_OTHER_COLOR (0) // dstColor if used for source operand; srcColor if used for destination operand
#define GU_ONE_MINUS_OTHER_COLOR (1) // 1-dstColor if used for source operand; 1-srcColor if used for destination operand

as well as adds 4 additional previously unknown blending factors

#define GU_DOUBLE_SRC_ALPHA (6)           // 2*srcAlpha
#define GU_ONE_MINUS_DOUBLE_SRC_ALPHA (7) // 1-2*srcAlpha
#define GU_DOUBLE_DST_ALPHA (8)           // 2*dstAlpha
#define GU_ONE_MINUS_DOUBLE_DST_ALPHA (9) // 1-2*dstAlpha

Behaviors of all blend factors were verified via fuzzing by comparing random blended colors rendered via GE against colors manually computed on the CPU, so descriptions of each blend factor are accurate.

Copy link
Member

@fjtrujy fjtrujy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@sharkwouter
Copy link
Member

Thanks!

@sharkwouter sharkwouter merged commit 4ec0eef into pspdev:master Jul 3, 2025
1 check passed
@veka0 veka0 deleted the blend-factor-improvements branch July 3, 2025 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants