mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 02:28:10 +02:00
radv: clear color attachments without exports before compaction
For PS epilogs, this isn't necessary because spi_shader_col_format is already cleared. This will help for implementing color attachment remapping because colors_written is always the original mapping. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28781>
This commit is contained in:
parent
68a91242dc
commit
74615bb704
3 changed files with 8 additions and 9 deletions
|
|
@ -1876,7 +1876,7 @@ radv_emit_ps_epilog_state(struct radv_cmd_buffer *cmd_buffer, struct radv_shader
|
||||||
if (cmd_buffer->state.emitted_ps_epilog == ps_epilog)
|
if (cmd_buffer->state.emitted_ps_epilog == ps_epilog)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint32_t col_format = radv_compact_spi_shader_col_format(ps_shader, ps_epilog->spi_shader_col_format);
|
uint32_t col_format = radv_compact_spi_shader_col_format(ps_epilog->spi_shader_col_format);
|
||||||
|
|
||||||
bool need_null_export_workaround = radv_needs_null_export_workaround(device, ps_shader, 0);
|
bool need_null_export_workaround = radv_needs_null_export_workaround(device, ps_shader, 0);
|
||||||
if (need_null_export_workaround && !col_format)
|
if (need_null_export_workaround && !col_format)
|
||||||
|
|
|
||||||
|
|
@ -170,16 +170,11 @@ format_is_float32(VkFormat format)
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
radv_compact_spi_shader_col_format(const struct radv_shader *ps, uint32_t spi_shader_col_format)
|
radv_compact_spi_shader_col_format(uint32_t spi_shader_col_format)
|
||||||
{
|
{
|
||||||
unsigned value = 0, num_mrts = 0;
|
unsigned value = 0, num_mrts = 0;
|
||||||
unsigned i, num_targets;
|
unsigned i, num_targets;
|
||||||
|
|
||||||
/* Make sure to clear color attachments without exports because MRT holes are removed during
|
|
||||||
* compilation for optimal performance.
|
|
||||||
*/
|
|
||||||
spi_shader_col_format &= ps->info.ps.colors_written;
|
|
||||||
|
|
||||||
/* Compute the number of MRTs. */
|
/* Compute the number of MRTs. */
|
||||||
num_targets = DIV_ROUND_UP(util_last_bit(spi_shader_col_format), 4);
|
num_targets = DIV_ROUND_UP(util_last_bit(spi_shader_col_format), 4);
|
||||||
|
|
||||||
|
|
@ -4072,7 +4067,11 @@ radv_graphics_pipeline_init(struct radv_graphics_pipeline *pipeline, struct radv
|
||||||
struct radv_shader *ps = pipeline->base.shaders[MESA_SHADER_FRAGMENT];
|
struct radv_shader *ps = pipeline->base.shaders[MESA_SHADER_FRAGMENT];
|
||||||
bool enable_mrt_compaction = ps && !ps->info.has_epilog && !ps->info.ps.mrt0_is_dual_src;
|
bool enable_mrt_compaction = ps && !ps->info.has_epilog && !ps->info.ps.mrt0_is_dual_src;
|
||||||
if (enable_mrt_compaction) {
|
if (enable_mrt_compaction) {
|
||||||
blend.spi_shader_col_format = radv_compact_spi_shader_col_format(ps, blend.spi_shader_col_format);
|
/* Make sure to clear color attachments without exports because MRT holes are removed during
|
||||||
|
* compilation for optimal performance.
|
||||||
|
*/
|
||||||
|
blend.spi_shader_col_format =
|
||||||
|
radv_compact_spi_shader_col_format(blend.spi_shader_col_format & ps->info.ps.colors_written);
|
||||||
|
|
||||||
/* In presence of MRT holes (ie. the FS exports MRT1 but not MRT0), the compiler will remap
|
/* In presence 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
|
* them, so that only MRT0 is exported and the driver will compact SPI_SHADER_COL_FORMAT to
|
||||||
|
|
|
||||||
|
|
@ -541,7 +541,7 @@ bool radv_pipeline_has_gs_copy_shader(const struct radv_pipeline *pipeline);
|
||||||
void radv_blend_remove_dst(VkBlendOp *func, VkBlendFactor *src_factor, VkBlendFactor *dst_factor,
|
void radv_blend_remove_dst(VkBlendOp *func, VkBlendFactor *src_factor, VkBlendFactor *dst_factor,
|
||||||
VkBlendFactor expected_dst, VkBlendFactor replacement_src);
|
VkBlendFactor expected_dst, VkBlendFactor replacement_src);
|
||||||
|
|
||||||
unsigned radv_compact_spi_shader_col_format(const struct radv_shader *ps, uint32_t spi_shader_col_format);
|
unsigned radv_compact_spi_shader_col_format(uint32_t spi_shader_col_format);
|
||||||
|
|
||||||
unsigned radv_format_meta_fs_key(struct radv_device *device, VkFormat format);
|
unsigned radv_format_meta_fs_key(struct radv_device *device, VkFormat format);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue