[Mesa-dev] [PATCH 01/20] mesa/es: Validate glClear mask in Mesa code rather than the ES wrapper

Ian Romanick idr at freedesktop.org
Fri Aug 24 08:46:45 PDT 2012


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

---
 src/mesa/main/APIspec.xml |   11 -----------
 src/mesa/main/clear.c     |    9 +++++++++
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml
index 1de7014..44dcd21 100644
--- a/src/mesa/main/APIspec.xml
+++ b/src/mesa/main/APIspec.xml
@@ -432,17 +432,6 @@
 		<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">
diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c
index 7cc204b..1cafa1b 100644
--- a/src/mesa/main/clear.c
+++ b/src/mesa/main/clear.c
@@ -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 */
    }
-- 
1.7.6.5



More information about the mesa-dev mailing list