struct gl_texture_image *firstImage = texObj->Image[0][texObj->BaseLevel];
float color[4];
- if (firstImage->_BaseFormat == GL_DEPTH_COMPONENT) {
+ switch (firstImage->_BaseFormat) {
+ case GL_DEPTH_COMPONENT:
/* GL specs that border color for depth textures is taken from the
* R channel, while the hardware uses A. Spam R into all the
* channels for safety.
color[1] = sampler->BorderColor.f[0];
color[2] = sampler->BorderColor.f[0];
color[3] = sampler->BorderColor.f[0];
- } else {
+ break;
+ case GL_ALPHA:
+ color[0] = 0.0;
+ color[1] = 0.0;
+ color[2] = 0.0;
+ color[3] = sampler->BorderColor.f[3];
+ break;
+ case GL_INTENSITY:
+ color[0] = sampler->BorderColor.f[0];
+ color[1] = sampler->BorderColor.f[0];
+ color[2] = sampler->BorderColor.f[0];
+ color[3] = sampler->BorderColor.f[0];
+ break;
+ case GL_LUMINANCE:
+ color[0] = sampler->BorderColor.f[0];
+ color[1] = sampler->BorderColor.f[0];
+ color[2] = sampler->BorderColor.f[0];
+ color[3] = 1.0;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ color[0] = sampler->BorderColor.f[0];
+ color[1] = sampler->BorderColor.f[0];
+ color[2] = sampler->BorderColor.f[0];
+ color[3] = sampler->BorderColor.f[3];
+ break;
+ default:
color[0] = sampler->BorderColor.f[0];
color[1] = sampler->BorderColor.f[1];
color[2] = sampler->BorderColor.f[2];
color[3] = sampler->BorderColor.f[3];
+ break;
}
/* In some cases we use an RGBA surface format for GL RGB textures,