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

nv2a: Always specify GL texture swizzle #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JayFoxRox
Copy link
Owner

This adds explicit swizzle information to each texture format.

Currently, we have a manual check if the mask is {0,0,0,0} to figure out if we want want to avoid the GL texture swizzle. However {0,0,0,0} is the same as {GL_ZERO,GL_ZERO,GL_ZERO,GL_ZERO} (a valid state). But when we don't want GL texture swizzle, we'd actually need {GL_RED,GL_GREEN,GL_BLUE,GL_ALPHA}.

So instead of falling back to {0,0,0,0}, this adds the default mask instead. For texture storage formats without alpha, I've modified the default mask to {GL_RED,GL_GREEN,GL_BLUE,GL_ONE}. If this has a performance impact, we can change it back to the default mask.

Motivation:

When we have signed textures, we will probably have to read the swizzle mask elsewhere, so copying the check for {0,0,0,0} is very annoying.

Also, we might need more fields for textures in the near future, so it's good to have the struct fully initialized.


TODO:

  • This was supposed to land upstream; but I'm having second-thoughts. Probably better to wait until signed-texture or dotmap need this.

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.

1 participant