summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/glsl_to_nir.cpp
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-02-14 12:10:32 -0800
committerJason Ekstrand <[email protected]>2015-02-14 13:47:16 -0800
commitdd110cdfd878a261ad7f2114f83f86deb35aa0fb (patch)
tree79ae02aed1a925abf169fee9835c3bd09550006c /src/glsl/nir/glsl_to_nir.cpp
parent785b22caee28892d9d995a743de1dee5434c9ce1 (diff)
nir: Make gl_FrontFacing a system_value
GLSL IR labels gl_FrontFacing as an input variable and not a system value. This commit makes NIR silently translate gl_FrontFacing to a system value so that it properly gets translated into a load_system_value intrinsic. Reviewed-by: Connor Abbott <[email protected]> Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/glsl/nir/glsl_to_nir.cpp')
-rw-r--r--src/glsl/nir/glsl_to_nir.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp
index e505a1d23b3..92cfab34a2e 100644
--- a/src/glsl/nir/glsl_to_nir.cpp
+++ b/src/glsl/nir/glsl_to_nir.cpp
@@ -242,6 +242,7 @@ nir_visitor::visit(ir_variable *ir)
var->data.centroid = ir->data.centroid;
var->data.sample = ir->data.sample;
var->data.invariant = ir->data.invariant;
+ var->data.location = ir->data.location;
switch(ir->data.mode) {
case ir_var_auto:
@@ -260,7 +261,13 @@ nir_visitor::visit(ir_variable *ir)
break;
case ir_var_shader_in:
- var->data.mode = nir_var_shader_in;
+ if (ir->data.location == VARYING_SLOT_FACE) {
+ /* For whatever reason, GLSL IR makes gl_FrontFacing an input */
+ var->data.location = SYSTEM_VALUE_FRONT_FACE;
+ var->data.mode = nir_var_system_value;
+ } else {
+ var->data.mode = nir_var_shader_in;
+ }
break;
case ir_var_shader_out:
@@ -312,7 +319,6 @@ nir_visitor::visit(ir_variable *ir)
unreachable("not reached");
}
- var->data.location = ir->data.location;
var->data.index = ir->data.index;
var->data.binding = ir->data.binding;
/* XXX Get rid of buffer_index */