diff options
author | Jonathan Marek <[email protected]> | 2019-10-06 21:42:27 -0400 |
---|---|---|
committer | Jonathan Marek <[email protected]> | 2019-10-15 07:56:20 -0400 |
commit | 37dec336766fc289f95e803710497cda6407f000 (patch) | |
tree | 7bf3d84f3447677a9d327886c9773b79eec92f64 /src/freedreno/vulkan/tu_shader.c | |
parent | ac9f0d2dd407caee306bcc695ce8c531e4325767 (diff) |
turnip: more descriptor sets
Signed-off-by: Jonathan Marek <[email protected]>
Reviewed-by: Kristian H. Kristensen <[email protected]>
Diffstat (limited to 'src/freedreno/vulkan/tu_shader.c')
-rw-r--r-- | src/freedreno/vulkan/tu_shader.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/src/freedreno/vulkan/tu_shader.c b/src/freedreno/vulkan/tu_shader.c index 8f09fbb03b9..24b4dc3e75d 100644 --- a/src/freedreno/vulkan/tu_shader.c +++ b/src/freedreno/vulkan/tu_shader.c @@ -249,24 +249,31 @@ lower_intrinsic(nir_builder *b, nir_intrinsic_instr *instr, return false; nir_const_value *const_val = nir_src_as_const_value(instr->src[0]); - if (!const_val || const_val->u32 != 0) { + if (!const_val || const_val->u32 != 0) tu_finishme("non-zero vulkan_resource_index array index"); - return false; - } - if (nir_intrinsic_desc_type(instr) != VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) { - tu_finishme("non-ubo vulkan_resource_index"); - return false; - } - unsigned index = map_add(&shader->ubo_map, - nir_intrinsic_desc_set(instr), - nir_intrinsic_binding(instr)); + unsigned set = nir_intrinsic_desc_set(instr); + unsigned binding = nir_intrinsic_binding(instr); + unsigned index = 0; + + switch (nir_intrinsic_desc_type(instr)) { + case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER: + case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC: + /* skip index 0 which is used for push constants */ + index = map_add(&shader->ubo_map, set, binding) + 1; + break; + case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER: + case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: + index = map_add(&shader->ssbo_map, set, binding); + break; + default: + tu_finishme("unsupported desc_type for vulkan_resource_index"); + break; + } - b->cursor = nir_before_instr(&instr->instr); - /* skip index 0 because ir3 treats it differently */ nir_ssa_def_rewrite_uses(&instr->dest.ssa, - nir_src_for_ssa(nir_imm_int(b, index + 1))); + nir_src_for_ssa(nir_imm_int(b, index))); nir_instr_remove(&instr->instr); return true; |