mesa: add KHR_no_error support for glActiveTexture()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 25 May 2017 10:18:45 +0000 (12:18 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 29 May 2017 08:03:11 +0000 (10:03 +0200)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mapi/glapi/gen/gl_API.xml
src/mesa/main/texstate.c
src/mesa/main/texstate.h

index 630d6b8a5bbc89995db15423d053d585c85dab0e..8f93318b95d6ee979db44d9b04935d14d0873bc2 100644 (file)
     <enum name="DOT3_RGB"                                 value="0x86AE"/>
     <enum name="DOT3_RGBA"                                value="0x86AF"/>
 
-    <function name="ActiveTexture" es1="1.0" es2="2.0">
+    <function name="ActiveTexture" es1="1.0" es2="2.0" no_error="true">
         <param name="texture" type="GLenum"/>
         <glx rop="197"/>
     </function>
index 1aac3cdbd8b394fa641e8ca7649f87a363094f56..1949ec2a849e7cd8f88c8877b0437ab68e4cfed7 100644 (file)
@@ -279,14 +279,12 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state,
 }
 
 
-
-
 /* GL_ARB_multitexture */
-void GLAPIENTRY
-_mesa_ActiveTexture(GLenum texture)
+static ALWAYS_INLINE void
+active_texture(GLenum texture, bool no_error)
 {
    const GLuint texUnit = texture - GL_TEXTURE0;
-   GLuint k;
+
    GET_CURRENT_CONTEXT(ctx);
 
    if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
@@ -296,14 +294,16 @@ _mesa_ActiveTexture(GLenum texture)
    if (ctx->Texture.CurrentUnit == texUnit)
       return;
 
-   k = _mesa_max_tex_unit(ctx);
+   if (!no_error) {
+      GLuint k = _mesa_max_tex_unit(ctx);
 
-   assert(k <= ARRAY_SIZE(ctx->Texture.Unit));
+      assert(k <= ARRAY_SIZE(ctx->Texture.Unit));
 
-   if (texUnit >= k) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glActiveTexture(texture=%s)",
-                  _mesa_enum_to_string(texture));
-      return;
+      if (texUnit >= k) {
+         _mesa_error(ctx, GL_INVALID_ENUM, "glActiveTexture(texture=%s)",
+                     _mesa_enum_to_string(texture));
+         return;
+      }
    }
 
    FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
@@ -316,6 +316,20 @@ _mesa_ActiveTexture(GLenum texture)
 }
 
 
+void GLAPIENTRY
+_mesa_ActiveTexture_no_error(GLenum texture)
+{
+   active_texture(texture, true);
+}
+
+
+void GLAPIENTRY
+_mesa_ActiveTexture(GLenum texture)
+{
+   active_texture(texture, false);
+}
+
+
 /* GL_ARB_multitexture */
 void GLAPIENTRY
 _mesa_ClientActiveTexture(GLenum texture)
index cb329b07bfb9e791471f50c10ea1b9607d59371c..7c74329a64ec68f990599e5d28e004376f3edd2e 100644 (file)
@@ -77,6 +77,9 @@ _mesa_print_texunit_state( struct gl_context *ctx, GLuint unit );
  */
 /*@{*/
 
+extern void GLAPIENTRY
+_mesa_ActiveTexture_no_error( GLenum target );
+
 extern void GLAPIENTRY
 _mesa_ActiveTexture( GLenum target );