diff options
author | Roland Scheidegger <[email protected]> | 2006-03-03 02:46:03 +0000 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2006-03-03 02:46:03 +0000 |
commit | 5e01f9a11489079d8509927774d8239c1857224a (patch) | |
tree | b3780c9ab7518c1a79b7cb74a61bd6c05f2c8f44 | |
parent | f4ab5654d0a460736465edb420f78297c4e2be3b (diff) |
Fix bogus span mask in s_atifragshader.c leading to trouble when the pixel was later discarded by z test (this fixes doom3 r200 renderpath with swrast). Fix calling _swrast_alpha_test potentially leading to bogus results when Alpha Test might not be enabled. While here, don't disable deferred_texture (early z) when ATI_fragment_shader is active, as it is not necessary (for the record, this boosts doom3 swrast performance by roughly a factor of 2 (4 seconds per frame now...) with the r200 render path, might be a worthwile optimization for fragment programs which don't write z).
-rw-r--r-- | src/mesa/swrast/s_atifragshader.c | 5 | ||||
-rw-r--r-- | src/mesa/swrast/s_span.c | 9 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/mesa/swrast/s_atifragshader.c b/src/mesa/swrast/s_atifragshader.c index 36ada5fa304..08640e146b5 100644 --- a/src/mesa/swrast/s_atifragshader.c +++ b/src/mesa/swrast/s_atifragshader.c @@ -593,10 +593,11 @@ _swrast_exec_fragment_shader(GLcontext * ctx, struct sw_span *span) if (span->array->mask[i]) { init_machine(ctx, &ctx->ATIFragmentShader.Machine, ctx->ATIFragmentShader.Current, span, i); - - if (execute_shader(ctx, shader, ~0, + /* can't really happen... */ + if (!execute_shader(ctx, shader, ~0, &ctx->ATIFragmentShader.Machine, span, i)) { span->array->mask[i] = GL_FALSE; + span->writeAll = GL_FALSE; } { diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index 0856b801ed2..c4a725fa197 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -1084,7 +1084,6 @@ _swrast_write_rgba_span( GLcontext *ctx, struct sw_span *span) const GLbitfield origArrayMask = span->arrayMask; const GLboolean deferredTexture = !(ctx->Color.AlphaEnabled || ctx->FragmentProgram._Active || - ctx->ATIFragmentShader._Enabled || ctx->ShaderObjects.CurrentProgram); ASSERT(span->primitive == GL_POINT || span->primitive == GL_LINE || @@ -1174,9 +1173,11 @@ _swrast_write_rgba_span( GLcontext *ctx, struct sw_span *span) _swrast_texture_span( ctx, span ); /* Do the alpha test */ - if (!_swrast_alpha_test(ctx, span)) { - span->arrayMask = origArrayMask; - return; + if (ctx->Color.AlphaEnabled) { + if (!_swrast_alpha_test(ctx, span)) { + span->arrayMask = origArrayMask; + return; + } } } |