nir/lower_two_sided_color: Use nir_variable_create
authorJason Ekstrand <jason@jlekstrand.net>
Tue, 21 Jul 2020 16:18:29 +0000 (11:18 -0500)
committerMarge Bot <eric+marge@anholt.net>
Wed, 29 Jul 2020 17:38:58 +0000 (17:38 +0000)
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>

src/compiler/nir/nir_lower_two_sided_color.c

index 700d759d27fb204efa821bfd9d3dfcad27825ba2..aa0d9fe84b20b1bd90eda59630b986aca5fda9d6 100644 (file)
@@ -51,18 +51,15 @@ static nir_variable *
 create_input(nir_shader *shader, gl_varying_slot slot,
              enum glsl_interp_mode interpolation)
 {
-   nir_variable *var = rzalloc(shader, nir_variable);
+   nir_variable *var = nir_variable_create(shader, nir_var_shader_in,
+                                           glsl_vec4_type(), NULL);
 
    var->data.driver_location = shader->num_inputs++;
-   var->type = glsl_vec4_type();
-   var->data.mode = nir_var_shader_in;
    var->name = ralloc_asprintf(var, "in_%d", var->data.driver_location);
    var->data.index = 0;
    var->data.location = slot;
    var->data.interpolation = interpolation;
 
-   exec_list_push_tail(&shader->inputs, &var->node);
-
    return var;
 }
 
@@ -74,18 +71,14 @@ create_face_input(nir_shader *shader)
          return var;
    }
 
-   nir_variable *var = rzalloc(shader, nir_variable);
+   nir_variable *var = nir_variable_create(shader, nir_var_shader_in,
+                                           glsl_bool_type(), "gl_FrontFacing");
 
    var->data.driver_location = shader->num_inputs++;
-   var->type = glsl_bool_type();
-   var->data.mode = nir_var_shader_in;
-   var->name = "gl_FrontFacing";
    var->data.index = 0;
    var->data.location = VARYING_SLOT_FACE;
    var->data.interpolation = INTERP_MODE_FLAT;
 
-   exec_list_push_tail(&shader->inputs, &var->node);
-
    return var;
 }