From: Samuel Pitoiset Date: Fri, 24 Mar 2023 13:26:20 +0000 (+0100) Subject: radv: separate the sample shading state between FS and graphics pipeline X-Git-Tag: upstream/23.3.3~11014 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8f6998ad8a9913d40d9820cc54398f9d02250cf0;p=platform%2Fupstream%2Fmesa.git radv: separate the sample shading state between FS and graphics pipeline Sample shading can be enabled inside the fragment shader and also per-pipeline. Separate both cases to be able to enable sample shading by only binding a FS. Signed-off-by: Samuel Pitoiset Part-of: --- diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index 9f1bd44..bfff914 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -6250,7 +6250,12 @@ static void radv_bind_multisample_state(struct radv_cmd_buffer *cmd_buffer, const struct radv_multisample_state *ms) { - cmd_buffer->state.ms = *ms; + if (ms->sample_shading_enable) { + cmd_buffer->state.ms.sample_shading_enable = true; + cmd_buffer->state.ms.min_sample_shading = ms->min_sample_shading; + } + + cmd_buffer->state.ms.uses_user_sample_locations = ms->uses_user_sample_locations; } static void @@ -6340,6 +6345,10 @@ radv_bind_fragment_shader(struct radv_cmd_buffer *cmd_buffer, const struct radv_ if (radv_get_user_sgpr(ps, AC_UD_PS_NUM_SAMPLES)->sgpr_idx != -1) { cmd_buffer->state.dirty |= RADV_CMD_DIRTY_DYNAMIC_RASTERIZATION_SAMPLES; } + + cmd_buffer->state.ms.sample_shading_enable = ps->info.ps.uses_sample_shading; + if (ps->info.ps.uses_sample_shading) + cmd_buffer->state.ms.min_sample_shading = 1.0f; } static void diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index ce57545..d42188e 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -476,15 +476,9 @@ radv_pipeline_init_multisample_state(const struct radv_device *device, * * Otherwise, sample shading is considered disabled." */ - if (pipeline->base.shaders[MESA_SHADER_FRAGMENT]->info.ps.uses_sample_shading || - (state->ms && state->ms->sample_shading_enable)) { - if (pipeline->base.shaders[MESA_SHADER_FRAGMENT]->info.ps.uses_sample_shading) { - ms->min_sample_shading = 1.0f; - } else { - ms->min_sample_shading = state->ms->min_sample_shading; - } - + if (state->ms && state->ms->sample_shading_enable) { ms->sample_shading_enable = true; + ms->min_sample_shading = state->ms->min_sample_shading; } pipeline->pa_sc_mode_cntl_1 =