aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-08-01 16:02:37 -0700
committerEric Anholt <[email protected]>2014-08-11 14:45:31 -0700
commit99070c6daad72c96d517ffb18185c8b21b9d67f2 (patch)
tree9401b172b6e430ce5115297aba63e333a7daae26 /src/gallium/drivers
parent4160ac5ee41630a5c9fc4e1f3520f0fabf42cb14 (diff)
vc4: Add proper translation from Zc to Zs for vertex output.
This fixes the remaining failure in depthfunc.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/vc4/vc4_program.c16
-rw-r--r--src/gallium/drivers/vc4/vc4_qir.h3
2 files changed, 18 insertions, 1 deletions
diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index 963e6eb3b44..82526300879 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -778,7 +778,14 @@ emit_zs_write(struct tgsi_to_qir *trans, struct qreg rcp_w)
{
struct qcompile *c = trans->c;
- qir_VPM_WRITE(c, qir_FMUL(c, trans->outputs[2], rcp_w));
+ struct qreg zscale = add_uniform(trans, QUNIFORM_VIEWPORT_Z_SCALE, 0);
+ struct qreg zoffset = add_uniform(trans, QUNIFORM_VIEWPORT_Z_OFFSET, 0);
+
+ qir_VPM_WRITE(c, qir_FMUL(c, qir_FADD(c, qir_FMUL(c,
+ trans->outputs[2],
+ zscale),
+ zoffset),
+ rcp_w));
}
static void
@@ -1241,6 +1248,13 @@ vc4_write_uniforms(struct vc4_context *vc4, struct vc4_compiled_shader *shader,
-16.0f / 2.0f));
break;
+ case QUNIFORM_VIEWPORT_Z_OFFSET:
+ cl_u32(&vc4->uniforms, fui(vc4->viewport.translate[2]));
+ break;
+ case QUNIFORM_VIEWPORT_Z_SCALE:
+ cl_u32(&vc4->uniforms, fui(vc4->viewport.scale[2]));
+ break;
+
case QUNIFORM_TEXTURE_CONFIG_P0:
write_texture_p0(vc4, texstate, uinfo->data[i]);
break;
diff --git a/src/gallium/drivers/vc4/vc4_qir.h b/src/gallium/drivers/vc4/vc4_qir.h
index b578e7e0b9e..5d1f088ee37 100644
--- a/src/gallium/drivers/vc4/vc4_qir.h
+++ b/src/gallium/drivers/vc4/vc4_qir.h
@@ -140,6 +140,9 @@ enum quniform_contents {
QUNIFORM_VIEWPORT_Y_SCALE,
/** @} */
+ QUNIFORM_VIEWPORT_Z_OFFSET,
+ QUNIFORM_VIEWPORT_Z_SCALE,
+
/**
* A reference to a texture config parameter 0 uniform.
*