summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_atom_texture.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2010-08-11 19:04:05 +1000
committerDave Airlie <airlied@redhat.com>2010-10-02 17:03:15 +1000
commit71a079fb4ecbd17703ac9b5e6d5ef622fd7bc50f (patch)
treee25cc06ea21a61404882d3fad27f5c6e3199d614 /src/mesa/state_tracker/st_atom_texture.c
parentf31771343259d195ba243ce8d307831e495d5a2c (diff)
mesa/st: initial attempt at RG support for gallium drivers
passes all piglit RG tests with softpipe.
Diffstat (limited to 'src/mesa/state_tracker/st_atom_texture.c')
-rw-r--r--src/mesa/state_tracker/st_atom_texture.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index 981129621c..029b040346 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -52,7 +52,7 @@
*
* \param format PIPE_FORMAT_*.
* \param swizzle Texture swizzle, a bitmask computed using MAKE_SWIZZLE4.
- * \param depthmode One of GL_LUMINANCE, GL_INTENSITY, GL_ALPHA.
+ * \param depthmode One of GL_LUMINANCE, GL_INTENSITY, GL_ALPHA, GL_RED.
*/
static GLuint apply_depthmode(enum pipe_format format,
GLuint swizzle, GLenum depthmode)
@@ -96,6 +96,14 @@ static GLuint apply_depthmode(enum pipe_format format,
else if (swiz[i] < SWIZZLE_W)
swiz[i] = SWIZZLE_ZERO;
break;
+ case GL_RED:
+ /* Rewrite reads W to 1, XYZ to X00 */
+ for (i = 0; i < 4; i++)
+ if (swiz[i] == SWIZZLE_W)
+ swiz[i] = SWIZZLE_ONE;
+ else if (swiz[i] == SWIZZLE_Y || swiz[i] == SWIZZLE_Z)
+ swiz[i] = SWIZZLE_ZERO;
+ break;
}
return MAKE_SWIZZLE4(swiz[0], swiz[1], swiz[2], swiz[3]);