broadcom/vc5: Fix depth and stencil clear values.
authorEric Anholt <eric@anholt.net>
Thu, 28 Sep 2017 18:41:31 +0000 (11:41 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 10 Oct 2017 18:42:05 +0000 (11:42 -0700)
I had misread the packet description: We always have a 32f depth, and a
separate u8 stencil.

src/broadcom/cle/v3d_packet_v33.xml
src/gallium/drivers/vc5/vc5_context.h
src/gallium/drivers/vc5/vc5_draw.c
src/gallium/drivers/vc5/vc5_rcl.c

index 82709c3cd63cef1cad95d35220203648fd7cea5c..bbfe0a991db479816a5f12b4b099194efee5ae46 100644 (file)
   <packet code="121" name="Tile Rendering Mode Configuration (Z Stencil Clear Values)" cl="R">
     <field name="unused" size="16" start="48" type="uint"/>
 
-    <field name="Z/S Clear Value" size="32" start="16" type="uint"/>
+    <field name="Z Clear Value" size="32" start="16" type="float"/>
 
     <field name="Stencil/VG Mask Clear Value" size="8" start="8" type="uint"/>
     <field name="sub-id" size="4" start="0" type="uint" default="3"/>
index cac623adf26ba6a815b77061e906e6a689829ee3..472f039859661ffdd71f9fd41e27405dac562019 100644 (file)
@@ -245,7 +245,8 @@ struct vc5_job {
          */
         uint32_t resolve;
         uint32_t clear_color[2];
-        uint32_t clear_zs; /**< 24-bit unorm depth/stencil */
+        float clear_z;
+        uint8_t clear_s;
 
         /**
          * Set if some drawing (triangles, blits, or just a glClear()) has
index 555e822a719a2fe65e49a9a13af85e1defeeadbc..b7f8a7819f8bd12d3510af1854d203e88a951b12 100644 (file)
@@ -561,21 +561,15 @@ vc5_clear(struct pipe_context *pctx, unsigned buffers,
                 rsc->initialized_buffers |= (buffers & PIPE_CLEAR_COLOR0);
         }
 
-        if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
+        unsigned zsclear = buffers & PIPE_CLEAR_DEPTHSTENCIL;
+        if (zsclear) {
                 struct vc5_resource *rsc =
                         vc5_resource(vc5->framebuffer.zsbuf->texture);
-                unsigned zsclear = buffers & PIPE_CLEAR_DEPTHSTENCIL;
 
-                if (buffers & PIPE_CLEAR_DEPTH) {
-                        job->clear_zs |=
-                                util_pack_z_stencil(PIPE_FORMAT_S8_UINT_Z24_UNORM,
-                                                    depth, 0);
-                }
-                if (buffers & PIPE_CLEAR_STENCIL) {
-                        job->clear_zs |=
-                                util_pack_z_stencil(PIPE_FORMAT_S8_UINT_Z24_UNORM,
-                                                    0, stencil);
-                }
+                if (zsclear & PIPE_CLEAR_DEPTH)
+                        job->clear_z = depth;
+                if (zsclear & PIPE_CLEAR_STENCIL)
+                        job->clear_s = stencil;
 
                 rsc->initialized_buffers |= zsclear;
         }
index e55a29772e0cc64c7ad3c3e6aed3561ffb84fb1e..ebc77dcce06051b346f1c0a19fc34f126b291d52 100644 (file)
@@ -182,7 +182,8 @@ vc5_emit_rcl(struct vc5_job *job)
         /* Ends rendering mode config. */
         cl_emit(&job->rcl, TILE_RENDERING_MODE_CONFIGURATION_Z_STENCIL_CLEAR_VALUES,
                 clear) {
-                clear.z_s_clear_value = job->clear_zs;
+                clear.z_clear_value = job->clear_z;
+                clear.stencil_vg_mask_clear_value = job->clear_s;
         };
 
         /* Always set initial block size before the first branch, which needs