summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c12
1 files changed, 12 insertions, 0 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 5e99592f4a5..b1f1df11993 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -729,6 +729,18 @@ brw_get_texture_swizzle(const struct gl_texture_object *t)
}
}
+ /* For a format with no alpha channel, force the alpha result to
+ * 1.0. (This allows for an RGBA texture to be used for an RGB
+ * format, for example).
+ */
+ switch (img->_BaseFormat) {
+ case GL_RED:
+ case GL_RG:
+ case GL_RGB:
+ swizzles[3] = SWIZZLE_ONE;
+ break;
+ }
+
return MAKE_SWIZZLE4(swizzles[GET_SWZ(t->_Swizzle, 0)],
swizzles[GET_SWZ(t->_Swizzle, 1)],
swizzles[GET_SWZ(t->_Swizzle, 2)],