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.
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: