b->cursor = nir_before_instr(&intrin->instr);
+ /* Any constant-offset load_constant instructions should have been removed
+ * by constant folding.
+ */
+ assert(!nir_src_is_const(intrin->src[0]));
+
nir_ssa_def *index = nir_imm_int(b, state->constants_offset);
nir_ssa_def *offset = nir_iadd(b, nir_ssa_for_src(b, intrin->src[0], 1),
nir_imm_int(b, nir_intrinsic_base(intrin)));
struct anv_address read_addr;
uint32_t read_len;
- if (binding->set == ANV_DESCRIPTOR_SET_SHADER_CONSTANTS) {
- struct anv_address constant_data = {
- .bo = pipeline->device->dynamic_state_pool.block_pool.bo,
- .offset = pipeline->shaders[stage]->constant_data.offset,
- };
- unsigned constant_data_size =
- pipeline->shaders[stage]->constant_data_size;
-
- read_len = MIN2(range->length,
- DIV_ROUND_UP(constant_data_size, 32) - range->start);
- read_addr = anv_address_add(constant_data,
- range->start * 32);
- } else if (binding->set == ANV_DESCRIPTOR_SET_DESCRIPTORS) {
+ if (binding->set == ANV_DESCRIPTOR_SET_DESCRIPTORS) {
/* This is a descriptor set buffer so the set index is
* actually given by binding->binding. (Yes, that's
* confusing.)
read_addr = anv_address_add(desc_buffer_addr,
range->start * 32);
} else {
+ assert(binding->set < MAX_SETS);
struct anv_descriptor_set *set =
gfx_state->base.descriptors[binding->set];
const struct anv_descriptor *desc =