Module: Mesa
Branch: main
Commit: 25f067ef4c8b611d5702598d1cbfb8a625d36048
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=25f067ef4c8b611d5702598d1cbfb8a625d36048

Author: Samuel Pitoiset <[email protected]>
Date:   Wed Jan  4 14:27:08 2023 +0100

radv: adjust CB_SHADER_MASK right after SPI_SHADER_COL_FORMAT is compacted

This is a cleanup.

Signed-off-by: Samuel Pitoiset <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20517>

---

 src/amd/vulkan/radv_pipeline.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index de616cfa6d6..cc2555c6e20 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -5284,6 +5284,13 @@ radv_graphics_pipeline_init(struct 
radv_graphics_pipeline *pipeline, struct radv
    bool enable_mrt_compaction = !key.ps.epilog.mrt0_is_dual_src && 
!ps->info.ps.has_epilog;
    if (enable_mrt_compaction) {
       blend.spi_shader_col_format = radv_compact_spi_shader_col_format(ps, 
&blend);
+
+      /* In presense of MRT holes (ie. the FS exports MRT1 but not MRT0), the 
compiler will remap
+       * them, so that only MRT0 is exported and the driver will compact 
SPI_SHADER_COL_FORMAT to
+       * match what the FS actually exports. Though, to make sure the hw 
remapping works as
+       * expected, we should also clear color attachments without exports in 
CB_SHADER_MASK.
+       */
+      blend.cb_shader_mask &= ps->info.ps.colors_written;
    }
 
    /* Ensure that some export memory is always allocated, for two reasons:
@@ -5309,15 +5316,6 @@ radv_graphics_pipeline_init(struct 
radv_graphics_pipeline *pipeline, struct radv
       }
    }
 
-   if (enable_mrt_compaction) {
-      /* In presense of MRT holes (ie. the FS exports MRT1 but not MRT0), the 
compiler will remap
-       * them, so that only MRT0 is exported and the driver will compact 
SPI_SHADER_COL_FORMAT to
-       * match what the FS actually exports. Though, to make sure the hw 
remapping works as
-       * expected, we should also clear color attachments without exports in 
CB_SHADER_MASK.
-       */
-      blend.cb_shader_mask &= ps->info.ps.colors_written;
-   }
-
    if (radv_pipeline_has_stage(pipeline, MESA_SHADER_GEOMETRY) && 
!radv_pipeline_has_ngg(pipeline)) {
       struct radv_shader *gs = pipeline->base.shaders[MESA_SHADER_GEOMETRY];
 

Reply via email to