summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2016-07-07 02:02:38 -0700
committerKenneth Graunke <[email protected]>2016-07-17 19:26:48 -0700
commitac1181ffbef5250cb3b651e047cce5116727c34c (patch)
treeb6aa32932d99fa3dcb15d2435ff63b662b939488 /src/compiler/glsl
parente7d96e7685e911b91ce048c6639a4c290faf5d06 (diff)
compiler: Rename INTERP_QUALIFIER_* to INTERP_MODE_*.
Likewise, rename the enum type to glsl_interp_mode. Beyond the GLSL front-end, talking about "interpolation modes" seems more natural than "interpolation qualifiers" - in the IR, we're removed from how exactly the source language specifies how to interpolate an input. Also, SPIR-V calls these "decorations" rather than "qualifiers". Generated by: $ find . -regextype egrep -regex '.*\.(c|cpp|h)' -type f -exec sed -i \ -e 's/INTERP_QUALIFIER_/INTERP_MODE_/g' \ -e 's/glsl_interp_qualifier/glsl_interp_mode/g' {} \; Signed-off-by: Kenneth Graunke <[email protected]> Acked-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r--src/compiler/glsl/ast_to_hir.cpp24
-rw-r--r--src/compiler/glsl/builtin_variables.cpp20
-rw-r--r--src/compiler/glsl/ir.cpp10
-rw-r--r--src/compiler/glsl/ir.h4
-rw-r--r--src/compiler/glsl/ir_print_visitor.cpp2
-rw-r--r--src/compiler/glsl/ir_reader.cpp6
-rw-r--r--src/compiler/glsl/ir_set_program_inouts.cpp2
-rw-r--r--src/compiler/glsl/link_varyings.cpp6
-rw-r--r--src/compiler/glsl/lower_packed_varyings.cpp6
9 files changed, 40 insertions, 40 deletions
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 8ddc084cab7..1b882900081 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -2826,7 +2826,7 @@ apply_explicit_binding(struct _mesa_glsl_parse_state *state,
static void
validate_interpolation_qualifier(struct _mesa_glsl_parse_state *state,
YYLTYPE *loc,
- const glsl_interp_qualifier interpolation,
+ const glsl_interp_mode interpolation,
const struct ast_type_qualifier *qual,
const struct glsl_type *var_type,
ir_variable_mode mode)
@@ -2855,7 +2855,7 @@ validate_interpolation_qualifier(struct _mesa_glsl_parse_state *state,
* fragment shader."
*/
if (state->is_version(130, 300)
- && interpolation != INTERP_QUALIFIER_NONE) {
+ && interpolation != INTERP_MODE_NONE) {
const char *i = interpolation_string(interpolation);
if (mode != ir_var_shader_in && mode != ir_var_shader_out)
_mesa_glsl_error(loc, state,
@@ -2893,7 +2893,7 @@ validate_interpolation_qualifier(struct _mesa_glsl_parse_state *state,
* These deprecated storage qualifiers do not exist in GLSL ES 3.00.
*/
if (state->is_version(130, 0)
- && interpolation != INTERP_QUALIFIER_NONE
+ && interpolation != INTERP_MODE_NONE
&& qual->flags.q.varying) {
const char *i = interpolation_string(interpolation);
@@ -2939,7 +2939,7 @@ validate_interpolation_qualifier(struct _mesa_glsl_parse_state *state,
*/
if (state->is_version(130, 300)
&& var_type->contains_integer()
- && interpolation != INTERP_QUALIFIER_FLAT
+ && interpolation != INTERP_MODE_FLAT
&& ((state->stage == MESA_SHADER_FRAGMENT && mode == ir_var_shader_in)
|| (state->stage == MESA_SHADER_VERTEX && mode == ir_var_shader_out
&& state->es_shader))) {
@@ -2969,7 +2969,7 @@ validate_interpolation_qualifier(struct _mesa_glsl_parse_state *state,
*/
if (state->has_double()
&& var_type->contains_double()
- && interpolation != INTERP_QUALIFIER_FLAT
+ && interpolation != INTERP_MODE_FLAT
&& state->stage == MESA_SHADER_FRAGMENT
&& mode == ir_var_shader_in) {
_mesa_glsl_error(loc, state, "if a fragment input is (or contains) "
@@ -2977,20 +2977,20 @@ validate_interpolation_qualifier(struct _mesa_glsl_parse_state *state,
}
}
-static glsl_interp_qualifier
+static glsl_interp_mode
interpret_interpolation_qualifier(const struct ast_type_qualifier *qual,
const struct glsl_type *var_type,
ir_variable_mode mode,
struct _mesa_glsl_parse_state *state,
YYLTYPE *loc)
{
- glsl_interp_qualifier interpolation;
+ glsl_interp_mode interpolation;
if (qual->flags.q.flat)
- interpolation = INTERP_QUALIFIER_FLAT;
+ interpolation = INTERP_MODE_FLAT;
else if (qual->flags.q.noperspective)
- interpolation = INTERP_QUALIFIER_NOPERSPECTIVE;
+ interpolation = INTERP_MODE_NOPERSPECTIVE;
else if (qual->flags.q.smooth)
- interpolation = INTERP_QUALIFIER_SMOOTH;
+ interpolation = INTERP_MODE_SMOOTH;
else if (state->es_shader &&
((mode == ir_var_shader_in &&
state->stage != MESA_SHADER_VERTEX) ||
@@ -3001,9 +3001,9 @@ interpret_interpolation_qualifier(const struct ast_type_qualifier *qual,
* "When no interpolation qualifier is present, smooth interpolation
* is used."
*/
- interpolation = INTERP_QUALIFIER_SMOOTH;
+ interpolation = INTERP_MODE_SMOOTH;
else
- interpolation = INTERP_QUALIFIER_NONE;
+ interpolation = INTERP_MODE_NONE;
validate_interpolation_qualifier(state, loc,
interpolation,
diff --git a/src/compiler/glsl/builtin_variables.cpp b/src/compiler/glsl/builtin_variables.cpp
index a311047dced..f63dc3a0b16 100644
--- a/src/compiler/glsl/builtin_variables.cpp
+++ b/src/compiler/glsl/builtin_variables.cpp
@@ -330,7 +330,7 @@ per_vertex_accumulator::add_field(int slot, const glsl_type *type,
this->fields[this->num_fields].matrix_layout = GLSL_MATRIX_LAYOUT_INHERITED;
this->fields[this->num_fields].location = slot;
this->fields[this->num_fields].offset = -1;
- this->fields[this->num_fields].interpolation = INTERP_QUALIFIER_NONE;
+ this->fields[this->num_fields].interpolation = INTERP_MODE_NONE;
this->fields[this->num_fields].centroid = 0;
this->fields[this->num_fields].sample = 0;
this->fields[this->num_fields].patch = 0;
@@ -1004,11 +1004,11 @@ builtin_variable_generator::generate_vs_special_vars()
}
if (state->AMD_vertex_shader_layer_enable) {
var = add_output(VARYING_SLOT_LAYER, int_t, "gl_Layer");
- var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ var->data.interpolation = INTERP_MODE_FLAT;
}
if (state->AMD_vertex_shader_viewport_index_enable) {
var = add_output(VARYING_SLOT_VIEWPORT, int_t, "gl_ViewportIndex");
- var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ var->data.interpolation = INTERP_MODE_FLAT;
}
if (compatibility) {
add_input(VERT_ATTRIB_POS, vec4_t, "gl_Vertex");
@@ -1075,10 +1075,10 @@ builtin_variable_generator::generate_gs_special_vars()
ir_variable *var;
var = add_output(VARYING_SLOT_LAYER, int_t, "gl_Layer");
- var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ var->data.interpolation = INTERP_MODE_FLAT;
if (state->is_version(410, 0) || state->ARB_viewport_array_enable) {
var = add_output(VARYING_SLOT_VIEWPORT, int_t, "gl_ViewportIndex");
- var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ var->data.interpolation = INTERP_MODE_FLAT;
}
if (state->is_version(400, 0) || state->ARB_gpu_shader5_enable)
add_system_value(SYSTEM_VALUE_INVOCATION_ID, int_t, "gl_InvocationID");
@@ -1094,9 +1094,9 @@ builtin_variable_generator::generate_gs_special_vars()
* gl_PrimitiveIDIn as an {ARB,EXT}_geometry_shader4-only variable.
*/
var = add_input(VARYING_SLOT_PRIMITIVE_ID, int_t, "gl_PrimitiveIDIn");
- var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ var->data.interpolation = INTERP_MODE_FLAT;
var = add_output(VARYING_SLOT_PRIMITIVE_ID, int_t, "gl_PrimitiveID");
- var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ var->data.interpolation = INTERP_MODE_FLAT;
}
@@ -1123,7 +1123,7 @@ builtin_variable_generator::generate_fs_special_vars()
if (state->has_geometry_shader()) {
var = add_input(VARYING_SLOT_PRIMITIVE_ID, int_t, "gl_PrimitiveID");
- var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ var->data.interpolation = INTERP_MODE_FLAT;
}
/* gl_FragColor and gl_FragData were deprecated starting in desktop GLSL
@@ -1192,9 +1192,9 @@ builtin_variable_generator::generate_fs_special_vars()
if (state->is_version(430, 0) || state->ARB_fragment_layer_viewport_enable) {
var = add_input(VARYING_SLOT_LAYER, int_t, "gl_Layer");
- var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ var->data.interpolation = INTERP_MODE_FLAT;
var = add_input(VARYING_SLOT_VIEWPORT, int_t, "gl_ViewportIndex");
- var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ var->data.interpolation = INTERP_MODE_FLAT;
}
if (state->is_version(450, 310) || state->ARB_ES3_1_compatibility_enable)
diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp
index 7961f00ffd1..b049fda3a66 100644
--- a/src/compiler/glsl/ir.cpp
+++ b/src/compiler/glsl/ir.cpp
@@ -1676,7 +1676,7 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name,
this->data.invariant = false;
this->data.how_declared = ir_var_declared_normally;
this->data.mode = mode;
- this->data.interpolation = INTERP_QUALIFIER_NONE;
+ this->data.interpolation = INTERP_MODE_NONE;
this->data.max_array_access = -1;
this->data.offset = 0;
this->data.precision = GLSL_PRECISION_NONE;
@@ -1703,10 +1703,10 @@ const char *
interpolation_string(unsigned interpolation)
{
switch (interpolation) {
- case INTERP_QUALIFIER_NONE: return "no";
- case INTERP_QUALIFIER_SMOOTH: return "smooth";
- case INTERP_QUALIFIER_FLAT: return "flat";
- case INTERP_QUALIFIER_NOPERSPECTIVE: return "noperspective";
+ case INTERP_MODE_NONE: return "no";
+ case INTERP_MODE_SMOOTH: return "smooth";
+ case INTERP_MODE_FLAT: return "flat";
+ case INTERP_MODE_NOPERSPECTIVE: return "noperspective";
}
assert(!"Should not get here.");
diff --git a/src/compiler/glsl/ir.h b/src/compiler/glsl/ir.h
index 1325e3533fe..5d93cf11f0c 100644
--- a/src/compiler/glsl/ir.h
+++ b/src/compiler/glsl/ir.h
@@ -592,7 +592,7 @@ public:
inline bool is_interpolation_flat() const
{
- return this->data.interpolation == INTERP_QUALIFIER_FLAT ||
+ return this->data.interpolation == INTERP_MODE_FLAT ||
this->type->contains_integer() ||
this->type->contains_double();
}
@@ -686,7 +686,7 @@ public:
/**
* Interpolation mode for shader inputs / outputs
*
- * \sa glsl_interp_qualifier
+ * \sa glsl_interp_mode
*/
unsigned interpolation:2;
diff --git a/src/compiler/glsl/ir_print_visitor.cpp b/src/compiler/glsl/ir_print_visitor.cpp
index e06acce782a..0dd1c3527e7 100644
--- a/src/compiler/glsl/ir_print_visitor.cpp
+++ b/src/compiler/glsl/ir_print_visitor.cpp
@@ -181,7 +181,7 @@ void ir_print_visitor::visit(ir_variable *ir)
STATIC_ASSERT(ARRAY_SIZE(mode) == ir_var_mode_count);
const char *const stream [] = {"", "stream1 ", "stream2 ", "stream3 "};
const char *const interp[] = { "", "smooth", "flat", "noperspective" };
- STATIC_ASSERT(ARRAY_SIZE(interp) == INTERP_QUALIFIER_COUNT);
+ STATIC_ASSERT(ARRAY_SIZE(interp) == INTERP_MODE_COUNT);
fprintf(f, "(%s%s%s%s%s%s%s%s%s) ",
loc, cent, samp, patc, inv, prec, mode[ir->data.mode],
diff --git a/src/compiler/glsl/ir_reader.cpp b/src/compiler/glsl/ir_reader.cpp
index 15315aac522..7deb125264f 100644
--- a/src/compiler/glsl/ir_reader.cpp
+++ b/src/compiler/glsl/ir_reader.cpp
@@ -448,11 +448,11 @@ ir_reader::read_declaration(s_expression *expr)
} else if (strcmp(qualifier->value(), "stream3") == 0) {
var->data.stream = 3;
} else if (strcmp(qualifier->value(), "smooth") == 0) {
- var->data.interpolation = INTERP_QUALIFIER_SMOOTH;
+ var->data.interpolation = INTERP_MODE_SMOOTH;
} else if (strcmp(qualifier->value(), "flat") == 0) {
- var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ var->data.interpolation = INTERP_MODE_FLAT;
} else if (strcmp(qualifier->value(), "noperspective") == 0) {
- var->data.interpolation = INTERP_QUALIFIER_NOPERSPECTIVE;
+ var->data.interpolation = INTERP_MODE_NOPERSPECTIVE;
} else {
ir_read_error(expr, "unknown qualifier: %s", qualifier->value());
return NULL;
diff --git a/src/compiler/glsl/ir_set_program_inouts.cpp b/src/compiler/glsl/ir_set_program_inouts.cpp
index 1f9971dffc7..7c61994daca 100644
--- a/src/compiler/glsl/ir_set_program_inouts.cpp
+++ b/src/compiler/glsl/ir_set_program_inouts.cpp
@@ -125,7 +125,7 @@ mark(struct gl_program *prog, ir_variable *var, int offset, int len,
if (stage == MESA_SHADER_FRAGMENT) {
gl_fragment_program *fprog = (gl_fragment_program *) prog;
fprog->InterpQualifier[idx] =
- (glsl_interp_qualifier) var->data.interpolation;
+ (glsl_interp_mode) var->data.interpolation;
if (var->data.centroid)
fprog->IsCentroid |= bitfield;
if (var->data.sample)
diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
index 76d0be1c61d..29362c4f21c 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -1388,13 +1388,13 @@ varying_matches::record(ir_variable *producer_var, ir_variable *consumer_var)
if (producer_var) {
producer_var->data.centroid = false;
producer_var->data.sample = false;
- producer_var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ producer_var->data.interpolation = INTERP_MODE_FLAT;
}
if (consumer_var) {
consumer_var->data.centroid = false;
consumer_var->data.sample = false;
- consumer_var->data.interpolation = INTERP_QUALIFIER_FLAT;
+ consumer_var->data.interpolation = INTERP_MODE_FLAT;
}
}
@@ -1612,7 +1612,7 @@ varying_matches::compute_packing_class(const ir_variable *var)
(var->data.patch << 2);
packing_class *= 4;
packing_class += var->is_interpolation_flat()
- ? unsigned(INTERP_QUALIFIER_FLAT) : var->data.interpolation;
+ ? unsigned(INTERP_MODE_FLAT) : var->data.interpolation;
return packing_class;
}
diff --git a/src/compiler/glsl/lower_packed_varyings.cpp b/src/compiler/glsl/lower_packed_varyings.cpp
index 2b347399cea..4eeb4b44d85 100644
--- a/src/compiler/glsl/lower_packed_varyings.cpp
+++ b/src/compiler/glsl/lower_packed_varyings.cpp
@@ -276,8 +276,8 @@ lower_packed_varyings_visitor::run(struct gl_linked_shader *shader)
* together when their interpolation mode is "flat". Treat integers as
* being flat when the interpolation mode is none.
*/
- assert(var->data.interpolation == INTERP_QUALIFIER_FLAT ||
- var->data.interpolation == INTERP_QUALIFIER_NONE ||
+ assert(var->data.interpolation == INTERP_MODE_FLAT ||
+ var->data.interpolation == INTERP_MODE_NONE ||
!var->type->contains_integer());
/* Clone the variable for program resource list before
@@ -628,7 +628,7 @@ lower_packed_varyings_visitor::get_packed_varying_deref(
packed_var->data.sample = unpacked_var->data.sample;
packed_var->data.patch = unpacked_var->data.patch;
packed_var->data.interpolation = packed_type == glsl_type::ivec4_type
- ? unsigned(INTERP_QUALIFIER_FLAT) : unpacked_var->data.interpolation;
+ ? unsigned(INTERP_MODE_FLAT) : unpacked_var->data.interpolation;
packed_var->data.location = location;
packed_var->data.precision = unpacked_var->data.precision;
packed_var->data.always_active_io = unpacked_var->data.always_active_io;