mesa: throw error if bufSize negative in GetSynciv on OpenGL ES
authorTapani Pälli <tapani.palli@intel.com>
Fri, 7 Oct 2016 05:41:15 +0000 (08:41 +0300)
committerTapani Pälli <tapani.palli@intel.com>
Mon, 10 Oct 2016 04:29:31 +0000 (07:29 +0300)
Fixes following dEQP tests:

   dEQP-GLES31.functional.debug.negative_coverage.callbacks.state.get_synciv
   dEQP-GLES31.functional.debug.negative_coverage.get_error.state.get_synciv
   dEQP-GLES31.functional.debug.negative_coverage.log.state.get_synciv

v2: drop _mesa_is_gles check (Kenneth)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98133
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/main/syncobj.c

index be758dd1241f03fddf2f199a245cc8d2b844d5bc..a3124e400568191d57d90c31d3dd5bf2fd1915ed 100644 (file)
@@ -425,6 +425,14 @@ _mesa_GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length,
       return;
    }
 
+   /* Section 4.1.3 (Sync Object Queries) of the OpenGL ES 3.10 spec says:
+    *
+    *    "An INVALID_VALUE error is generated if bufSize is negative."
+    */
+   if (bufSize < 0) {
+      _mesa_error(ctx, GL_INVALID_VALUE, "glGetSynciv(pname=0x%x)\n", pname);
+   }
+
    if (size > 0 && bufSize > 0) {
       const GLsizei copy_count = MIN2(size, bufSize);