summaryrefslogtreecommitdiff
path: root/src/mesa/swrast/s_triangle.c
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/s_triangle.c
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/s_triangle.c')
-rw-r--r--src/mesa/swrast/s_triangle.c23
1 files changed, 12 insertions, 11 deletions
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 &&