radv: fix resetting VRS if the graphics pipeline doesn't enable it

Otherwise the VRS state isn't reset and the graphics pipeline might
still use the previous VRS state. The VRS state will only be re-emitted
if it's different when the pipeline is bound.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9005
Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23052>
This commit is contained in:
Samuel Pitoiset 2023-05-16 12:14:24 +02:00 committed by Marge Bot
parent 9ba416cdc6
commit f1e339dfd6

View file

@ -546,7 +546,8 @@ radv_pipeline_is_blend_enabled(const struct radv_graphics_pipeline *pipeline,
}
static uint64_t
radv_pipeline_needed_dynamic_state(const struct radv_graphics_pipeline *pipeline,
radv_pipeline_needed_dynamic_state(const struct radv_device *device,
const struct radv_graphics_pipeline *pipeline,
const struct vk_graphics_pipeline_state *state)
{
bool has_color_att = radv_pipeline_has_color_attachments(state->rp);
@ -554,6 +555,9 @@ radv_pipeline_needed_dynamic_state(const struct radv_graphics_pipeline *pipeline
(pipeline->dynamic_states & RADV_DYNAMIC_RASTERIZER_DISCARD_ENABLE);
uint64_t states = RADV_DYNAMIC_ALL;
if (device->physical_device->rad_info.gfx_level < GFX10_3)
states &= ~RADV_DYNAMIC_FRAGMENT_SHADING_RATE;
/* Disable dynamic states that are useless to mesh shading. */
if (radv_pipeline_has_stage(pipeline, MESA_SHADER_MESH)) {
if (!raster_enabled)
@ -600,9 +604,6 @@ radv_pipeline_needed_dynamic_state(const struct radv_graphics_pipeline *pipeline
!state->rs->line.stipple.enable)
states &= ~RADV_DYNAMIC_LINE_STIPPLE;
if (!radv_is_vrs_enabled(pipeline, state))
states &= ~RADV_DYNAMIC_FRAGMENT_SHADING_RATE;
if (!has_color_att || !radv_pipeline_is_blend_enabled(pipeline, state->cb))
states &= ~RADV_DYNAMIC_BLEND_CONSTANTS;
@ -896,11 +897,12 @@ radv_pipeline_uses_ds_feedback_loop(const VkGraphicsPipelineCreateInfo *pCreateI
}
static void
radv_pipeline_init_dynamic_state(struct radv_graphics_pipeline *pipeline,
radv_pipeline_init_dynamic_state(const struct radv_device *device,
struct radv_graphics_pipeline *pipeline,
const struct vk_graphics_pipeline_state *state,
const VkGraphicsPipelineCreateInfo *pCreateInfo)
{
uint64_t needed_states = radv_pipeline_needed_dynamic_state(pipeline, state);
uint64_t needed_states = radv_pipeline_needed_dynamic_state(device, pipeline, state);
struct radv_dynamic_state *dynamic = &pipeline->dynamic_state;
uint64_t states = needed_states;
@ -4062,7 +4064,7 @@ radv_graphics_pipeline_init(struct radv_graphics_pipeline *pipeline, struct radv
if (!radv_pipeline_has_stage(pipeline, MESA_SHADER_MESH))
radv_pipeline_init_input_assembly_state(device, pipeline);
radv_pipeline_init_dynamic_state(pipeline, &state, pCreateInfo);
radv_pipeline_init_dynamic_state(device, pipeline, &state, pCreateInfo);
struct radv_blend_state blend = radv_pipeline_init_blend_state(pipeline, &state);