cmd_buffer->state.descriptors_dirty |=
set_layout->shader_stages & VK_SHADER_STAGE_ALL_GRAPHICS;
}
+
+ /* Pipeline layout objects are required to live at least while any command
+ * buffers that use them are in recording state. We need to grab a reference
+ * to the pipeline layout being bound here so we can compute correct dynamic
+ * offsets for VK_DESCRIPTOR_TYPE_*_DYNAMIC in dynamic_offset_for_binding()
+ * when we record draw commands that come after this.
+ */
+ pipe_state->layout = layout;
}
void anv_CmdBindDescriptorSets(
*/
struct anv_cmd_pipeline_state {
struct anv_pipeline *pipeline;
+ struct anv_pipeline_layout *layout;
struct anv_descriptor_set *descriptors[MAX_SETS];
uint32_t dynamic_offsets[MAX_DYNAMIC_BUFFERS];
static uint32_t
dynamic_offset_for_binding(const struct anv_cmd_pipeline_state *pipe_state,
- const struct anv_pipeline *pipeline,
const struct anv_pipeline_binding *binding)
{
assert(binding->set < MAX_SETS);
pipe_state->descriptors[binding->set];
uint32_t dynamic_offset_idx =
- pipeline->layout->set[binding->set].dynamic_offset_start +
+ pipe_state->layout->set[binding->set].dynamic_offset_start +
set->layout->binding[binding->binding].dynamic_offset_index +
binding->index;
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: {
/* Compute the offset within the buffer */
uint32_t dynamic_offset =
- dynamic_offset_for_binding(pipe_state, pipeline, binding);
+ dynamic_offset_for_binding(pipe_state, binding);
uint64_t offset = desc->offset + dynamic_offset;
/* Clamp to the buffer size */
offset = MIN2(offset, desc->buffer->size);
assert(desc->type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC);
uint32_t dynamic_offset =
- dynamic_offset_for_binding(&gfx_state->base,
- pipeline, binding);
+ dynamic_offset_for_binding(&gfx_state->base, binding);
uint32_t buf_offset =
MIN2(desc->offset + dynamic_offset, desc->buffer->size);
uint32_t buf_range =