radv: adjust CB_SHADER_MASK for dual-source blending in the shader info pass
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 11 Jun 2020 15:14:27 +0000 (17:14 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 29 Jun 2020 08:43:14 +0000 (08:43 +0000)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5434>

src/amd/vulkan/radv_pipeline.c
src/amd/vulkan/radv_private.h
src/amd/vulkan/radv_shader.h
src/amd/vulkan/radv_shader_info.c

index 2816712bb2e2c62a011d13d4d8df7696fb7916ab..cb15fa350318049c5522905a935f6c7cf307f892 100644 (file)
@@ -2340,6 +2340,7 @@ radv_generate_graphics_pipeline_key(struct radv_pipeline *pipeline,
        }
 
        key.col_format = blend->spi_shader_col_format;
+       key.is_dual_src = blend->mrt0_is_dual_src;
        if (pipeline->device->physical_device->rad_info.chip_class < GFX8)
                radv_pipeline_compute_get_int_clamp(pCreateInfo, &key.is_int8, &key.is_int10);
 
@@ -2462,6 +2463,7 @@ radv_fill_shader_keys(struct radv_device *device,
        keys[MESA_SHADER_FRAGMENT].fs.is_int10 = key->is_int10;
        keys[MESA_SHADER_FRAGMENT].fs.log2_ps_iter_samples = key->log2_ps_iter_samples;
        keys[MESA_SHADER_FRAGMENT].fs.num_samples = key->num_samples;
+       keys[MESA_SHADER_FRAGMENT].fs.is_dual_src = key->is_dual_src;
 
        if (nir[MESA_SHADER_COMPUTE]) {
                keys[MESA_SHADER_COMPUTE].cs.subgroup_size = key->compute_subgroup_size;
@@ -5128,9 +5130,6 @@ radv_pipeline_init(struct radv_pipeline *pipeline,
        }
 
        blend.cb_shader_mask = ps->info.ps.cb_shader_mask;
-       if (blend.mrt0_is_dual_src) {
-               blend.cb_shader_mask |= (blend.cb_shader_mask & 0xf) << 4;
-       }
 
        if (extra &&
            (extra->custom_blend_mode == V_028808_CB_ELIMINATE_FAST_CLEAR ||
index 17d83eaaaa80815308de8b7c756467a10659e351..52790aea23c0997f116000233b9df944e2bfdf42 100644 (file)
@@ -404,6 +404,7 @@ struct radv_pipeline_key {
        uint32_t is_int10;
        uint8_t log2_ps_iter_samples;
        uint8_t num_samples;
+       bool is_dual_src;
        uint32_t has_multiview_view_index : 1;
        uint32_t optimisations_disabled : 1;
        uint8_t topology;
@@ -1688,6 +1689,7 @@ struct radv_pipeline {
                        /* Used for rbplus */
                        uint32_t col_format;
                        uint32_t cb_target_mask;
+                       bool is_dual_src;
                } graphics;
        };
 
index 7e1659add0e2e73d2091756b8f5edfca2f0e3f88..21dd5188e1a862429acbc6dbae8a99b38d1f0f31 100644 (file)
@@ -106,6 +106,7 @@ struct radv_fs_variant_key {
        uint8_t num_samples;
        uint32_t is_int8;
        uint32_t is_int10;
+       bool is_dual_src;
 };
 
 struct radv_cs_variant_key {
index d8cb194d059691c220a30a73e51688b58a30e1ed..eca46c811578c44fa102fced0c278fd26190832c 100644 (file)
@@ -857,5 +857,9 @@ radv_nir_shader_info_pass(const struct nir_shader *nir,
                                info->ps.cb_shader_mask |= 0xf << (i * 4);
                        }
                }
+
+               if (key->fs.is_dual_src) {
+                       info->ps.cb_shader_mask |= (info->ps.cb_shader_mask & 0xf) << 4;
+               }
        }
 }