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. */