summaryrefslogtreecommitdiff
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2005-08-27 13:56:08 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2005-08-27 13:56:08 +0000
commit23ffc3a85d6172f8a98d17d7f23610bab808d84e (patch)
tree07211e0ccdc4f3418d8e434b39c43d80894e1077 /src/mesa/swrast
parentca1ac986a1d6d3f292e3d20540de884ad08d9816 (diff)
Rearrange the code related to GL_ARB_occlusion_object to generalize query
objects for future types of queries.
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_context.c2
-rw-r--r--src/mesa/swrast/s_span.c10
-rw-r--r--src/mesa/swrast/s_triangle.c23
3 files changed, 19 insertions, 16 deletions
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 5ca3f382e5..93f0c75969 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -80,7 +80,7 @@ _swrast_update_rasterflags( GLcontext *ctx )
rasterMask |= CLIP_BIT;
}
- if (ctx->Occlusion.Active)
+ if (ctx->Query.CurrentOcclusionObject)
rasterMask |= OCCLUSION_BIT;
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index d2cafeb7ac..f99fa4cbaf 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -850,11 +850,12 @@ _swrast_write_index_span( GLcontext *ctx, struct sw_span *span)
}
#if FEATURE_ARB_occlusion_query
- if (ctx->Occlusion.Active) {
+ if (ctx->Query.CurrentOcclusionObject) {
/* update count of 'passed' fragments */
+ struct gl_query_object *q = ctx->Query.CurrentOcclusionObject;
GLuint i;
for (i = 0; i < span->end; i++)
- ctx->Occlusion.PassedCounter += span->array->mask[i];
+ q->Result += span->array->mask[i];
}
#endif
@@ -1215,11 +1216,12 @@ _swrast_write_rgba_span( GLcontext *ctx, struct sw_span *span)
}
#if FEATURE_ARB_occlusion_query
- if (ctx->Occlusion.Active) {
+ if (ctx->Query.CurrentOcclusionObject) {
/* update count of 'passed' fragments */
+ struct gl_query_object *q = ctx->Query.CurrentOcclusionObject;
GLuint i;
for (i = 0; i < span->end; i++)
- ctx->Occlusion.PassedCounter += span->array->mask[i];
+ q->Result += span->array->mask[i];
}
#endif
diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c
index 6649d1a51f..29134d02e9 100644
--- a/src/mesa/swrast/s_triangle.c
+++ b/src/mesa/swrast/s_triangle.c
@@ -904,14 +904,15 @@ fast_persp_span(GLcontext *ctx, struct sw_span *span,
*/
#define NAME occlusion_zless_triangle
#define INTERP_Z 1
-#define SETUP_CODE \
- struct gl_renderbuffer *rb \
- = ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; \
- ASSERT(ctx->Depth.Test); \
- ASSERT(!ctx->Depth.Mask); \
- ASSERT(ctx->Depth.Func == GL_LESS); \
- if (!ctx->Occlusion.Active) { \
- return; \
+#define SETUP_CODE \
+ struct gl_renderbuffer *rb \
+ = ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; \
+ struct gl_query_object *q = ctx->Query.CurrentOcclusionObject; \
+ ASSERT(ctx->Depth.Test); \
+ ASSERT(!ctx->Depth.Mask); \
+ ASSERT(ctx->Depth.Func == GL_LESS); \
+ if (!q) { \
+ return; \
}
#define RENDER_SPAN( span ) \
if (ctx->Visual.depthBits <= 16) { \
@@ -921,7 +922,7 @@ fast_persp_span(GLcontext *ctx, struct sw_span *span,
for (i = 0; i < span.end; i++) { \
GLdepth z = FixedToDepth(span.z); \
if (z < zRow[i]) { \
- ctx->Occlusion.PassedCounter++; \
+ q->Result++; \
} \
span.z += span.zStep; \
} \
@@ -932,7 +933,7 @@ fast_persp_span(GLcontext *ctx, struct sw_span *span,
rb->GetPointer(ctx, rb, span.x, span.y); \
for (i = 0; i < span.end; i++) { \
if ((GLuint)span.z < zRow[i]) { \
- ctx->Occlusion.PassedCounter++; \
+ q->Result++; \
} \
span.z += span.zStep; \
} \
@@ -1055,7 +1056,7 @@ _swrast_choose_triangle( GLcontext *ctx )
}
/* special case for occlusion testing */
- if (ctx->Occlusion.Active &&
+ if (ctx->Query.CurrentOcclusionObject &&
ctx->Depth.Test &&
ctx->Depth.Mask == GL_FALSE &&
ctx->Depth.Func == GL_LESS &&