-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Stop decoding BC1 punchthrough alpha in BC2&3 #4144
Conversation
Please can you add unit tests which fail before and pass after, to guard against future regressions? |
And do you have a link to a spec or some docs that define the correct behaviour? |
Spec is here: https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_compression_s3tc.txt . As per section "Appendix in OpenGL 1.2.1" "Appendix C.2 in OpenGL ES 3.0.2":
I suppose it'd make sense to mention this in a comment in the code as well. I'll look into tests. |
The table at https://en.wikipedia.org/wiki/S3_Texture_Compression#S3TC_format_comparison makes me think that it's not quite this simple, since BC2 can be DXT2/3 and BC3 can be DXT4/5, and DXT2/4 and 3/5 treat alpha differently? |
As per Issues/(1) in the abovementioned spec, no. OpenGL does not directly support the premultiplied alpha variants and they only really serve as a hint for blending mode parameters. There is also no in-band data to indicate which alpha mode you are dealing with. Similarly whether BC1 has alpha at all is out-of-band information. Anyway neither of these is directly related to this PR. Oh and in case someone was looking at MSDN docs for BC2/3, those apparently forgot to mention the different alpha handling:
|
@radarhere What do you think: ready to merge, or still some questions? Thanks! |
Fixes #4142