summaryrefslogtreecommitdiffstats
path: root/src/glsl/ir.cpp
diff options
context:
space:
mode:
authorPaul Berry <[email protected]>2011-10-21 07:55:48 -0700
committerPaul Berry <[email protected]>2011-10-27 15:31:32 -0700
commitbaf7f99fd7a092a1390b7a145e09caa5325a8116 (patch)
treefc8bea32687da29cacf8ec581e69446bf67bfcfd /src/glsl/ir.cpp
parentc488150dea083a9677429b4185c6b20d7facd52b (diff)
glsl: add ir_variable::determine_interpolation_mode() function.
This function determines how a variable should be interpolated based both on interpolation qualifiers and the current shade model. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/glsl/ir.cpp')
-rw-r--r--src/glsl/ir.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index 9aad0fcd42f..ef7300e6535 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -1354,6 +1354,21 @@ ir_variable::interpolation_string() const
}
+glsl_interp_qualifier
+ir_variable::determine_interpolation_mode(bool flat_shade)
+{
+ if (this->interpolation != INTERP_QUALIFIER_NONE)
+ return (glsl_interp_qualifier) this->interpolation;
+ int location = this->location;
+ bool is_gl_Color =
+ location == FRAG_ATTRIB_COL0 || location == FRAG_ATTRIB_COL1;
+ if (flat_shade && is_gl_Color)
+ return INTERP_QUALIFIER_FLAT;
+ else
+ return INTERP_QUALIFIER_SMOOTH;
+}
+
+
ir_function_signature::ir_function_signature(const glsl_type *return_type)
: return_type(return_type), is_defined(false), _function(NULL)
{