nir: Set .driver_location for GLSL UBO/SSBOs when we lower to block indices.

Without this, there's no way to match the UBO nir_variable declarations to
the load_ubo intrinsics referencing their data.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12175>
This commit is contained in:
Emma Anholt
2021-08-02 12:49:56 -07:00
committed by Marge Bot
parent f2c69f8306
commit 01759d3fb2
3 changed files with 14 additions and 4 deletions
+2 -1
View File
@@ -567,7 +567,8 @@ typedef struct nir_variable {
/**
* The actual location of the variable in the IR. Only valid for inputs,
* outputs, and uniforms (including samplers and images).
* outputs, uniforms (including samplers and images), and for UBO and SSBO
* variables in GLSL.
*/
unsigned driver_location;
@@ -135,6 +135,8 @@ nir_lower_uniforms_to_ubo(nir_shader *shader, bool dword_packed, bool load_vec4)
if (!shader->info.first_ubo_is_default_ubo) {
nir_foreach_variable_with_modes(var, shader, nir_var_mem_ubo) {
var->data.binding++;
if (var->data.driver_location != -1)
var->data.driver_location++;
/* only increment location for ubo arrays */
if (glsl_without_array(var->type) == var->interface_type &&
glsl_type_is_array(var->type))