glsl: copy the how_declared field when converting to nir
authorTimothy Arceri <tarceri@itsqueeze.com>
Tue, 22 Oct 2019 00:29:47 +0000 (11:29 +1100)
committerTimothy Arceri <tarceri@itsqueeze.com>
Fri, 13 Dec 2019 00:07:19 +0000 (00:07 +0000)
This is needed to make use of nir_build_program_resource_list().

Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
src/compiler/glsl/glsl_to_nir.cpp

index dadcf69a5398d82dae112175a59d29d7d96e50bc..a70fadc4b1c81bcb2b60e8c2ab27cf4b2976f452 100644 (file)
@@ -410,6 +410,15 @@ wrap_type_in_array(const glsl_type *elem_type, const glsl_type *array_type)
    return glsl_type::get_array_instance(elem_type, array_type->length);
 }
 
+static unsigned
+get_nir_how_declared(unsigned how_declared)
+{
+   if (how_declared == ir_var_hidden)
+      return nir_var_hidden;
+
+   return nir_var_declared_normally;
+}
+
 void
 nir_visitor::visit(ir_variable *ir)
 {
@@ -435,6 +444,7 @@ nir_visitor::visit(ir_variable *ir)
    var->data.centroid = ir->data.centroid;
    var->data.sample = ir->data.sample;
    var->data.patch = ir->data.patch;
+   var->data.how_declared = get_nir_how_declared(ir->data.how_declared);
    var->data.invariant = ir->data.invariant;
    var->data.location = ir->data.location;
    var->data.stream = ir->data.stream;