turnip: Add support for non-zero (still constant) UBO buffer indices.
authorEric Anholt <eric@anholt.net>
Wed, 22 Jan 2020 00:56:34 +0000 (16:56 -0800)
committerMarge Bot <eric+marge@anholt.net>
Wed, 22 Jan 2020 02:13:38 +0000 (02:13 +0000)
This was actually all ready to go at this point, and just needed to
increment by the value.

Fixes dEQP-VK.binding_model.shader_access.primary_cmd_buf.uniform_buffer.*

Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3504>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3504>

src/freedreno/vulkan/tu_shader.c

index 67374ac22cc8f44d98bea3ca46f9f67749674753..323a244e81ab61342ccc2230491cfee349b327a8 100644 (file)
@@ -243,11 +243,12 @@ lower_vulkan_resource_index(nir_builder *b, nir_intrinsic_instr *instr,
    switch (nir_intrinsic_desc_type(instr)) {
    case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
    case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
-      if (!const_val || const_val->u32 != 0)
-         tu_finishme("non-zero vulkan_resource_index array index");
+      if (!const_val)
+         tu_finishme("non-constant vulkan_resource_index array index");
       /* skip index 0 which is used for push constants */
       index = map_add(&shader->ubo_map, set, binding, 0,
                       binding_layout->array_size) + 1;
+      index += const_val->u32;
       break;
    case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
    case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: