summaryrefslogtreecommitdiff
path: root/src/mesa/main/queryobj.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2010-09-12 06:31:30 +1000
committerDave Airlie <airlied@redhat.com>2010-12-18 17:33:25 +1000
commitff7aa554a11863de2c4c0b4b6d1ec7b07c819739 (patch)
treee11ce96768871fe6c3d5dcdbb46e94ec62d3ec49 /src/mesa/main/queryobj.c
parent7048095513f8e91db26736eee0343b1a00d18f6f (diff)
mesa/swrast/st: add ARB_occlusion_query2 support.
This gets my vote for most pointless extension of all time, I'm guessing some driver could possibly optimise for this instead of counting it might just get a true/false, but I'm not really sure. need this to eventually advertise 3.3 despite its total uselessness. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/mesa/main/queryobj.c')
-rw-r--r--src/mesa/main/queryobj.c43
1 files changed, 31 insertions, 12 deletions
diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c
index 8874397720..ca829b09bd 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)