ANV_FROM_HANDLE(anv_descriptor_set, set, pDescriptorSets[i]);
set_layout = layout->set[firstSet + i].layout;
- cmd_buffer->state.descriptors[firstSet + i].set = set;
+ if (cmd_buffer->state.descriptors[firstSet + i].set != set) {
+ cmd_buffer->state.descriptors[firstSet + i].set = set;
+ cmd_buffer->state.descriptors_dirty |= set_layout->shader_stages;
+ }
+
+ if (set_layout->num_dynamic_buffers > 0) {
+ uint32_t s;
+ for_each_bit(s, set_layout->shader_stages) {
+ anv_cmd_buffer_ensure_push_constant_field(cmd_buffer, s,
+ dynamic_offsets);
+ uint32_t *offsets =
+ cmd_buffer->state.push_constants[s]->dynamic_offsets +
+ layout->set[firstSet + i].dynamic_offset_start;
- assert(set_layout->num_dynamic_buffers <
- ARRAY_SIZE(cmd_buffer->state.descriptors[0].dynamic_offsets));
- memcpy(cmd_buffer->state.descriptors[firstSet + i].dynamic_offsets,
- pDynamicOffsets + dynamic_slot,
- set_layout->num_dynamic_buffers * sizeof(*pDynamicOffsets));
+ memcpy(offsets, pDynamicOffsets + dynamic_slot,
+ set_layout->num_dynamic_buffers * sizeof(*pDynamicOffsets));
- cmd_buffer->state.descriptors_dirty |= set_layout->shader_stages;
+ }
+ cmd_buffer->state.push_constants_dirty |= set_layout->shader_stages;
- dynamic_slot += set_layout->num_dynamic_buffers;
+ dynamic_slot += set_layout->num_dynamic_buffers;
+ }
}
}
if (state.map == NULL)
return VK_ERROR_OUT_OF_DEVICE_MEMORY;
- uint32_t offset;
- if (surface_slots[b].dynamic_slot >= 0) {
- uint32_t dynamic_offset =
- d->dynamic_offsets[surface_slots[b].dynamic_slot];
-
- offset = view->offset + dynamic_offset;
- anv_fill_buffer_surface_state(cmd_buffer->device,
- state.map, view->format, offset,
- view->range - dynamic_offset);
- } else {
- offset = view->offset;
- memcpy(state.map, view->surface_state.map, 64);
- }
-
- add_surface_state_reloc(cmd_buffer, state, view->bo, offset);
+ memcpy(state.map, view->surface_state.map, 64);
+ add_surface_state_reloc(cmd_buffer, state, view->bo, view->offset);
bt_map[start + b] = state.offset;
}
#include <fcntl.h>
#include "anv_private.h"
+#include "anv_nir.h"
#include <brw_context.h>
#include <brw_wm.h> /* brw_new_shader_program is here */
num_params += MAX_PUSH_CONSTANTS_SIZE / sizeof(float);
}
+ if (pipeline->layout && pipeline->layout->stage[stage].has_dynamic_offsets)
+ num_params += MAX_DYNAMIC_BUFFERS;
+
if (num_params == 0)
return;
mem_ctx = ralloc_context(NULL);
create_params_array(pipeline, vs, &prog_data->base.base);
+ anv_nir_apply_dynamic_offsets(pipeline, vs->Program->nir,
+ &prog_data->base.base);
GLbitfield64 outputs_written = vp->program.Base.OutputsWritten;
prog_data->inputs_read = vp->program.Base.InputsRead;
prog_data->computed_depth_mode = computed_depth_mode(&fp->program);
create_params_array(pipeline, fs, &prog_data->base);
+ anv_nir_apply_dynamic_offsets(pipeline, fs->Program->nir, &prog_data->base);
prog_data->barycentric_interp_modes =
brw_compute_barycentric_interp_modes(brw, key->flat_shade,
set_binding_table_layout(&prog_data->base, pipeline, VK_SHADER_STAGE_COMPUTE);
create_params_array(pipeline, cs, &prog_data->base);
+ anv_nir_apply_dynamic_offsets(pipeline, cs->Program->nir, &prog_data->base);
program = brw_cs_emit(brw, mem_ctx, key, prog_data,
&cp->program, prog, &program_size);