Module: Mesa Branch: main Commit: 6f5f817c0fa414d23b7e843fc27237053b072a2c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6f5f817c0fa414d23b7e843fc27237053b072a2c
Author: Lionel Landwerlin <[email protected]> Date: Wed Mar 16 00:25:17 2022 +0200 anv: fix dynamic sample locations on Gen7/7.5 3DSTATE_MULTISAMPLE should be baked into the pipeline if not dynamic. Signed-off-by: Lionel Landwerlin <[email protected]> Fixes: 27ee40f4c9d8 ("anv: Add support for sample locations") Reviewed-by: Tapani Pälli <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15310> --- src/intel/vulkan/genX_pipeline.c | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c index d2c707d4a7f..1816e45a6c4 100644 --- a/src/intel/vulkan/genX_pipeline.c +++ b/src/intel/vulkan/genX_pipeline.c @@ -922,34 +922,28 @@ emit_ms_state(struct anv_graphics_pipeline *pipeline, const VkPipelineMultisampleStateCreateInfo *info, uint32_t dynamic_states) { - /* Only lookup locations if the extensions is active, otherwise the default - * ones will be used either at device initialization time or through - * 3DSTATE_MULTISAMPLE on Gfx7/7.5 by passing NULL locations. - */ - if (pipeline->base.device->vk.enabled_extensions.EXT_sample_locations) { - /* If the sample locations are dynamic, 3DSTATE_MULTISAMPLE on Gfx7/7.5 - * will be emitted dynamically, so skip it here. On Gfx8+ - * 3DSTATE_SAMPLE_PATTERN will be emitted dynamically, so skip it here. - */ - if (!(dynamic_states & ANV_CMD_DIRTY_DYNAMIC_SAMPLE_LOCATIONS)) { #if GFX_VER >= 8 - genX(emit_sample_pattern)(&pipeline->base.batch, - pipeline->dynamic_state.sample_locations.samples, - pipeline->dynamic_state.sample_locations.locations); + /* On Gfx8+ 3DSTATE_MULTISAMPLE only holds the number of samples. */ + genX(emit_multisample)(&pipeline->base.batch, + info ? info->rasterizationSamples : 1, + NULL); #endif - } + /* If EXT_sample_locations is enabled and the sample locations are not + * dynamic, then we need to emit those position in the pipeline batch. On + * Gfx8+ this is part of 3DSTATE_SAMPLE_PATTERN, prior to that this is in + * 3DSTATE_MULTISAMPLE. + */ + if (pipeline->base.device->vk.enabled_extensions.EXT_sample_locations && + !(dynamic_states & ANV_CMD_DIRTY_DYNAMIC_SAMPLE_LOCATIONS)) { +#if GFX_VER >= 8 + genX(emit_sample_pattern)(&pipeline->base.batch, + pipeline->dynamic_state.sample_locations.samples, + pipeline->dynamic_state.sample_locations.locations); +#else genX(emit_multisample)(&pipeline->base.batch, pipeline->dynamic_state.sample_locations.samples, pipeline->dynamic_state.sample_locations.locations); - } else { - /* On Gfx8+ 3DSTATE_MULTISAMPLE does not hold anything we need to modify - * for sample locations, so we don't have to emit it dynamically. - */ -#if GFX_VER >= 8 - genX(emit_multisample)(&pipeline->base.batch, - info ? info->rasterizationSamples : 1, - NULL); #endif }
