summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2015-02-26 14:29:25 -0800
committerKenneth Graunke <kenneth@whitecape.org>2015-02-27 11:36:27 -0800
commit53295bebc883c5b90b4b3a2612d7cacabc94fd1b (patch)
tree6ce059ed54d75d08938e0953c262fd3295ceb1ac /src/mesa/drivers/dri/i965/brw_wm_surface_state.c
parentea696be5ac097af621f10858d925a343a838be7a (diff)
downloadexternal_mesa3d-53295bebc883c5b90b4b3a2612d7cacabc94fd1b.zip
external_mesa3d-53295bebc883c5b90b4b3a2612d7cacabc94fd1b.tar.gz
external_mesa3d-53295bebc883c5b90b4b3a2612d7cacabc94fd1b.tar.bz2
i965: Fix I/L/LA SNORM formats.
_mesa_choose_tex_format (texformat.c) tries I8_SNORM, L8_SNORM, and either L8A8_SNORM or A8L8_SNORM, none of which are supported by our driver. Failing that, it falls back to RGBX for luminance, and RGBA intensity and luminance alpha. So, we need to use swizzle overrrides to obtain the correct values. Fixes Piglit's EXT_texture_snorm/fbo-blending-formats and fbo-clear-formats. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_wm_surface_state.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index ec4dfdb..f479f44 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -187,6 +187,8 @@ brw_get_texture_swizzle(const struct gl_context *ctx,
}
}
+ GLenum datatype = _mesa_get_format_datatype(img->TexFormat);
+
/* If the texture's format is alpha-only, force R, G, and B to
* 0.0. Similarly, if the texture's format has no alpha channel,
* force the alpha value read to 1.0. This allows for the
@@ -200,13 +202,29 @@ brw_get_texture_swizzle(const struct gl_context *ctx,
swizzles[2] = SWIZZLE_ZERO;
break;
case GL_LUMINANCE:
- if (t->_IsIntegerFormat) {
+ if (t->_IsIntegerFormat || datatype == GL_SIGNED_NORMALIZED) {
swizzles[0] = SWIZZLE_X;
swizzles[1] = SWIZZLE_X;
swizzles[2] = SWIZZLE_X;
swizzles[3] = SWIZZLE_ONE;
}
break;
+ case GL_LUMINANCE_ALPHA:
+ if (datatype == GL_SIGNED_NORMALIZED) {
+ swizzles[0] = SWIZZLE_X;
+ swizzles[1] = SWIZZLE_X;
+ swizzles[2] = SWIZZLE_X;
+ swizzles[3] = SWIZZLE_W;
+ }
+ break;
+ case GL_INTENSITY:
+ if (datatype == GL_SIGNED_NORMALIZED) {
+ swizzles[0] = SWIZZLE_X;
+ swizzles[1] = SWIZZLE_X;
+ swizzles[2] = SWIZZLE_X;
+ swizzles[3] = SWIZZLE_X;
+ }
+ break;
case GL_RED:
case GL_RG:
case GL_RGB: