summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/extensions.c1
-rw-r--r--src/mesa/main/queryobj.c43
-rw-r--r--src/mesa/state_tracker/st_extensions.c1
3 files changed, 33 insertions, 12 deletions
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index f3bf5cb164b..fd5b4e915cd 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -259,6 +259,7 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
ctx->Extensions.ARB_multitexture = GL_TRUE;
#if FEATURE_queryobj
ctx->Extensions.ARB_occlusion_query = GL_TRUE;
+ ctx->Extensions.ARB_occlusion_query2 = GL_TRUE;
#endif
ctx->Extensions.ARB_point_sprite = GL_TRUE;
#if FEATURE_ARB_shader_objects
diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c
index 88743977206..ca829b09bd1 100644
--- a/src/mesa/main/queryobj.c
+++ b/src/mesa/main/queryobj.c
@@ -143,6 +143,11 @@ get_query_binding_point(struct gl_context *ctx, GLenum target)
return &ctx->Query.CurrentOcclusionObject;
else
return NULL;
+ case GL_ANY_SAMPLES_PASSED:
+ if (ctx->Extensions.ARB_occlusion_query2)
+ return &ctx->Query.CurrentOcclusionObject;
+ else
+ return NULL;
case GL_TIME_ELAPSED_EXT:
if (ctx->Extensions.EXT_timer_query)
return &ctx->Query.CurrentTimerObject;
@@ -378,12 +383,19 @@ _mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params)
if (!q->Ready)
ctx->Driver.WaitQuery(ctx, q);
/* if result is too large for returned type, clamp to max value */
- if (q->Result > 0x7fffffff) {
- *params = 0x7fffffff;
- }
- else {
- *params = (GLint)q->Result;
- }
+ if (q->Target == GL_ANY_SAMPLES_PASSED) {
+ if (q->Result)
+ *params = GL_TRUE;
+ else
+ *params = GL_FALSE;
+ } else {
+ if (q->Result > 0x7fffffff) {
+ *params = 0x7fffffff;
+ }
+ else {
+ *params = (GLint)q->Result;
+ }
+ }
break;
case GL_QUERY_RESULT_AVAILABLE_ARB:
if (!q->Ready)
@@ -418,12 +430,19 @@ _mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params)
if (!q->Ready)
ctx->Driver.WaitQuery(ctx, q);
/* if result is too large for returned type, clamp to max value */
- if (q->Result > 0xffffffff) {
- *params = 0xffffffff;
- }
- else {
- *params = (GLuint)q->Result;
- }
+ if (q->Target == GL_ANY_SAMPLES_PASSED) {
+ if (q->Result)
+ *params = GL_TRUE;
+ else
+ *params = GL_FALSE;
+ } else {
+ if (q->Result > 0xffffffff) {
+ *params = 0xffffffff;
+ }
+ else {
+ *params = (GLuint)q->Result;
+ }
+ }
break;
case GL_QUERY_RESULT_AVAILABLE_ARB:
if (!q->Ready)
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 51a45a7d511..62c9ce7273d 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -343,6 +343,7 @@ void st_init_extensions(struct st_context *st)
if (screen->get_param(screen, PIPE_CAP_OCCLUSION_QUERY)) {
ctx->Extensions.ARB_occlusion_query = GL_TRUE;
+ ctx->Extensions.ARB_occlusion_query2 = GL_TRUE;
}
if (screen->get_param(screen, PIPE_CAP_TIMER_QUERY)) {
ctx->Extensions.EXT_timer_query = GL_TRUE;