mesa: Return 0 for GL_CURRENT_QUERY with a mismatched query target.
authorEric Anholt <eric@anholt.net>
Wed, 17 Oct 2012 00:36:42 +0000 (17:36 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 23 Oct 2012 00:36:53 +0000 (17:36 -0700)
With the previous two commits, this fixes piglit
GL_ARB_occlusion_query2/api.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/main/queryobj.c

index 735e4d1b1abc4cc3a773117f991911e66f60918c..65e8571483ab60264c127604cb22e4c6fe7fba1c 100644 (file)
@@ -532,7 +532,7 @@ _mesa_GetQueryIndexediv(GLenum target, GLuint index, GLenum pname,
          }
          break;
       case GL_CURRENT_QUERY_ARB:
-         *params = q ? q->Id : 0;
+         *params = (q && q->Target == target) ? q->Id : 0;
          break;
       default:
          _mesa_error(ctx, GL_INVALID_ENUM, "glGetQuery{Indexed}iv(pname)");