vk/compiler: Fix up the binding hack and make it work in NIR
This commit is contained in:
@@ -294,7 +294,7 @@ link_uniform_blocks(void *mem_ctx,
|
||||
(unsigned)(ptrdiff_t)(&variables[parcel.index] - blocks[i].Uniforms);
|
||||
|
||||
blocks[i].Set = b->set;
|
||||
blocks[i].Index = b->index;
|
||||
blocks[i].Binding = b->binding;
|
||||
|
||||
i++;
|
||||
}
|
||||
@@ -315,7 +315,7 @@ link_uniform_blocks(void *mem_ctx,
|
||||
(unsigned)(ptrdiff_t)(&variables[parcel.index] - blocks[i].Uniforms);
|
||||
|
||||
blocks[i].Set = b->set;
|
||||
blocks[i].Index = b->index;
|
||||
blocks[i].Binding = b->binding;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -1399,9 +1399,13 @@ fs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
|
||||
fs_reg surf_index;
|
||||
|
||||
if (const_index) {
|
||||
surf_index = fs_reg(stage_prog_data->binding_table.ubo_start +
|
||||
const_index->u[0]);
|
||||
uint32_t index = const_index->u[0];
|
||||
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]);
|
||||
} 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.
|
||||
|
||||
@@ -1206,7 +1206,7 @@ fs_visitor::visit(ir_expression *ir)
|
||||
*/
|
||||
index = const_uniform_block->value.u[0];
|
||||
set = shader->base.UniformBlocks[index].Set;
|
||||
set_index = shader->base.UniformBlocks[index].Index;
|
||||
set_index = shader->base.UniformBlocks[index].Binding;
|
||||
binding = stage_prog_data->bind_map[set][set_index];
|
||||
surf_index = fs_reg(binding);
|
||||
} else {
|
||||
|
||||
@@ -2571,10 +2571,9 @@ struct gl_uniform_block
|
||||
GLuint Binding;
|
||||
|
||||
/**
|
||||
* Vulkan descriptor set and index qualifiers for this block.
|
||||
* Vulkan descriptor set qualifier for this block.
|
||||
*/
|
||||
GLuint Set;
|
||||
GLuint Index;
|
||||
|
||||
/**
|
||||
* Minimum size (in bytes) of a buffer object to back this uniform buffer
|
||||
|
||||
Reference in New Issue
Block a user