Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oops, fix an edge case for avoiding discard #11277

Merged
merged 3 commits into from Jul 30, 2018

Conversation

unknownbrackets
Copy link
Collaborator

Realized that not all the safeDestFactors were "safe" for this, since we need to preserve the dest color.

I did find 1.0 - src.a, 1.0 - 2.0 * src.a and fixed 1.0 used, which are all safe. I figure these checks are likely cheap, since drawing with obscure blend factors is fairly uncommon. I didn't actually find unsafe cases, but I'm sure there are a few out there in some special effects...

I also replaced the > 0 alpha test trivially true check with the same logic, because I think it's equally unsafe. Consider src * src.a - dst * src - replacing src.a with 0 is definitely not equivalent to a discard. Luckily, this should only disable the optimization for edge cases.

-[Unknown]

We could end up with the wrong blending in other cases, because the
exiting color will get multiplied.

Luckily, this is still the common case.
Otherwise we hang because there's no thread to ever end.
It should be equally unsafe to use src color as dest blend factor, or
use blending with a subtract or min/max equation.
@unknownbrackets unknownbrackets added this to the v1.7.0 milestone Jul 29, 2018
@hrydgard hrydgard merged commit 31646d6 into hrydgard:master Jul 30, 2018
@unknownbrackets unknownbrackets deleted the fragtest branch July 30, 2018 06:53
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.

None yet

2 participants