summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>2021-04-13 17:53:18 +0300
committerMarge Bot <eric+marge@anholt.net>2021-04-16 11:53:25 +0000
commit505d176a8ebfb6a2c7d0b0a51753332036ae6f75 (patch)
tree3b1c36cee82799998632d2ea6656b32006e65b59
parent30bc562bdaec2efbfae4cc01548b2adbae2c0c4b (diff)
anv: disable baked in pipeline bits from dynamic emission path
In 27ee40f4c9d86e ("anv: Add support for sample locations") we introduced the ability to emit sample locations baked in as part of the pipeline or dynamically. This is different from the previous dynamic states that were always removed from the pipeline batch and instead emitted dynamically all the time. The mistake in 27ee40f4c9d86e is that sample locations are now emitted all the time, leading to bigger command buffers for unnecessary reasons. This change introduces a bit fields of what is baked in the pipeline and doesn't need to be dynamically emitted. 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>
-rw-r--r--src/intel/vulkan/anv_pipeline.c5
-rw-r--r--src/intel/vulkan/anv_private.h10
-rw-r--r--src/intel/vulkan/genX_cmd_buffer.c5
3 files changed, 20 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index a8b30274c91..654611f8a12 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -2080,6 +2080,11 @@ copy_non_dynamic_state(struct anv_graphics_pipeline *pipeline,
}
pipeline->dynamic_state_mask = states;
+
+ /* For now that only state that can be either dynamic or baked in the
+ * pipeline is the sample location.
+ */
+ pipeline->static_state_mask = states & ANV_CMD_DIRTY_DYNAMIC_SAMPLE_LOCATIONS;
}
static void
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index d42773af999..3af9a80db6c 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -3338,7 +3338,17 @@ struct anv_graphics_pipeline {
uint32_t batch_data[512];
+ /* States that are part of batch_data and should be not emitted
+ * dynamically.
+ */
+ anv_cmd_dirty_mask_t static_state_mask;
+
+ /* States that need to be reemitted in cmd_buffer_flush_dynamic_state().
+ * This might cover more than the dynamic states specified at pipeline
+ * creation.
+ */
anv_cmd_dirty_mask_t dynamic_state_mask;
+
struct anv_dynamic_state dynamic_state;
uint32_t topology;
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index 4a0d8b85f0e..11cde846a21 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -3565,6 +3565,11 @@ genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer)
if (cmd_buffer->state.gfx.dirty & ANV_CMD_DIRTY_PIPELINE) {
anv_batch_emit_batch(&cmd_buffer->batch, &pipeline->base.batch);
+ /* Remove from dynamic state emission all of stuff that is baked into
+ * the pipeline.
+ */
+ cmd_buffer->state.gfx.dirty &= ~pipeline->static_state_mask;
+
/* If the pipeline changed, we may need to re-allocate push constant
* space in the URB.
*/