nir: copy front interpolation when creating fake back color input
authorIlia Mirkin <imirkin@alum.mit.edu>
Sat, 8 Jul 2017 00:32:24 +0000 (20:32 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sun, 9 Jul 2017 01:27:44 +0000 (21:27 -0400)
Fixes a bunch of gl_BackColor interpolation tests that had explicit
interpolation specified on the fragment shader gl_Color.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Rob Clark <robdclark@gmail.com>
src/compiler/nir/nir_lower_two_sided_color.c

index 7d1a3bd236dbf01ad47d2754f940abd2d87020d3..90da1013ec89cbe66fabfeea058f725583e831ae 100644 (file)
@@ -46,7 +46,8 @@ typedef struct {
  */
 
 static nir_variable *
-create_input(nir_shader *shader, unsigned drvloc, gl_varying_slot slot)
+create_input(nir_shader *shader, unsigned drvloc, gl_varying_slot slot,
+             enum glsl_interp_mode interpolation)
 {
    nir_variable *var = rzalloc(shader, nir_variable);
 
@@ -56,6 +57,7 @@ create_input(nir_shader *shader, unsigned drvloc, gl_varying_slot slot)
    var->name = ralloc_asprintf(var, "in_%d", drvloc);
    var->data.index = 0;
    var->data.location = slot;
+   var->data.interpolation = interpolation;
 
    exec_list_push_tail(&shader->inputs, &var->node);
 
@@ -116,7 +118,9 @@ setup_inputs(lower_2side_state *state)
       else
          slot = VARYING_SLOT_BFC1;
 
-      state->colors[i].back = create_input(state->shader, ++maxloc, slot);
+      state->colors[i].back = create_input(
+            state->shader, ++maxloc, slot,
+            state->colors[i].front->data.interpolation);
    }
 
    return 0;