From b17a722ca3989e8563ee04cb2939f4835f8a171e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 13 Jun 2003 02:37:27 +0000 Subject: Implemented GL_ARB_occlusion_query (not 100% finalized). --- src/mesa/swrast/s_span.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/mesa/swrast/s_span.c') diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index cce69b8c439..59e89252a05 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -841,6 +841,14 @@ _swrast_write_index_span( GLcontext *ctx, struct sw_span *span) /* if we get here, something passed the depth test */ ctx->OcclusionResult = GL_TRUE; +#if FEATURE_ARB_occlusion_query + if (ctx->Occlusion.Active) { + GLuint i; + for (i = 0; i < span->end; i++) + ctx->Occlusion.PassedCounter += span->array->mask[i]; + } +#endif + /* we have to wait until after occlusion to do this test */ if (ctx->Color.DrawBuffer == GL_NONE || ctx->Color.IndexMask == 0) { /* write no pixels */ @@ -1046,6 +1054,14 @@ _swrast_write_rgba_span( GLcontext *ctx, struct sw_span *span) /* if we get here, something passed the depth test */ ctx->OcclusionResult = GL_TRUE; +#if FEATURE_ARB_occlusion_query + if (ctx->Occlusion.Active) { + GLuint i; + for (i = 0; i < span->end; i++) + ctx->Occlusion.PassedCounter += span->array->mask[i]; + } +#endif + /* can't abort span-writing until after occlusion testing */ if (colorMask == 0x0) { span->interpMask = origInterpMask; @@ -1288,6 +1304,14 @@ _swrast_write_texture_span( GLcontext *ctx, struct sw_span *span) /* if we get here, some fragments passed the depth test */ ctx->OcclusionResult = GL_TRUE; +#if FEATURE_ARB_occlusion_query + if (ctx->Occlusion.Active) { + GLuint i; + for (i = 0; i < span->end; i++) + ctx->Occlusion.PassedCounter += span->array->mask[i]; + } +#endif + /* We had to wait until now to check for glColorMask(F,F,F,F) because of * the occlusion test. */ -- cgit v1.2.3