glspirv: Enable the new deref-base UBO/SSBO path on gl_spirv
authorAlejandro Piñeiro <apinheiro@igalia.com>
Sat, 29 Dec 2018 14:08:50 +0000 (15:08 +0100)
committerArcady Goldmints-Orlov <agoldmints@igalia.com>
Sun, 30 Jun 2019 21:58:27 +0000 (16:58 -0500)
Among other things, it supports arrays of arrays of UBO/SSBO (default
codepath doesn't).

Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
v2: nir_address_format_vk_index_offset got renamed to
    nir_address_format_32bit_index_offset (after rebase against master)

v3: the ptr_type fields in spirv_to_nir_options got changed to be of
    type nir_address_format.

v4: remove phys_ssbo_addr_format and push_const_addr_format as they are
    not used by glspirv

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
src/mesa/main/glspirv.c

index 9faaad33628eb535aa5a16a0647b85bbfbee72c4..9d767a108ed4213caac7d9f9073f36f74e130a59 100644 (file)
@@ -211,8 +211,16 @@ _mesa_spirv_to_nir(struct gl_context *ctx,
    const struct spirv_to_nir_options spirv_options = {
       .environment = NIR_SPIRV_OPENGL,
       .lower_workgroup_access_to_offsets = true,
-      .lower_ubo_ssbo_access_to_offsets = true,
-      .caps = ctx->Const.SpirVCapabilities
+      .caps = ctx->Const.SpirVCapabilities,
+      .ubo_addr_format = nir_address_format_32bit_index_offset,
+      .ssbo_addr_format = nir_address_format_32bit_index_offset,
+
+      /* TODO: Consider changing this to an address format that has the NULL
+       * pointer equals to 0.  That might be a better format to play nice
+       * with certain code / code generators.
+       */
+      .shared_addr_format = nir_address_format_32bit_offset,
+
    };
 
    nir_shader *nir =