mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-27 00:10:40 +02:00
clamp result.depth to [0,1] if written to
This commit is contained in:
parent
439d59926a
commit
473f1aca7f
1 changed files with 6 additions and 1 deletions
|
|
@ -1491,7 +1491,12 @@ _swrast_exec_fragment_program( GLcontext *ctx, struct sw_span *span )
|
|||
if (program->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR)) {
|
||||
const GLfloat depth
|
||||
= ctx->FragmentProgram.Machine.Outputs[FRAG_RESULT_DEPR][2];
|
||||
span->array->z[i] = IROUND(depth * ctx->DrawBuffer->_DepthMaxF);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue