Mesa (master): vc4: Fix viewport handling in the uniforms upload.

Eric Anholt anholt at kemper.freedesktop.org
Mon Aug 18 22:28:04 UTC 2014


Module: Mesa
Branch: master
Commit: a538bab0659c3bd5ed1da068c11b211cf65d6610
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a538bab0659c3bd5ed1da068c11b211cf65d6610

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Aug 18 12:46:24 2014 -0700

vc4: Fix viewport handling in the uniforms upload.

I had the right viewports in vc4_emit.c, but grabbed the wrong values in
the uniform setup, so primitives would claim to be in the wrong parts of
the screen.  (The vc4_emit.c state looks like it just decides how big the
clipping guardband is).

This gets fbo-viewport closer to working (which still has the problem that
the HW is always guard-band clipping), and fixes inverted FBO rendering in
general.

---

 src/gallium/drivers/vc4/vc4_program.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index 24f7620..f7791ab 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -1474,12 +1474,10 @@ vc4_write_uniforms(struct vc4_context *vc4, struct vc4_compiled_shader *shader,
                                gallium_uniforms[uinfo->data[i]]);
                         break;
                 case QUNIFORM_VIEWPORT_X_SCALE:
-                        cl_f(&vc4->uniforms,
-                             vc4->framebuffer.width * 16.0f / 2.0f);
+                        cl_f(&vc4->uniforms, vc4->viewport.scale[0] * 16.0f);
                         break;
                 case QUNIFORM_VIEWPORT_Y_SCALE:
-                        cl_f(&vc4->uniforms,
-                             vc4->framebuffer.height * -16.0f / 2.0f);
+                        cl_f(&vc4->uniforms, vc4->viewport.scale[1] * 16.0f);
                         break;
 
                 case QUNIFORM_VIEWPORT_Z_OFFSET:




More information about the mesa-commit mailing list