From: Eric Anholt Date: Fri, 7 Nov 2014 22:26:32 +0000 (-0800) Subject: vc4: Fix assumption of TGSI OUT[0] being POSITION in the VS. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=acc1cca7ae35e9e7fb55b4c05fd80564253e1634;p=mesa.git vc4: Fix assumption of TGSI OUT[0] being POSITION in the VS. All the shaders we've received so far had this be the case, but with nir-to-tgsi that changed. I might decide to make nir-to-tgsi keep the outputs in the same order, for debugging sanity, but I'm not sure. --- diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c index 72bbcd865bc..1cc6e9615b4 100644 --- a/src/gallium/drivers/vc4/vc4_program.c +++ b/src/gallium/drivers/vc4/vc4_program.c @@ -1751,7 +1751,7 @@ emit_scaled_viewport_write(struct vc4_compile *c, struct qreg rcp_w) xyi[i] = qir_FTOI(c, qir_FMUL(c, qir_FMUL(c, - c->outputs[i], + c->outputs[c->output_position_index + i], scale), rcp_w)); } @@ -1766,7 +1766,7 @@ emit_zs_write(struct vc4_compile *c, struct qreg rcp_w) struct qreg zoffset = add_uniform(c, QUNIFORM_VIEWPORT_Z_OFFSET, 0); qir_VPM_WRITE(c, qir_FMUL(c, qir_FADD(c, qir_FMUL(c, - c->outputs[2], + c->outputs[c->output_position_index + 2], zscale), zoffset), rcp_w)); @@ -1863,7 +1863,7 @@ emit_vert_end(struct vc4_compile *c, struct vc4_varying_semantic *fs_inputs, uint32_t num_fs_inputs) { - struct qreg rcp_w = qir_RCP(c, c->outputs[3]); + struct qreg rcp_w = qir_RCP(c, c->outputs[c->output_position_index + 3]); emit_stub_vpm_read(c); emit_ucp_clipdistance(c); @@ -1900,12 +1900,12 @@ emit_vert_end(struct vc4_compile *c, static void emit_coord_end(struct vc4_compile *c) { - struct qreg rcp_w = qir_RCP(c, c->outputs[3]); + struct qreg rcp_w = qir_RCP(c, c->outputs[c->output_position_index + 3]); emit_stub_vpm_read(c); for (int i = 0; i < 4; i++) - qir_VPM_WRITE(c, c->outputs[i]); + qir_VPM_WRITE(c, c->outputs[c->output_position_index + i]); emit_scaled_viewport_write(c, rcp_w); emit_zs_write(c, rcp_w);