[Mesa-dev] [PATCH 03/11] mesa: Return INVALID_ENUM in glClearBufferiv() when buffer is not color or stencil

Eduardo Lima Mitev elima at igalia.com
Tue Feb 10 07:40:40 PST 2015


Section 4.2.3 Clearing the Buffers, page 190 of the OpenGL ES 3.0.4 spec says:
"ClearBufferiv generates an INVALID_ENUM error if buffer is not COLOR or STENCIL."

Fixes 1 dEQP test:
* dEQP-GLES3.functional.negative_api.buffer.clear_bufferiv
---
 src/mesa/main/clear.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c
index 3c4ced8..46de80b 100644
--- a/src/mesa/main/clear.c
+++ b/src/mesa/main/clear.c
@@ -323,6 +323,19 @@ _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
       _mesa_update_state( ctx );
    }
 
+   /* Section 4.2.3 Clearing the Buffers, page 190 of the OpenGL ES 3.0.4
+    * spec says:
+    *
+    *    "ClearBufferiv generates an INVALID_ENUM error if buffer is not COLOR or
+    *     STENCIL."
+    */
+   if (_mesa_is_gles3(ctx) &&
+       (buffer == GL_DEPTH || buffer == GL_DEPTH_STENCIL)) {
+      _mesa_error(ctx, GL_INVALID_ENUM,
+                  "glClearBufferiv(buffer=GL_DEPTH || GL_DEPTH_STENCIL)");
+      return;
+   }
+
    switch (buffer) {
    case GL_STENCIL:
       /* Page 264 (page 280 of the PDF) of the OpenGL 3.0 spec says:
-- 
2.1.3



More information about the mesa-dev mailing list