summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/softpipe/sp_fs_exec.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2016-03-22 07:52:26 +1000
committerDave Airlie <airlied@redhat.com>2016-03-31 09:13:54 +1000
commit493eab76792307d066489bc1d88798f14a5df31d (patch)
tree6952c1f76854e7eaefd474cd33233e77a666adad /src/gallium/drivers/softpipe/sp_fs_exec.c
parent827393b76fffa352e0ff3cae077c7817d6cfbf8a (diff)
downloadexternal_mesa3d-493eab76792307d066489bc1d88798f14a5df31d.zip
external_mesa3d-493eab76792307d066489bc1d88798f14a5df31d.tar.gz
external_mesa3d-493eab76792307d066489bc1d88798f14a5df31d.tar.bz2
softpipe: add support for explicit early depth testing
ARB_shader_image_load_store adds support for explicit early depth testing. However we need to make sure we don't overwrite values using the shader written values in this case. This fixes early depth testing in softpipe to conform with those requirements. Reviewed-by: Brian Paul <brianp@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_fs_exec.c')
-rw-r--r--src/gallium/drivers/softpipe/sp_fs_exec.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/gallium/drivers/softpipe/sp_fs_exec.c b/src/gallium/drivers/softpipe/sp_fs_exec.c
index 8941177..e2d527d 100644
--- a/src/gallium/drivers/softpipe/sp_fs_exec.c
+++ b/src/gallium/drivers/softpipe/sp_fs_exec.c
@@ -116,7 +116,8 @@ setup_pos_vector(const struct tgsi_interp_coef *coef,
static unsigned
exec_run( const struct sp_fragment_shader_variant *var,
struct tgsi_exec_machine *machine,
- struct quad_header *quad )
+ struct quad_header *quad,
+ bool early_depth_test )
{
/* Compute X, Y, Z, W vals for this quad */
setup_pos_vector(quad->posCoef,
@@ -155,16 +156,19 @@ exec_run( const struct sp_fragment_shader_variant *var,
{
uint j;
- for (j = 0; j < 4; j++)
- quad->output.depth[j] = machine->Outputs[i].xyzw[2].f[j];
+ if (!early_depth_test) {
+ for (j = 0; j < 4; j++)
+ quad->output.depth[j] = machine->Outputs[i].xyzw[2].f[j];
+ }
}
break;
case TGSI_SEMANTIC_STENCIL:
{
uint j;
-
- for (j = 0; j < 4; j++)
- quad->output.stencil[j] = (unsigned)machine->Outputs[i].xyzw[1].u[j];
+ if (!early_depth_test) {
+ for (j = 0; j < 4; j++)
+ quad->output.stencil[j] = (unsigned)machine->Outputs[i].xyzw[1].u[j];
+ }
}
break;
}