summaryrefslogtreecommitdiff
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2006-10-22 22:58:42 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2006-10-22 22:58:42 +0000
commit49a5a09adaac457860a8abb9d7b86f317353a23c (patch)
tree8d650e4f28aa4cbb99023c2cf686cd7b1a3ebcd8 /src/mesa/swrast
parent73dd09fdd3f644604754b84176edaef93c243509 (diff)
don't save color/z if fragment is killed
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_nvfragprog.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/mesa/swrast/s_nvfragprog.c b/src/mesa/swrast/s_nvfragprog.c
index bd9007efaf..01fa221fc6 100644
--- a/src/mesa/swrast/s_nvfragprog.c
+++ b/src/mesa/swrast/s_nvfragprog.c
@@ -53,7 +53,7 @@ struct fp_machine
GLfloat Temporaries[MAX_NV_FRAGMENT_PROGRAM_TEMPS][4];
GLfloat Inputs[MAX_NV_FRAGMENT_PROGRAM_INPUTS][4];
GLfloat Outputs[MAX_NV_FRAGMENT_PROGRAM_OUTPUTS][4];
- GLuint CondCodes[4];
+ GLuint CondCodes[4]; /**< COND_* value for x/y/z/w */
};
@@ -1521,24 +1521,26 @@ run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end)
if (span->array->mask[i]) {
init_machine(ctx, &machine, program, span, i);
- if (!execute_program(ctx, program, ~0, &machine, span, i)) {
- span->array->mask[i] = GL_FALSE; /* killed fragment */
- span->writeAll = GL_FALSE;
+ if (execute_program(ctx, program, ~0, &machine, span, i)) {
+ /* Store result color */
+ COPY_4V(span->array->color.sz4.rgba[i],
+ machine.Outputs[FRAG_RESULT_COLR]);
+
+ /* Store result depth/z */
+ if (program->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR)) {
+ const GLfloat depth = machine.Outputs[FRAG_RESULT_DEPR][2];
+ if (depth <= 0.0)
+ span->array->z[i] = 0;
+ else if (depth >= 1.0)
+ span->array->z[i] = ctx->DrawBuffer->_DepthMax;
+ else
+ span->array->z[i] = IROUND(depth * ctx->DrawBuffer->_DepthMaxF);
+ }
}
-
- /* Store result color */
- COPY_4V(span->array->color.sz4.rgba[i],
- machine.Outputs[FRAG_RESULT_COLR]);
-
- /* Store result depth/z */
- if (program->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR)) {
- const GLfloat depth = machine.Outputs[FRAG_RESULT_DEPR][2];
- if (depth <= 0.0)
- span->array->z[i] = 0;
- else if (depth >= 1.0)
- span->array->z[i] = ctx->DrawBuffer->_DepthMax;
- else
- span->array->z[i] = IROUND(depth * ctx->DrawBuffer->_DepthMaxF);
+ else {
+ /* killed fragment */
+ span->array->mask[i] = GL_FALSE;
+ span->writeAll = GL_FALSE;
}
}
}