[Mesa-dev] [PATCH 20/20] mesa/es: Validate glGetTexEnv parameters in Mesa code rather than the ES wrapper

Ian Romanick idr at freedesktop.org
Fri Aug 24 08:47:04 PDT 2012


From: Ian Romanick <ian.d.romanick at intel.com>

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/main/APIspec.xml |   82 ---------------------------------------------
 src/mesa/main/texenv.c    |   10 +++---
 2 files changed, 5 insertions(+), 87 deletions(-)

diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml
index c72dcb5..947ece2 100644
--- a/src/mesa/main/APIspec.xml
+++ b/src/mesa/main/APIspec.xml
@@ -432,88 +432,6 @@
 		<param name="pname" type="GLenum"/>
 		<vector name="params" type="GLtype *" size="dynamic"/>
 	</proto>
-
-	<desc name="target" category="OES_point_sprite">
-		<value name="GL_POINT_SPRITE_OES"/>
-		<desc name="pname">
-			<value name="GL_COORD_REPLACE_OES"/>
-		</desc>
-	</desc>
-
-	<desc name="pname" category="OES_point_sprite">
-		<value name="GL_COORD_REPLACE_OES"/>
-		<desc name="params" vector_size="1" convert="false"/>
-	</desc>
-
-	<desc name="target" category="EXT_texture_lod_bias">
-		<value name="GL_TEXTURE_FILTER_CONTROL_EXT"/>
-
-		<desc name="pname">
-			<value name="GL_TEXTURE_LOD_BIAS_EXT"/>
-		</desc>
-	</desc>
-
-	<desc name="pname" category="EXT_texture_lod_bias">
-		<value name="GL_TEXTURE_LOD_BIAS_EXT"/>
-		<desc name="params" vector_size="1"/>
-	</desc>
-
-	<desc name="target">
-		<value name="GL_TEXTURE_ENV"/>
-
-		<desc name="pname">
-			<value name="GL_TEXTURE_ENV_COLOR"/>
-			<value name="GL_RGB_SCALE"/>
-			<value name="GL_ALPHA_SCALE"/>
-			<value name="GL_TEXTURE_ENV_MODE"/>
-			<value name="GL_COMBINE_RGB"/>
-			<value name="GL_COMBINE_ALPHA"/>
-			<value name="GL_SRC0_RGB"/>
-			<value name="GL_SRC1_RGB"/>
-			<value name="GL_SRC2_RGB"/>
-			<value name="GL_SRC0_ALPHA"/>
-			<value name="GL_SRC1_ALPHA"/>
-			<value name="GL_SRC2_ALPHA"/>
-			<value name="GL_OPERAND0_RGB"/>
-			<value name="GL_OPERAND1_RGB"/>
-			<value name="GL_OPERAND2_RGB"/>
-			<value name="GL_OPERAND0_ALPHA"/>
-			<value name="GL_OPERAND1_ALPHA"/>
-			<value name="GL_OPERAND2_ALPHA"/>
-		</desc>
-	</desc>
-
-	<desc name="pname">
-		<value name="GL_TEXTURE_ENV_COLOR"/>
-		<desc name="params" vector_size="4"/>
-	</desc>
-
-	<desc name="pname">
-		<value name="GL_RGB_SCALE"/>
-		<value name="GL_ALPHA_SCALE"/>
-
-		<desc name="params" vector_size="1"/>
-	</desc>
-
-	<desc name="pname">
-		<value name="GL_TEXTURE_ENV_MODE"/>
-		<value name="GL_COMBINE_RGB"/>
-		<value name="GL_COMBINE_ALPHA"/>
-		<value name="GL_SRC0_RGB"/>
-		<value name="GL_SRC1_RGB"/>
-		<value name="GL_SRC2_RGB"/>
-		<value name="GL_SRC0_ALPHA"/>
-		<value name="GL_SRC1_ALPHA"/>
-		<value name="GL_SRC2_ALPHA"/>
-		<value name="GL_OPERAND0_RGB"/>
-		<value name="GL_OPERAND1_RGB"/>
-		<value name="GL_OPERAND2_RGB"/>
-		<value name="GL_OPERAND0_ALPHA"/>
-		<value name="GL_OPERAND1_ALPHA"/>
-		<value name="GL_OPERAND2_ALPHA"/>
-
-		<desc name="params" vector_size="1" convert="false"/>
-	</desc>
 </template>
 
 <template name="GetTexGen" direction="get">
diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c
index c2044a8..f1064c5 100644
--- a/src/mesa/main/texenv.c
+++ b/src/mesa/main/texenv.c
@@ -588,7 +588,7 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit,
       return texUnit->Combine.SourceRGB[rgb_idx];
    }
    case GL_SOURCE3_RGB_NV:
-      if (ctx->Extensions.NV_texture_env_combine4) {
+      if (ctx->API == API_OPENGL && ctx->Extensions.NV_texture_env_combine4) {
          return texUnit->Combine.SourceRGB[3];
       }
       else {
@@ -602,7 +602,7 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit,
       return texUnit->Combine.SourceA[alpha_idx];
    }
    case GL_SOURCE3_ALPHA_NV:
-      if (ctx->Extensions.NV_texture_env_combine4) {
+      if (ctx->API == API_OPENGL && ctx->Extensions.NV_texture_env_combine4) {
          return texUnit->Combine.SourceA[3];
       }
       else {
@@ -616,7 +616,7 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit,
       return texUnit->Combine.OperandRGB[op_rgb];
    }
    case GL_OPERAND3_RGB_NV:
-      if (ctx->Extensions.NV_texture_env_combine4) {
+      if (ctx->API == API_OPENGL && ctx->Extensions.NV_texture_env_combine4) {
          return texUnit->Combine.OperandRGB[3];
       }
       else {
@@ -630,7 +630,7 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit,
       return texUnit->Combine.OperandA[op_alpha];
    }
    case GL_OPERAND3_ALPHA_NV:
-      if (ctx->Extensions.NV_texture_env_combine4) {
+      if (ctx->API == API_OPENGL && ctx->Extensions.NV_texture_env_combine4) {
          return texUnit->Combine.OperandA[3];
       }
       else {
@@ -643,7 +643,7 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit,
       return 1 << texUnit->Combine.ScaleShiftA;
    case GL_BUMP_TARGET_ATI:
       /* spec doesn't say so, but I think this should be queryable */
-      if (ctx->Extensions.ATI_envmap_bumpmap) {
+      if (ctx->API == API_OPENGL && ctx->Extensions.ATI_envmap_bumpmap) {
          return texUnit->BumpTarget;
       }
       else {
-- 
1.7.6.5



More information about the mesa-dev mailing list