broadcom/vc4: Switch the Viewport Center fields to a fixed-point representation.
authorEric Anholt <eric@anholt.net>
Wed, 12 Jul 2017 22:56:00 +0000 (15:56 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 25 Jul 2017 21:44:52 +0000 (14:44 -0700)
This gets us automatic CL decoding to a floating-point value, and drops a
magic number from the emit code.  250x250 shader runner tests now say they
have a center of 125.0 instead of 2000.

src/broadcom/cle/v3d_packet_v21.xml
src/gallium/drivers/vc4/vc4_emit.c

index 350cf294b514320b200e9d22802fd34248577310..b28f2b5eb6c2fdd59cfded7b338965832dc2b2c9 100644 (file)
   </packet>
 
   <packet name="Viewport Offset" code="103">
-    <field name="Viewport Centre Y-coordinate" size="16" start="16" type="int"/>
-    <field name="Viewport Centre X-coordinate" size="16" start="0" type="int"/>
+    <field name="Viewport Centre Y-coordinate" size="16" start="16" type="s12.4"/>
+    <field name="Viewport Centre X-coordinate" size="16" start="0" type="s12.4"/>
   </packet>
 
   <packet name="Z min and max clipping planes" code="104">
index d0a701f17b3515d5a9fca9d67c095d04284884bf..b45ffb75aa99ac6d5f0abe0a74c7f7279a91a0bd 100644 (file)
@@ -135,9 +135,9 @@ vc4_emit_state(struct pipe_context *pctx)
 
                 cl_emit(&job->bcl, VIEWPORT_OFFSET, vp) {
                         vp.viewport_centre_x_coordinate =
-                                16 * vc4->viewport.translate[0];
+                                vc4->viewport.translate[0];
                         vp.viewport_centre_y_coordinate =
-                                16 * vc4->viewport.translate[1];
+                                vc4->viewport.translate[1];
                 }
         }