/** @} */
} binding_table;
- uint32_t *map_entries;
- 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;
unsigned nr_image_params;
has_indirect = true;
/* fallthrough */
case nir_intrinsic_load_ubo: {
- uint32_t set = instr->const_index[0];
nir_const_value *const_index = nir_src_as_const_value(instr->src[0]);
fs_reg surf_index;
if (const_index) {
- uint32_t binding = const_index->u[0];
-
- /* 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]);
+ surf_index = fs_reg(stage_prog_data->binding_table.ubo_start +
+ const_index->u[0]);
} else {
- assert(0 && "need more info from the ir for this.");
/* The block index is not a constant. Evaluate the index expression
* per-channel and add the base UBO index; we have to select a value
* from any live channel.
BRW_REGISTER_TYPE_D),
fs_reg(2));
- unsigned vec4_offset = instr->const_index[1] / 4;
+ unsigned vec4_offset = instr->const_index[0] / 4;
for (int i = 0; i < instr->num_components; i++)
VARYING_PULL_CONSTANT_LOAD(bld, offset(dest, bld, i), surf_index,
base_offset, vec4_offset + i);
fs_reg packed_consts = vgrf(glsl_type::float_type);
packed_consts.type = dest.type;
- fs_reg const_offset_reg((unsigned) instr->const_index[1] & ~15);
+ fs_reg const_offset_reg((unsigned) instr->const_index[0] & ~15);
bld.emit(FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD, packed_consts,
surf_index, const_offset_reg);
void
fs_visitor::nir_emit_texture(const fs_builder &bld, nir_tex_instr *instr)
{
- uint32_t set = instr->sampler_set;
- 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];
+ unsigned sampler = instr->sampler_index;
fs_reg sampler_reg(sampler);
int gather_component = instr->component;
has_indirect = true;
/* fallthrough */
case nir_intrinsic_load_ubo: {
- const uint32_t set = instr->const_index[0];
nir_const_value *const_block_index = nir_src_as_const_value(instr->src[0]);
src_reg surf_index;
dest = get_nir_dest(instr->dest);
if (const_block_index) {
- uint32_t binding = const_block_index->u[0];
-
/* The block index is a constant, so just emit the binding table entry
* as an immediate.
*/
- surf_index = src_reg(stage_prog_data->bind_map[set].index[binding]);
+ surf_index = src_reg(prog_data->base.binding_table.ubo_start +
+ const_block_index->u[0]);
} else {
/* The block index is not a constant. Evaluate the index expression
* per-channel and add the base UBO index; we have to select a value
nir->info.num_ssbos - 1);
}
- unsigned const_offset = instr->const_index[1];
+ unsigned const_offset = instr->const_index[0];
src_reg offset;
if (!has_indirect) {
set_binding_table_layout(struct brw_stage_prog_data *prog_data,
struct anv_pipeline *pipeline, uint32_t stage)
{
- uint32_t bias, count, k, *map;
- struct anv_pipeline_layout *layout = pipeline->layout;
-
- /* No layout is valid for shaders that don't bind any resources. */
- if (pipeline->layout == NULL)
- return VK_SUCCESS;
-
+ unsigned bias;
if (stage == VK_SHADER_STAGE_FRAGMENT)
bias = MAX_RTS;
else
bias = 0;
- count = layout->stage[stage].surface_count;
- prog_data->map_entries =
- (uint32_t *) malloc(count * sizeof(prog_data->map_entries[0]));
- if (prog_data->map_entries == NULL)
- return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
-
- k = bias;
- map = prog_data->map_entries;
- for (uint32_t set = 0; set < layout->num_sets; set++) {
- prog_data->bind_map[set].index = map;
- unsigned index_count = 0;
- for (uint32_t b = 0; b < layout->set[set].layout->binding_count; b++) {
- if (layout->set[set].layout->binding[b].stage[stage].surface_index < 0)
- continue;
-
- unsigned array_size = layout->set[set].layout->binding[b].array_size;
- for (uint32_t i = 0; i < array_size; i++)
- *map++ = k++;
- index_count += array_size;
- }
-
- prog_data->bind_map[set].index_count = index_count;
- }
+ prog_data->binding_table.size_bytes = 0;
+ prog_data->binding_table.texture_start = bias;
+ prog_data->binding_table.ubo_start = bias;
+ prog_data->binding_table.image_start = bias;
return VK_SUCCESS;
}
{
for (uint32_t stage = 0; stage < VK_SHADER_STAGE_NUM; stage++) {
if (pipeline->prog_data[stage]) {
- free(pipeline->prog_data[stage]->map_entries);
/* We only ever set up the params array because we don't do
* non-UBO pull constants
*/