mesa/es: Validate glClear mask in Mesa code rather than the ES wrapper
authorIan Romanick <ian.d.romanick@intel.com>
Tue, 20 Sep 2011 23:39:30 +0000 (16:39 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 29 Aug 2012 22:09:34 +0000 (15:09 -0700)
src/mesa/main/APIspec.xml
src/mesa/main/clear.c

index 1de7014c5bcfd5033357001bdcaa29af691fa410..44dcd21007892f09b93296cfbc8ecff8d3e0bb5b 100644 (file)
                <return type="void"/>
                <param name="mask" type="GLbitfield"/>
        </proto>
-
-       <desc name="mask" error="GL_INVALID_VALUE">
-               <value name="0"/>
-               <value name="(GL_COLOR_BUFFER_BIT)"/>
-               <value name="(GL_DEPTH_BUFFER_BIT)"/>
-               <value name="(GL_STENCIL_BUFFER_BIT)"/>
-               <value name="(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)"/>
-               <value name="(GL_COLOR_BUFFER_BIT|GL_STENCIL_BUFFER_BIT)"/>
-               <value name="(GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT)"/>
-               <value name="(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT)"/>
-       </desc>
 </template>
 
 <template name="ClearColor">
index cfb060018c7ca5634e6f946eaad4dd51d156d28c..f07d5333b65783e14bbd1943a9daafab8ecb699a 100644 (file)
@@ -167,6 +167,15 @@ _mesa_Clear( GLbitfield mask )
       return;
    }
 
+   /* Accumulation buffers were removed in core contexts, and they never
+    * existed in OpenGL ES.
+    */
+   if ((mask & GL_ACCUM_BUFFER_BIT) != 0
+       && (ctx->API == API_OPENGL_CORE || _mesa_is_gles(ctx))) {
+      _mesa_error( ctx, GL_INVALID_VALUE, "glClear(GL_ACCUM_BUFFER_BIT)");
+      return;
+   }
+
    if (ctx->NewState) {
       _mesa_update_state( ctx );       /* update _Xmin, etc */
    }