nir/linker: Compute the offset for non-trivial uniform types.
authorAntia Puentes <apuentes@igalia.com>
Wed, 12 Sep 2018 11:51:57 +0000 (13:51 +0200)
committerAlejandro Piñeiro <apinheiro@igalia.com>
Fri, 12 Jul 2019 21:42:41 +0000 (23:42 +0200)
commitae2ea5ec1f6630c2712ad48e8e03737b7efc74e7
treec889bd6fd6d07cbd4fbdaf213d703f04a5d64879
parente15c663d8e80bd75331336ecba49ce6791d8d1fd
nir/linker: Compute the offset for non-trivial uniform types.

ARB_gl_spirv points that the offset must be explicit, however this is
true for 'root' types. For complex types, like struct members or
arrays of arraya, it needs to be computed.

We are not using the offset stored in the gl_buffer_variables during
the uniform blocks linking because currently we do not have a way to
relate a gl_buffer_variable with its corresponding gl_uniform_storage.
The GLSL path uses the name for that, but we can not rely on that
because names are optional in SPIR-V.

Notice that uniforms non-backed by a buffer object will have an offset
equal to -1, like in the GLSL path.

v2: add offset and var_is_in_block as per-variable state in
    nir_link_uniforms_state (Arcady)

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
src/compiler/glsl/gl_nir_link_uniforms.c