mesa/es: Validate glGetTexEnv parameters in Mesa code rather than the ES wrapper
authorIan Romanick <ian.d.romanick@intel.com>
Sat, 28 Jul 2012 00:48:30 +0000 (17:48 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 29 Aug 2012 22:09:35 +0000 (15:09 -0700)
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/main/APIspec.xml
src/mesa/main/texenv.c

index c72dcb5018f78cfbe72262f453797e6e5e4c8106..947ece20cc2109f5c288590ae6a491f6639900c0 100644 (file)
                <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">
index c2044a8c2c0ebac0111e602c3786faa9b9e5834f..f1064c5e36c203ca388217aa5b0902d418cf70bd 100644 (file)
@@ -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 {