diff options
author | Brian <brian@yutani.localnet.net> | 2007-04-19 11:21:14 -0600 |
---|---|---|
committer | Brian <brian@yutani.localnet.net> | 2007-04-19 11:21:14 -0600 |
commit | 8e6207396c6314d07614c80670f4e3196e3a8551 (patch) | |
tree | 75d8a493bd14e2bc1569f28ac72af27d705415e9 /src/mesa | |
parent | 5ca8d4ccf24af1c174ff791f15cf9f19defd9b7e (diff) |
Don't allow deferredTexture if using occlusion query and a frag shader.
Occlusion query might depend on the shader killing/discarding fragments.
Helps fix depth peeling technique.
Also, minor tweaks in interpolate_wpos().
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/swrast/s_span.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index c6efea3075..f3b7998618 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -776,6 +776,9 @@ interpolate_wpos(GLcontext *ctx, SWspan *span) { GLfloat (*wpos)[4] = span->array->attribs[FRAG_ATTRIB_WPOS]; GLuint i; + const GLfloat zScale = 1.0 / ctx->DrawBuffer->_DepthMaxF; + GLfloat w, dw; + if (span->arrayMask & SPAN_XY) { for (i = 0; i < span->end; i++) { wpos[i][0] = (GLfloat) span->array->x[i]; @@ -788,10 +791,13 @@ interpolate_wpos(GLcontext *ctx, SWspan *span) wpos[i][1] = (GLfloat) span->y; } } + + w = span->attrStart[FRAG_ATTRIB_WPOS][3]; + dw = span->attrStepX[FRAG_ATTRIB_WPOS][3]; for (i = 0; i < span->end; i++) { - wpos[i][2] = (GLfloat) span->array->z[i] / ctx->DrawBuffer->_DepthMaxF; - wpos[i][3] = span->attrStart[FRAG_ATTRIB_WPOS][3] - + i * span->attrStepX[FRAG_ATTRIB_WPOS][3]; + wpos[i][2] = (GLfloat) span->array->z[i] * zScale; + wpos[i][3] = w; + w += dw; } } @@ -1401,7 +1407,10 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span) ASSERT((span->interpMask & span->arrayMask) == 0); ASSERT((span->interpMask & SPAN_RGBA) ^ (span->arrayMask & SPAN_RGBA)); - /* check for conditions that prevent deferred shading */ + /* check for conditions that prevent deferred shading (doing shading + * after stencil/ztest). + * XXX move this code into state validation. + */ if (ctx->Color.AlphaEnabled) { /* alpha test depends on post-texture/shader colors */ deferredTexture = GL_FALSE; @@ -1413,6 +1422,10 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span) /* Z comes from fragment program/shader */ deferredTexture = GL_FALSE; } + else if (ctx->Query.CurrentOcclusionObject) { + /* occlusion query depends on shader discard/kill results */ + deferredTexture = GL_FALSE; + } else { deferredTexture = GL_TRUE; } |