From 23ffc3a85d6172f8a98d17d7f23610bab808d84e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 27 Aug 2005 13:56:08 +0000 Subject: Rearrange the code related to GL_ARB_occlusion_object to generalize query objects for future types of queries. --- src/mesa/swrast/s_triangle.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/mesa/swrast/s_triangle.c') 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 && -- cgit v1.2.3