tu: Move RENDER_COMPONENTS setting to pipeline state
authorConnor Abbott <cwabbott0@gmail.com>
Thu, 14 May 2020 14:41:02 +0000 (16:41 +0200)
committerMarge Bot <eric+marge@anholt.net>
Thu, 14 May 2020 18:15:31 +0000 (18:15 +0000)
This needs to be pipeline state because it can change when dual-source
blending is active.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5039>

src/freedreno/vulkan/tu_cmd_buffer.c
src/freedreno/vulkan/tu_pass.c
src/freedreno/vulkan/tu_pipeline.c
src/freedreno/vulkan/tu_private.h

index fb57b97e34ac993e2ea24b770b85c71e06eabb83..b7eae22962e18699157d8219e34cc8c6dd3d857b 100644 (file)
@@ -448,11 +448,6 @@ tu6_emit_mrt(struct tu_cmd_buffer *cmd,
    tu_cs_emit_regs(cs,
                    A6XX_SP_SRGB_CNTL(.dword = subpass->srgb_cntl));
 
-   tu_cs_emit_regs(cs,
-                   A6XX_RB_RENDER_COMPONENTS(.dword = subpass->render_components));
-   tu_cs_emit_regs(cs,
-                   A6XX_SP_FS_RENDER_COMPONENTS(.dword = subpass->render_components));
-
    tu_cs_emit_regs(cs, A6XX_GRAS_MAX_LAYER_INDEX(fb->layers - 1));
 }
 
index c86d7c81ff9d1571ac80b432f6f96bfab5888b96..842a918bbaa567c2305cc8da7ee96e6d6329a532 100644 (file)
@@ -100,15 +100,12 @@ create_render_pass_common(struct tu_render_pass *pass,
       struct tu_subpass *subpass = &pass->subpasses[i];
 
       subpass->srgb_cntl = 0;
-      subpass->render_components = 0;
 
       for (uint32_t i = 0; i < subpass->color_count; ++i) {
          uint32_t a = subpass->color_attachments[i].attachment;
          if (a == VK_ATTACHMENT_UNUSED)
             continue;
 
-         subpass->render_components |= 0xf << (i * 4);
-
          if (vk_format_is_srgb(pass->attachments[a].format))
             subpass->srgb_cntl |= 1 << i;
       }
index 31ec5ee18a588e19b909b520ef282d3730860725..5882f3325f64798ed170c0198b67eb7e020efd70 100644 (file)
@@ -1322,6 +1322,8 @@ tu6_emit_fs_outputs(struct tu_cs *cs,
          fragdata_regid[i] = ir3_find_output_regid(fs, FRAG_RESULT_DATA0 + i);
    }
 
+   uint32_t render_components = (1 << (4 * mrt_count)) - 1;
+
    tu_cs_emit_pkt4(cs, REG_A6XX_SP_FS_OUTPUT_CNTL0, 2);
    tu_cs_emit(cs, A6XX_SP_FS_OUTPUT_CNTL0_DEPTH_REGID(posz_regid) |
                   A6XX_SP_FS_OUTPUT_CNTL0_SAMPMASK_REGID(smask_regid) |
@@ -1336,11 +1338,17 @@ tu6_emit_fs_outputs(struct tu_cs *cs,
                         (false ? A6XX_SP_FS_OUTPUT_REG_HALF_PRECISION : 0));
    }
 
+   tu_cs_emit_regs(cs,
+                   A6XX_SP_FS_RENDER_COMPONENTS(.dword = render_components));
+
    tu_cs_emit_pkt4(cs, REG_A6XX_RB_FS_OUTPUT_CNTL0, 2);
    tu_cs_emit(cs, COND(fs->writes_pos, A6XX_RB_FS_OUTPUT_CNTL0_FRAG_WRITES_Z) |
                   COND(fs->writes_smask, A6XX_RB_FS_OUTPUT_CNTL0_FRAG_WRITES_SAMPMASK));
    tu_cs_emit(cs, A6XX_RB_FS_OUTPUT_CNTL1_MRT(mrt_count));
 
+   tu_cs_emit_regs(cs,
+                   A6XX_RB_RENDER_COMPONENTS(.dword = render_components));
+
    uint32_t gras_su_depth_plane_cntl = 0;
    uint32_t rb_depth_plane_cntl = 0;
    if (fs->no_earlyz || fs->writes_pos) {
index 1cba064d0c837a54747f90a4f32831cb43e4d519..f1a52cbb5fd69ef89a4daded104a01a6d72c78e0 100644 (file)
@@ -1612,8 +1612,6 @@ struct tu_subpass
 
    VkSampleCountFlagBits samples;
 
-   /* pre-filled register values */
-   uint32_t render_components;
    uint32_t srgb_cntl;
 };