summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>2021-04-16 11:08:46 +0300
committerEric Engestrom <eric@engestrom.ch>2021-04-18 22:13:24 +0200
commitefcedfc99e2a27b6afaad545223a794cceef3aaa (patch)
treec86b20e3a08f051a8d4ca21935f9d5f7e948f35e
parent61660ee4e091dd9686a51156ff521589c722d167 (diff)
anv: fix 3DSTATE_MULTISAMPLE emission on gen8+
When pipeline->dynamic_state.sample_locations.samples is not set because the state is dynamic, we're currently calling genX(emit_multisample) with a 0 samples value which is incorrect. Found when using renderdoc with the drawing overlay. Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Fixes: 4ad4cd89069bfc ("anv: Enabled the VK_EXT_sample_locations extension") Cc: <mesa-stable> Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10282> (cherry picked from commit 30bc562bdaec2efbfae4cc01548b2adbae2c0c4b)
-rw-r--r--.pick_status.json2
-rw-r--r--src/intel/vulkan/anv_pipeline.c26
-rw-r--r--src/intel/vulkan/genX_pipeline.c16
3 files changed, 23 insertions, 21 deletions
diff --git a/.pick_status.json b/.pick_status.json
index 22f320fef3a..3acabd22d7f 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -382,7 +382,7 @@
"description": "anv: fix 3DSTATE_MULTISAMPLE emission on gen8+",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "4ad4cd89069bfc98533182d2ae9151fa74fb5414"
},
diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index a598d3c15a0..a8b30274c91 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -2049,9 +2049,9 @@ copy_non_dynamic_state(struct anv_graphics_pipeline *pipeline,
}
}
+ const VkPipelineMultisampleStateCreateInfo *ms_info =
+ pCreateInfo->pMultisampleState;
if (states & ANV_CMD_DIRTY_DYNAMIC_SAMPLE_LOCATIONS) {
- const VkPipelineMultisampleStateCreateInfo *ms_info =
- pCreateInfo->pMultisampleState;
const VkPipelineSampleLocationsStateCreateInfoEXT *sl_info = ms_info ?
vk_find_struct_const(ms_info, PIPELINE_SAMPLE_LOCATIONS_STATE_CREATE_INFO_EXT) : NULL;
@@ -2064,16 +2064,18 @@ copy_non_dynamic_state(struct anv_graphics_pipeline *pipeline,
dynamic->sample_locations.locations[i].x = positions[i].x;
dynamic->sample_locations.locations[i].y = positions[i].y;
}
-
- } else {
- dynamic->sample_locations.samples =
- ms_info ? ms_info->rasterizationSamples : 1;
- const struct intel_sample_position *positions =
- intel_get_sample_positions(dynamic->sample_locations.samples);
- for (uint32_t i = 0; i < dynamic->sample_locations.samples; i++) {
- dynamic->sample_locations.locations[i].x = positions[i].x;
- dynamic->sample_locations.locations[i].y = positions[i].y;
- }
+ }
+ }
+ /* Ensure we always have valid values for sample_locations. */
+ if (pipeline->base.device->vk.enabled_extensions.EXT_sample_locations &&
+ dynamic->sample_locations.samples == 0) {
+ dynamic->sample_locations.samples =
+ ms_info ? ms_info->rasterizationSamples : 1;
+ const struct intel_sample_position *positions =
+ intel_get_sample_positions(dynamic->sample_locations.samples);
+ for (uint32_t i = 0; i < dynamic->sample_locations.samples; i++) {
+ dynamic->sample_locations.locations[i].x = positions[i].x;
+ dynamic->sample_locations.locations[i].y = positions[i].y;
}
}
diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c
index 32594192134..8e3aeef9ff2 100644
--- a/src/intel/vulkan/genX_pipeline.c
+++ b/src/intel/vulkan/genX_pipeline.c
@@ -755,16 +755,16 @@ emit_ms_state(struct anv_graphics_pipeline *pipeline,
const VkPipelineMultisampleStateCreateInfo *info,
uint32_t dynamic_states)
{
- /* 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.
+ /* 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 (!(dynamic_states & ANV_CMD_DIRTY_DYNAMIC_SAMPLE_LOCATIONS)) {
- /* 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 (pipeline->base.device->vk.enabled_extensions.EXT_sample_locations) {
+ 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,