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 <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22110>
This commit is contained in:
Samuel Pitoiset 2023-03-24 14:26:20 +01:00 committed by Marge Bot
parent 774e055823
commit 8f6998ad8a
2 changed files with 12 additions and 9 deletions

View File

@ -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

View File

@ -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 =