From: Jason Ekstrand Date: Mon, 25 May 2015 19:42:59 +0000 (-0700) Subject: vk/compiler: Fix up the binding hack and make it work in NIR X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=903bd4b0569dd976b127aafadcc3de8748f4a985;p=mesa.git vk/compiler: Fix up the binding hack and make it work in NIR --- diff --git a/src/glsl/link_uniform_blocks.cpp b/src/glsl/link_uniform_blocks.cpp index ca87bf0df71..c0d73076aa8 100644 --- a/src/glsl/link_uniform_blocks.cpp +++ b/src/glsl/link_uniform_blocks.cpp @@ -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++; } diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp index 9cfd0e792a2..82dbca3cf43 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp @@ -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. diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index d6bb1178f7c..07853c0d0d6 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -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 { diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 895103470ee..bd84113ea91 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -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