From 89b2b0f767e2bf7bc83972c2110b9cdc6a2e1c08 Mon Sep 17 00:00:00 2001
From: Timothy Arceri <tarceri@itsqueeze.com>
Date: Tue, 22 Oct 2019 11:29:47 +1100
Subject: glsl: copy the how_declared field when converting to nir
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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 | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index dadcf69a539..a70fadc4b1c 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -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;
-- 
cgit v1.2.3