diff --git a/src/intel/compiler/brw_compile_fs.cpp b/src/intel/compiler/brw_compile_fs.cpp index fa04f0c5121..0f4f508287b 100644 --- a/src/intel/compiler/brw_compile_fs.cpp +++ b/src/intel/compiler/brw_compile_fs.cpp @@ -960,6 +960,7 @@ brw_nir_populate_wm_prog_data(nir_shader *shader, prog_data->sample_shading = shader->info.fs.uses_sample_shading || shader->info.outputs_read; + prog_data->min_sample_shading = key->min_sample_shading; assert(key->multisample_fbo != INTEL_NEVER || key->persample_interp == INTEL_NEVER); diff --git a/src/intel/compiler/brw_compiler.h b/src/intel/compiler/brw_compiler.h index 4709dbbd393..f4adffee351 100644 --- a/src/intel/compiler/brw_compiler.h +++ b/src/intel/compiler/brw_compiler.h @@ -360,6 +360,9 @@ struct brw_wm_prog_key { struct brw_base_prog_key base; uint64_t input_slots_valid; + + float min_sample_shading; + uint8_t color_outputs_valid; /* Some collection of BRW_WM_IZ_* */ @@ -395,7 +398,7 @@ struct brw_wm_prog_key { bool coarse_pixel:1; bool null_push_constant_tbimr_workaround:1; - uint64_t padding:33; + uint64_t padding:1; }; static inline bool diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c index fbc94cf08a6..fae5b5f0044 100644 --- a/src/intel/vulkan/anv_cmd_buffer.c +++ b/src/intel/vulkan/anv_cmd_buffer.c @@ -767,7 +767,6 @@ void anv_CmdBindPipeline( cmd_buffer->state.gfx.vs_source_hash = new_pipeline->vs_source_hash; cmd_buffer->state.gfx.fs_source_hash = new_pipeline->fs_source_hash; - cmd_buffer->state.gfx.min_sample_shading = new_pipeline->min_sample_shading; cmd_buffer->state.gfx.sample_shading_enable = new_pipeline->sample_shading_enable; cmd_buffer->state.gfx.instance_multiplier = new_pipeline->instance_multiplier; cmd_buffer->state.gfx.primitive_id_index = new_pipeline->primitive_id_index; diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index d5b84e3a439..d9d17dbc989 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -564,6 +564,8 @@ populate_wm_prog_key(struct anv_pipeline_stage *stage, key->mesh_input = is_mesh; + key->min_sample_shading = ms ? ms->min_sample_shading : 1.0f; + /* Vulkan doesn't support fixed-function alpha test */ key->alpha_test_replicate_alpha = false; @@ -1569,6 +1571,7 @@ anv_pipeline_compile_fs(const struct brw_compiler *compiler, struct anv_graphics_base_pipeline *pipeline, uint32_t view_mask, bool use_primitive_replication, + const struct vk_multisample_state *ms, char **error_str) { /* When using Primitive Replication for multiview, each view gets its own @@ -2519,7 +2522,7 @@ anv_graphics_pipeline_compile(struct anv_graphics_base_pipeline *pipeline, anv_pipeline_compile_fs(compiler, stage_ctx, device, stage, prev_stage, pipeline, view_mask, use_primitive_replication, - &error_str); + state->ms, &error_str); break; default: UNREACHABLE("Invalid graphics shader stage"); @@ -2917,10 +2920,8 @@ anv_graphics_pipeline_emit(struct anv_graphics_pipeline *pipeline, /* TODO(mesh): Mesh vs. Multiview with Instancing. */ } - if (pipeline->base.shaders[MESA_SHADER_FRAGMENT] && state->ms) { + if (pipeline->base.shaders[MESA_SHADER_FRAGMENT] && state->ms) pipeline->sample_shading_enable = state->ms->sample_shading_enable; - pipeline->min_sample_shading = state->ms->min_sample_shading; - } /* Mark all color output as unused by default */ memset(pipeline->color_output_mapping, diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 52b914d3a43..8ae6e5b71a9 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -4123,7 +4123,6 @@ struct anv_cmd_graphics_state { bool kill_pixel; bool uses_xfb; bool sample_shading_enable; - float min_sample_shading; uint32_t primitive_id_index; uint32_t first_vue_slot; @@ -5096,7 +5095,6 @@ struct anv_graphics_pipeline { bool kill_pixel; bool uses_xfb; bool sample_shading_enable; - float min_sample_shading; /* Number of VERTEX_ELEMENT_STATE input elements used by the shader */ uint32_t vs_input_elements; diff --git a/src/intel/vulkan/genX_gfx_state.c b/src/intel/vulkan/genX_gfx_state.c index 57a1792a9fc..83753371c99 100644 --- a/src/intel/vulkan/genX_gfx_state.c +++ b/src/intel/vulkan/genX_gfx_state.c @@ -841,7 +841,7 @@ update_fs_msaa_flags(struct anv_gfx_dynamic_state *hw_state, enum intel_msaa_flags fs_msaa_flags = intel_fs_msaa_flags((struct intel_fs_params) { .shader_sample_shading = wm_prog_data->sample_shading, - .shader_min_sample_shading = gfx->min_sample_shading, + .shader_min_sample_shading = wm_prog_data->min_sample_shading, .state_sample_shading = gfx->sample_shading_enable, .rasterization_samples = dyn->ms.rasterization_samples, .coarse_pixel = !vk_fragment_shading_rate_is_disabled(&dyn->fsr),