summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2012-12-20 15:45:11 -0800
committerEric Anholt <[email protected]>2012-12-26 12:08:33 -0800
commit5791c56811ae261b0596d088e99933eb5e24206d (patch)
treec46c26397685da40d3442dbe72484f683f46282d /src
parent5628501e7b4289f5a04a2ca26d1ed4b3dec1a442 (diff)
i965: Fix border color handling for deprecated SNORM formats.
We don't have native hardware support for these, so they get promoted to RGBA, in which case we don't have hardware dealing with the channel swizzling for us. Fixes piglit EXT_texture_snorm/texwrap formats bordercolor (-swizzled). Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_sampler_state.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
index 0d1f24950e6..006aa68a0b4 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
@@ -89,7 +89,8 @@ upload_default_color(struct brw_context *brw, struct gl_sampler_object *sampler,
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.
@@ -98,11 +99,37 @@ upload_default_color(struct brw_context *brw, struct gl_sampler_object *sampler,
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,