aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2012-07-27 16:47:27 -0700
committerIan Romanick <[email protected]>2012-08-29 15:09:35 -0700
commitd2b03f6e993f08b0a80a206d7bf6f0d42b308266 (patch)
tree922c3a509837a12b39290d7802e465b54b7c3348 /src/mesa
parentf329adfa497b6b2e0a125ab98a38c656a017270d (diff)
mesa/es: Validate glGetTexGen parameters in Mesa code rather than the ES wrapper
Signed-off-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/APIspec.xml8
-rw-r--r--src/mesa/main/es1_conversion.c54
-rw-r--r--src/mesa/main/texgen.c19
-rw-r--r--src/mesa/main/texgen.h3
4 files changed, 22 insertions, 62 deletions
diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml
index 02e2c9fa305..ff204fc35c5 100644
--- a/src/mesa/main/APIspec.xml
+++ b/src/mesa/main/APIspec.xml
@@ -672,14 +672,6 @@
<param name="pname" type="GLenum"/>
<vector name="params" type="GLtype *" size="dynamic"/>
</proto>
-
- <desc name="coord">
- <value name="GL_TEXTURE_GEN_STR_OES"/>
- </desc>
- <desc name="pname">
- <value name="GL_TEXTURE_GEN_MODE_OES"/>
- <desc name="params" vector_size="1" convert="false"/>
- </desc>
</template>
<template name="GetTexParameter" direction="get">
diff --git a/src/mesa/main/es1_conversion.c b/src/mesa/main/es1_conversion.c
index 6edc97bd468..851dc726bc2 100644
--- a/src/mesa/main/es1_conversion.c
+++ b/src/mesa/main/es1_conversion.c
@@ -398,63 +398,13 @@ _es_GetTexEnvxv(GLenum target, GLenum pname, GLfixed *params)
void GL_APIENTRY
_check_GetTexGenivOES(GLenum coord, GLenum pname, GLint *params)
{
- unsigned int i;
- unsigned int n_params = 1;
- GLfloat converted_params[1];
-
- switch(coord) {
- case GL_TEXTURE_GEN_STR_OES:
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glGetTexGenivOES(coord=0x%x)", coord);
- return;
- }
- switch(pname) {
- case GL_TEXTURE_GEN_MODE:
- n_params = 1;
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glGetTexGenivOES(pname=0x%x)", pname);
- return;
- }
-
- _es_GetTexGenfv(coord, pname, converted_params);
- for (i = 0; i < n_params; i++) {
- params[i] = (GLfloat) converted_params[i];
- }
+ _mesa_GetTexGeniv(coord, pname, params);
}
void GL_APIENTRY
_check_GetTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params)
{
- unsigned int i;
- unsigned int n_params = 1;
- GLfloat converted_params[1];
-
- switch(coord) {
- case GL_TEXTURE_GEN_STR_OES:
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glGetTexGenxvOES(coord=0x%x)", coord);
- return;
- }
- switch(pname) {
- case GL_TEXTURE_GEN_MODE:
- n_params = 1;
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glGetTexGenxvOES(pname=0x%x)", pname);
- return;
- }
-
- _es_GetTexGenfv(coord, pname, converted_params);
- for (i = 0; i < n_params; i++) {
- params[i] = (GLfloat) converted_params[i];
- }
+ _mesa_GetTexGeniv(coord, pname, (GLint *) params);
}
void GL_APIENTRY
diff --git a/src/mesa/main/texgen.c b/src/mesa/main/texgen.c
index 05d68915add..3788669d4ea 100644
--- a/src/mesa/main/texgen.c
+++ b/src/mesa/main/texgen.c
@@ -220,7 +220,6 @@ _mesa_TexGend(GLenum coord, GLenum pname, GLdouble param )
void GLAPIENTRY
_es_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
{
- ASSERT(coord == GL_TEXTURE_GEN_STR_OES);
_mesa_GetTexGenfv(GL_S, pname, params);
}
@@ -358,9 +357,17 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
params[0] = ENUM_TO_FLOAT(texgen->Mode);
break;
case GL_OBJECT_PLANE:
+ if (ctx->API != API_OPENGL) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(param)" );
+ return;
+ }
COPY_4V(params, texgen->ObjectPlane);
break;
case GL_EYE_PLANE:
+ if (ctx->API != API_OPENGL) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(param)" );
+ return;
+ }
COPY_4V(params, texgen->EyePlane);
break;
default:
@@ -370,7 +377,7 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
-static void GLAPIENTRY
+void GLAPIENTRY
_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
{
struct gl_texture_unit *texUnit;
@@ -396,12 +403,20 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
params[0] = texgen->Mode;
break;
case GL_OBJECT_PLANE:
+ if (ctx->API != API_OPENGL) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(param)" );
+ return;
+ }
params[0] = (GLint) texgen->ObjectPlane[0];
params[1] = (GLint) texgen->ObjectPlane[1];
params[2] = (GLint) texgen->ObjectPlane[2];
params[3] = (GLint) texgen->ObjectPlane[3];
break;
case GL_EYE_PLANE:
+ if (ctx->API != API_OPENGL) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(param)" );
+ return;
+ }
params[0] = (GLint) texgen->EyePlane[0];
params[1] = (GLint) texgen->EyePlane[1];
params[2] = (GLint) texgen->EyePlane[2];
diff --git a/src/mesa/main/texgen.h b/src/mesa/main/texgen.h
index 60a9522af88..1d13422b2db 100644
--- a/src/mesa/main/texgen.h
+++ b/src/mesa/main/texgen.h
@@ -48,6 +48,9 @@ _mesa_TexGeni( GLenum coord, GLenum pname, GLint param );
extern void GLAPIENTRY
_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params );
+extern void GLAPIENTRY
+_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params );
+
extern void
_mesa_init_texgen_dispatch(struct _glapi_table *disp);