[Mesa-dev] [PATCH 2/5] mesa: complete the GL_TEXTURE_SWIZZLE* setup
Yuanhan Liu
yuanhan.liu at linux.intel.com
Wed Nov 2 02:56:57 PDT 2011
The ARB_texture_swizzle spec says:
The error INVALID_OPERATION is generated if TexParameteri,
TexParameterf, TexParameteriv, or TexParameterfv, parameter <pname>
is TEXTURE_SWIZZLE_R, TEXTURE_SWIZZLE_G, TEXTURE_SWIZZLE_B,
or TEXTURE_SWIZZLE_A, and <param> is not RED, GREEN, BLUE, ALPHA,
ZERO, or ONE.
The error INVALID_OPERATION is generated if TexParameteriv, or
TexParameterfv, parameter <pname> TEXTURE_SWIZZLE_RGBA, and the four
consecutive values pointed to by <param> are not all RED, GREEN, BLUE,
ALPHA, ZERO, or ONE.
So, the GL_TEXTURE_SWIZZLE* pname is legal for glTexParameterf(v)
Signed-off-by: Yuanhan Liu <yuanhan.liu at linux.intel.com>
---
src/mesa/main/texparam.c | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index b031e18..2ebf383 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -596,6 +596,17 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
need_update = set_tex_parameteri(ctx, texObj, pname, p);
}
break;
+ case GL_TEXTURE_SWIZZLE_R_EXT:
+ case GL_TEXTURE_SWIZZLE_G_EXT:
+ case GL_TEXTURE_SWIZZLE_B_EXT:
+ case GL_TEXTURE_SWIZZLE_A_EXT:
+ {
+ GLint p[4];
+ p[0] = (GLint) param;
+ p[1] = p[2] = p[3] = 0;
+ need_update = set_tex_parameteri(ctx, texObj, pname, p);
+ }
+ break;
default:
{
/* this will generate an error if pname is illegal */
@@ -661,6 +672,22 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
break;
#endif
+ case GL_TEXTURE_SWIZZLE_R_EXT:
+ case GL_TEXTURE_SWIZZLE_G_EXT:
+ case GL_TEXTURE_SWIZZLE_B_EXT:
+ case GL_TEXTURE_SWIZZLE_A_EXT:
+ case GL_TEXTURE_SWIZZLE_RGBA_EXT:
+ {
+ GLint p[4] = {0, 0, 0, 0};
+ p[0] = (GLint) params[0];
+ if (pname == GL_TEXTURE_SWIZZLE_RGBA_EXT) {
+ p[1] = (GLint) params[1];
+ p[2] = (GLint) params[2];
+ p[3] = (GLint) params[3];
+ }
+ need_update = set_tex_parameteri(ctx, texObj, pname, p);
+ }
+ break;
default:
/* this will generate an error if pname is illegal */
need_update = set_tex_parameterf(ctx, texObj, pname, params);
--
1.7.4.4
More information about the mesa-dev
mailing list