} binding_table;
uint32_t *map_entries;
- uint32_t *bind_map[8]; /* MAX_SETS from vulkan/private.h */
+ struct {
+ uint32_t index_count;
+ uint32_t *index;
+ } bind_map[8]; /* MAX_SETS from vulkan/private.h */
GLuint nr_params; /**< number of float params/constants */
GLuint nr_pull_params;
uint32_t set = shader->base.UniformBlocks[index].Set;
uint32_t binding = shader->base.UniformBlocks[index].Binding;
- surf_index = fs_reg(stage_prog_data->bind_map[set][binding]);
+ /* FIXME: We should probably assert here, but dota2 seems to hit
+ * it and we'd like to keep going.
+ */
+ if (binding >= stage_prog_data->bind_map[set].index_count)
+ binding = 0;
+
+ surf_index = fs_reg(stage_prog_data->bind_map[set].index[binding]);
} else {
assert(0 && "need more info from the ir for this.");
/* The block index is not a constant. Evaluate the index expression
fs_visitor::nir_emit_texture(nir_tex_instr *instr)
{
uint32_t set = instr->sampler_set;
- uint32_t index = instr->sampler_index;
- unsigned sampler = stage_prog_data->bind_map[set][index];
+ uint32_t binding = instr->sampler_index;
+
+ assert(binding < stage_prog_data->bind_map[set].index_count);
+ assert(stage_prog_data->bind_map[set].index[binding] < 1000);
+
+ unsigned sampler = stage_prog_data->bind_map[set].index[binding];
fs_reg sampler_reg(sampler);
/* FINISHME: We're failing to recompile our programs when the sampler is
index = const_uniform_block->value.u[0];
set = shader->base.UniformBlocks[index].Set;
set_index = shader->base.UniformBlocks[index].Binding;
- binding = stage_prog_data->bind_map[set][set_index];
+ binding = stage_prog_data->bind_map[set].index[set_index];
surf_index = fs_reg(binding);
} else {
assert(0 && "need more info from the ir for this.");
assert(deref_var);
ir_variable *var = deref_var->var;
- sampler = stage_prog_data->bind_map[var->data.set][var->data.index];
+ sampler = stage_prog_data->bind_map[var->data.set].index[var->data.index];
ir_rvalue *nonconst_sampler_index =
_mesa_get_sampler_array_nonconst_index(ir->sampler);
k = bias;
map = prog_data->map_entries;
for (uint32_t i = 0; i < layout->num_sets; i++) {
- prog_data->bind_map[i] = map;
+ prog_data->bind_map[i].index = map;
for (uint32_t j = 0; j < layout->set[i].layout->stage[stage].surface_count; j++)
*map++ = k++;
+
+ prog_data->bind_map[i].index_count =
+ layout->set[i].layout->stage[stage].surface_count;
}
return VK_SUCCESS;