glsl_to_nir: update interface type properly
authorTimothy Arceri <tarceri@itsqueeze.com>
Tue, 14 Jan 2020 06:12:06 +0000 (17:12 +1100)
committerMarge Bot <eric+marge@anholt.net>
Thu, 23 Jan 2020 01:02:25 +0000 (01:02 +0000)
Since 76ba225184ed the member variable types were being redefined
but we assigned the old interface type to the variable.

In a following patch series we will use the types to check if we
are dealing with an interface instance when apply GLSL linking
rules.

Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3468>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3468>

src/compiler/glsl/glsl_to_nir.cpp

index 57c079784930d13be4aec1d8a540cdaa6bb8cb22..fdc14bfe507110ea99c4b1e82d94e1e440dddd5a 100644 (file)
@@ -539,11 +539,15 @@ nir_visitor::visit(ir_variable *ir)
    if (ir->data.memory_restrict)
       mem_access |= ACCESS_RESTRICT;
 
+   var->interface_type = ir->get_interface_type();
+
    /* For UBO and SSBO variables, we need explicit types */
    if (var->data.mode & (nir_var_mem_ubo | nir_var_mem_ssbo)) {
       const glsl_type *explicit_ifc_type =
          ir->get_interface_type()->get_explicit_interface_type(supports_std430);
 
+      var->interface_type = explicit_ifc_type;
+
       if (ir->type->without_array()->is_interface()) {
          /* If the type contains the interface, wrap the explicit type in the
           * right number of arrays.
@@ -636,8 +640,6 @@ nir_visitor::visit(ir_variable *ir)
 
    var->constant_initializer = constant_copy(ir->constant_initializer, var);
 
-   var->interface_type = ir->get_interface_type();
-
    if (var->data.mode == nir_var_function_temp)
       nir_function_impl_add_variable(impl, var);
    else