From 6f4feafd4d22beaabfb0202e66b0dea9047ee084 Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 28 Oct 2011 14:48:08 +0200 Subject: mesa git update 28 okt 2011 --- mesalib/src/glsl/ir.cpp | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'mesalib/src/glsl/ir.cpp') diff --git a/mesalib/src/glsl/ir.cpp b/mesalib/src/glsl/ir.cpp index d968890a2..ef7300e65 100644 --- a/mesalib/src/glsl/ir.cpp +++ b/mesalib/src/glsl/ir.cpp @@ -1320,7 +1320,7 @@ ir_swizzle::variable_referenced() const ir_variable::ir_variable(const struct glsl_type *type, const char *name, ir_variable_mode mode) : max_array_access(0), read_only(false), centroid(false), invariant(false), - mode(mode), interpolation(ir_var_smooth) + mode(mode), interpolation(INTERP_QUALIFIER_NONE) { this->ir_type = ir_type_variable; this->type = type; @@ -1343,9 +1343,10 @@ const char * ir_variable::interpolation_string() const { switch (this->interpolation) { - case ir_var_smooth: return "smooth"; - case ir_var_flat: return "flat"; - case ir_var_noperspective: return "noperspective"; + case INTERP_QUALIFIER_NONE: return "no"; + case INTERP_QUALIFIER_SMOOTH: return "smooth"; + case INTERP_QUALIFIER_FLAT: return "flat"; + case INTERP_QUALIFIER_NOPERSPECTIVE: return "noperspective"; } assert(!"Should not get here."); @@ -1353,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) { -- cgit v1.2.3