[Mesa-dev] [PATCH 3/5] glsl: move variables in to ir_variable::data, part II
Tapani Pälli
tapani.palli at intel.com
Wed Dec 4 04:16:42 PST 2013
This patch moves following bitfields in to the data structure:
explicit_location, explicit_index, explicit_binding,
has_initializer, is_unmatched_generic_inout, location_frac
Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
---
src/glsl/ast_to_hir.cpp | 12 ++---
src/glsl/builtin_variables.cpp | 6 +--
src/glsl/ir.cpp | 6 +--
src/glsl/ir.h | 80 ++++++++++++++--------------
src/glsl/ir_clone.cpp | 8 +--
src/glsl/ir_validate.cpp | 2 +-
src/glsl/link_uniform_initializers.cpp | 2 +-
src/glsl/link_varyings.cpp | 16 +++---
src/glsl/linker.cpp | 38 ++++++-------
src/glsl/lower_named_interface_blocks.cpp | 2 +-
src/glsl/lower_packed_varyings.cpp | 2 +-
src/glsl/opt_dead_builtin_varyings.cpp | 4 +-
src/glsl/tests/builtin_variable_test.cpp | 30 +++++------
src/glsl/tests/invalidate_locations_test.cpp | 60 ++++++++++-----------
14 files changed, 134 insertions(+), 134 deletions(-)
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index bff5a47..7847720 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2112,7 +2112,7 @@ validate_explicit_location(const struct ast_type_qualifier *qual,
mode_string(var),
_mesa_glsl_shader_target_name(state->target));
} else {
- var->explicit_location = true;
+ var->data.explicit_location = true;
/* This bit of silliness is needed because invalid explicit locations
* are supposed to be flagged during linking. Small negative values
@@ -2143,7 +2143,7 @@ validate_explicit_location(const struct ast_type_qualifier *qual,
_mesa_glsl_error(loc, state,
"explicit index may only be 0 or 1");
} else {
- var->explicit_index = true;
+ var->data.explicit_index = true;
var->index = qual->index;
}
}
@@ -2312,13 +2312,13 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
if (qual->flags.q.explicit_binding &&
validate_binding_qualifier(state, loc, var, qual)) {
- var->explicit_binding = true;
+ var->data.explicit_binding = true;
var->binding = qual->binding;
}
if (var->type->contains_atomic()) {
if (var->data.mode == ir_var_uniform) {
- if (var->explicit_binding) {
+ if (var->data.explicit_binding) {
unsigned *offset = &state->atomic_counter_offsets[var->binding];
if (*offset % ATOMIC_COUNTER_SIZE)
@@ -2664,7 +2664,7 @@ process_initializer(ir_variable *var, ast_declaration *decl,
initializer_type = rhs->type;
var->constant_initializer = rhs->constant_expression_value();
- var->has_initializer = true;
+ var->data.has_initializer = true;
/* If the declared variable is an unsized array, it must inherrit
* its full type from the initializer. A declaration such as
@@ -5111,7 +5111,7 @@ ast_interface_block::hir(exec_list *instructions,
* the UBO declaration itself doesn't get an ir_variable unless it
* has an instance name. This is ugly.
*/
- var->explicit_binding = this->layout.flags.q.explicit_binding;
+ var->data.explicit_binding = this->layout.flags.q.explicit_binding;
var->binding = this->layout.binding;
state->symbols->add_variable(var);
diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
index b1ea128..e92728b 100644
--- a/src/glsl/builtin_variables.cpp
+++ b/src/glsl/builtin_variables.cpp
@@ -455,8 +455,8 @@ builtin_variable_generator::add_variable(const char *name,
}
var->location = slot;
- var->explicit_location = (slot >= 0);
- var->explicit_index = 0;
+ var->data.explicit_location = (slot >= 0);
+ var->data.explicit_index = 0;
/* Once the variable is created an initialized, add it to the symbol table
* and add the declaration to the IR stream.
@@ -523,7 +523,7 @@ builtin_variable_generator::add_const(const char *name, int value)
ir_var_auto, -1);
var->constant_value = new(var) ir_constant(value);
var->constant_initializer = new(var) ir_constant(value);
- var->has_initializer = true;
+ var->data.has_initializer = true;
return var;
}
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index 4f9b88a..c6ba7c9 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -1589,10 +1589,10 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name,
this->ir_type = ir_type_variable;
this->type = type;
this->name = ralloc_strdup(this, name);
- this->explicit_location = false;
- this->has_initializer = false;
+ this->data.explicit_location = false;
+ this->data.has_initializer = false;
this->location = -1;
- this->location_frac = 0;
+ this->data.location_frac = 0;
this->warn_extension = NULL;
this->constant_value = NULL;
this->constant_initializer = NULL;
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 0b8cff7..610c459 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -585,51 +585,51 @@ public:
unsigned pixel_center_integer:1;
/*@}*/
- } data;
+ /**
+ * Was the location explicitly set in the shader?
+ *
+ * If the location is explicitly set in the shader, it \b cannot be changed
+ * by the linker or by the API (e.g., calls to \c glBindAttribLocation have
+ * no effect).
+ */
+ unsigned explicit_location:1;
+ unsigned explicit_index:1;
- /**
- * Was the location explicitly set in the shader?
- *
- * If the location is explicitly set in the shader, it \b cannot be changed
- * by the linker or by the API (e.g., calls to \c glBindAttribLocation have
- * no effect).
- */
- unsigned explicit_location:1;
- unsigned explicit_index:1;
+ /**
+ * Was an initial binding explicitly set in the shader?
+ *
+ * If so, constant_value contains an integer ir_constant representing the
+ * initial binding point.
+ */
+ unsigned explicit_binding:1;
- /**
- * Was an initial binding explicitly set in the shader?
- *
- * If so, constant_value contains an integer ir_constant representing the
- * initial binding point.
- */
- unsigned explicit_binding:1;
+ /**
+ * Does this variable have an initializer?
+ *
+ * This is used by the linker to cross-validiate initializers of global
+ * variables.
+ */
+ unsigned has_initializer:1;
- /**
- * Does this variable have an initializer?
- *
- * This is used by the linker to cross-validiate initializers of global
- * variables.
- */
- unsigned has_initializer:1;
+ /**
+ * Is this variable a generic output or input that has not yet been matched
+ * up to a variable in another stage of the pipeline?
+ *
+ * This is used by the linker as scratch storage while assigning locations
+ * to generic inputs and outputs.
+ */
+ unsigned is_unmatched_generic_inout:1;
- /**
- * Is this variable a generic output or input that has not yet been matched
- * up to a variable in another stage of the pipeline?
- *
- * This is used by the linker as scratch storage while assigning locations
- * to generic inputs and outputs.
- */
- unsigned is_unmatched_generic_inout:1;
+ /**
+ * If non-zero, then this variable may be packed along with other variables
+ * into a single varying slot, so this offset should be applied when
+ * accessing components. For example, an offset of 1 means that the x
+ * component of this variable is actually stored in component y of the
+ * location specified by \c location.
+ */
+ unsigned location_frac:2;
- /**
- * If non-zero, then this variable may be packed along with other variables
- * into a single varying slot, so this offset should be applied when
- * accessing components. For example, an offset of 1 means that the x
- * component of this variable is actually stored in component y of the
- * location specified by \c location.
- */
- unsigned location_frac:2;
+ } data;
/**
* Non-zero if this variable was created by lowering a named interface
diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp
index 4d5eea6..8a0664e 100644
--- a/src/glsl/ir_clone.cpp
+++ b/src/glsl/ir_clone.cpp
@@ -62,10 +62,10 @@ ir_variable::clone(void *mem_ctx, struct hash_table *ht) const
var->warn_extension = this->warn_extension;
var->data.origin_upper_left = this->data.origin_upper_left;
var->data.pixel_center_integer = this->data.pixel_center_integer;
- var->explicit_location = this->explicit_location;
- var->explicit_index = this->explicit_index;
- var->explicit_binding = this->explicit_binding;
- var->has_initializer = this->has_initializer;
+ var->data.explicit_location = this->data.explicit_location;
+ var->data.explicit_index = this->data.explicit_index;
+ var->data.explicit_binding = this->data.explicit_binding;
+ var->data.has_initializer = this->data.has_initializer;
var->depth_layout = this->depth_layout;
var->data.assigned = this->data.assigned;
var->data.how_declared = this->data.how_declared;
diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp
index 86bb6ee..c279208 100644
--- a/src/glsl/ir_validate.cpp
+++ b/src/glsl/ir_validate.cpp
@@ -720,7 +720,7 @@ ir_validate::visit(ir_variable *ir)
}
}
- if (ir->constant_initializer != NULL && !ir->has_initializer) {
+ if (ir->constant_initializer != NULL && !ir->data.has_initializer) {
printf("ir_variable didn't have an initializer, but has a constant "
"initializer value.\n");
ir->print();
diff --git a/src/glsl/link_uniform_initializers.cpp b/src/glsl/link_uniform_initializers.cpp
index ef74607..d59b7f3 100644
--- a/src/glsl/link_uniform_initializers.cpp
+++ b/src/glsl/link_uniform_initializers.cpp
@@ -230,7 +230,7 @@ link_set_uniform_initializers(struct gl_shader_program *prog)
if (!mem_ctx)
mem_ctx = ralloc_context(NULL);
- if (var->explicit_binding) {
+ if (var->data.explicit_binding) {
linker::set_uniform_binding(mem_ctx, prog, var->name,
var->type, var->binding);
} else if (var->constant_value) {
diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp
index c791fce..7f136ac 100644
--- a/src/glsl/link_varyings.cpp
+++ b/src/glsl/link_varyings.cpp
@@ -318,7 +318,7 @@ tfeedback_decl::assign_location(struct gl_context *ctx,
unsigned fine_location
= this->matched_candidate->toplevel_var->location * 4
- + this->matched_candidate->toplevel_var->location_frac
+ + this->matched_candidate->toplevel_var->data.location_frac
+ this->matched_candidate->offset;
if (this->matched_candidate->type->is_array()) {
@@ -734,7 +734,7 @@ varying_matches::~varying_matches()
void
varying_matches::record(ir_variable *producer_var, ir_variable *consumer_var)
{
- if (!producer_var->is_unmatched_generic_inout) {
+ if (!producer_var->data.is_unmatched_generic_inout) {
/* Either a location already exists for this variable (since it is part
* of fixed functionality), or it has already been recorded as part of a
* previous match.
@@ -784,9 +784,9 @@ varying_matches::record(ir_variable *producer_var, ir_variable *consumer_var)
this->matches[this->num_matches].producer_var = producer_var;
this->matches[this->num_matches].consumer_var = consumer_var;
this->num_matches++;
- producer_var->is_unmatched_generic_inout = 0;
+ producer_var->data.is_unmatched_generic_inout = 0;
if (consumer_var)
- consumer_var->is_unmatched_generic_inout = 0;
+ consumer_var->data.is_unmatched_generic_inout = 0;
}
@@ -839,11 +839,11 @@ varying_matches::store_locations(unsigned producer_base,
unsigned offset = generic_location % 4;
producer_var->location = producer_base + slot;
- producer_var->location_frac = offset;
+ producer_var->data.location_frac = offset;
if (consumer_var) {
assert(consumer_var->location == -1);
consumer_var->location = consumer_base + slot;
- consumer_var->location_frac = offset;
+ consumer_var->data.location_frac = offset;
}
}
}
@@ -1143,7 +1143,7 @@ assign_varying_locations(struct gl_context *ctx,
return false;
}
- if (matched_candidate->toplevel_var->is_unmatched_generic_inout)
+ if (matched_candidate->toplevel_var->data.is_unmatched_generic_inout)
matches.record(matched_candidate->toplevel_var, NULL);
}
@@ -1186,7 +1186,7 @@ assign_varying_locations(struct gl_context *ctx,
ir_variable *const var = ((ir_instruction *) node)->as_variable();
if (var && var->data.mode == ir_var_shader_in &&
- var->is_unmatched_generic_inout) {
+ var->data.is_unmatched_generic_inout) {
if (prog->Version <= 120) {
/* On page 25 (page 31 of the PDF) of the GLSL 1.20 spec:
*
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index d19f07e..77dc03f 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -379,9 +379,9 @@ link_invalidate_variable_locations(exec_list *ir)
* shader inputs (via layout(location=...)), and generic fragment shader
* outputs (also via layout(location=...)).
*/
- if (!var->explicit_location) {
+ if (!var->data.explicit_location) {
var->location = -1;
- var->location_frac = 0;
+ var->data.location_frac = 0;
}
/* ir_variable::is_unmatched_generic_inout is used by the linker while
@@ -396,10 +396,10 @@ link_invalidate_variable_locations(exec_list *ir)
* GL_ARB_separate_shader_objects is supported. When that extension is
* implemented, this function will need some modifications.
*/
- if (!var->explicit_location) {
- var->is_unmatched_generic_inout = 1;
+ if (!var->data.explicit_location) {
+ var->data.is_unmatched_generic_inout = 1;
} else {
- var->is_unmatched_generic_inout = 0;
+ var->data.is_unmatched_generic_inout = 0;
}
}
}
@@ -619,8 +619,8 @@ cross_validate_globals(struct gl_shader_program *prog,
}
}
- if (var->explicit_location) {
- if (existing->explicit_location
+ if (var->data.explicit_location) {
+ if (existing->data.explicit_location
&& (var->location != existing->location)) {
linker_error(prog, "explicit locations for %s "
"`%s' have differing values\n",
@@ -629,7 +629,7 @@ cross_validate_globals(struct gl_shader_program *prog,
}
existing->location = var->location;
- existing->explicit_location = true;
+ existing->data.explicit_location = true;
}
/* From the GLSL 4.20 specification:
@@ -638,8 +638,8 @@ cross_validate_globals(struct gl_shader_program *prog,
* opaque-uniform name. However, it is not an error to specify a
* binding on some but not all declarations for the same name"
*/
- if (var->explicit_binding) {
- if (existing->explicit_binding &&
+ if (var->data.explicit_binding) {
+ if (existing->data.explicit_binding &&
var->binding != existing->binding) {
linker_error(prog, "explicit bindings for %s "
"`%s' have differing values\n",
@@ -648,7 +648,7 @@ cross_validate_globals(struct gl_shader_program *prog,
}
existing->binding = var->binding;
- existing->explicit_binding = true;
+ existing->data.explicit_binding = true;
}
if (var->type->contains_atomic() &&
@@ -734,8 +734,8 @@ cross_validate_globals(struct gl_shader_program *prog,
}
}
- if (var->has_initializer) {
- if (existing->has_initializer
+ if (var->data.has_initializer) {
+ if (existing->data.has_initializer
&& (var->constant_initializer == NULL
|| existing->constant_initializer == NULL)) {
linker_error(prog,
@@ -750,7 +750,7 @@ cross_validate_globals(struct gl_shader_program *prog,
* otherwise) will propagate the existence to the variable
* stored in the symbol table.
*/
- existing->has_initializer = true;
+ existing->data.has_initializer = true;
}
if (existing->data.invariant != var->data.invariant) {
@@ -1657,7 +1657,7 @@ assign_attribute_or_color_locations(gl_shader_program *prog,
if ((var == NULL) || (var->data.mode != (unsigned) direction))
continue;
- if (var->explicit_location) {
+ if (var->data.explicit_location) {
if ((var->location >= (int)(max_index + generic_base))
|| (var->location < 0)) {
linker_error(prog,
@@ -1673,7 +1673,7 @@ assign_attribute_or_color_locations(gl_shader_program *prog,
if (prog->AttributeBindings->get(binding, var->name)) {
assert(binding >= VERT_ATTRIB_GENERIC0);
var->location = binding;
- var->is_unmatched_generic_inout = 0;
+ var->data.is_unmatched_generic_inout = 0;
}
} else if (target_index == MESA_SHADER_FRAGMENT) {
unsigned binding;
@@ -1682,7 +1682,7 @@ assign_attribute_or_color_locations(gl_shader_program *prog,
if (prog->FragDataBindings->get(binding, var->name)) {
assert(binding >= FRAG_RESULT_DATA0);
var->location = binding;
- var->is_unmatched_generic_inout = 0;
+ var->data.is_unmatched_generic_inout = 0;
if (prog->FragDataIndexBindings->get(index, var->name)) {
var->index = index;
@@ -1798,7 +1798,7 @@ assign_attribute_or_color_locations(gl_shader_program *prog,
}
to_assign[i].var->location = generic_base + location;
- to_assign[i].var->is_unmatched_generic_inout = 0;
+ to_assign[i].var->data.is_unmatched_generic_inout = 0;
used_locations |= (use_mask << location);
}
@@ -1822,7 +1822,7 @@ demote_shader_inputs_and_outputs(gl_shader *sh, enum ir_variable_mode mode)
* its value is used by other shader stages. This will cause the variable
* to have a location assigned.
*/
- if (var->is_unmatched_generic_inout) {
+ if (var->data.is_unmatched_generic_inout) {
var->data.mode = ir_var_auto;
}
}
diff --git a/src/glsl/lower_named_interface_blocks.cpp b/src/glsl/lower_named_interface_blocks.cpp
index 1e60c3a..10b2025 100644
--- a/src/glsl/lower_named_interface_blocks.cpp
+++ b/src/glsl/lower_named_interface_blocks.cpp
@@ -153,7 +153,7 @@ flatten_named_interface_blocks_declarations::run(exec_list *instructions)
new_var->from_named_ifc_block_array = 1;
}
new_var->location = iface_t->fields.structure[i].location;
- new_var->explicit_location = (new_var->location >= 0);
+ new_var->data.explicit_location = (new_var->location >= 0);
new_var->data.interpolation =
iface_t->fields.structure[i].interpolation;
new_var->data.centroid = iface_t->fields.structure[i].centroid;
diff --git a/src/glsl/lower_packed_varyings.cpp b/src/glsl/lower_packed_varyings.cpp
index 7b5c6fc..6e87dd9 100644
--- a/src/glsl/lower_packed_varyings.cpp
+++ b/src/glsl/lower_packed_varyings.cpp
@@ -279,7 +279,7 @@ lower_packed_varyings_visitor::run(exec_list *instructions)
= new(this->mem_ctx) ir_dereference_variable(var);
/* Recursively pack or unpack it. */
- this->lower_rvalue(deref, var->location * 4 + var->location_frac, var,
+ this->lower_rvalue(deref, var->location * 4 + var->data.location_frac, var,
var->name, this->gs_input_vertices != 0, 0);
}
}
diff --git a/src/glsl/opt_dead_builtin_varyings.cpp b/src/glsl/opt_dead_builtin_varyings.cpp
index 62b5f1e..9e6f11a 100644
--- a/src/glsl/opt_dead_builtin_varyings.cpp
+++ b/src/glsl/opt_dead_builtin_varyings.cpp
@@ -359,8 +359,8 @@ public:
new(ctx) ir_variable(glsl_type::vec4_type, name,
this->info->mode);
new_var[i]->location = start_location + i;
- new_var[i]->explicit_location = true;
- new_var[i]->explicit_index = 0;
+ new_var[i]->data.explicit_location = true;
+ new_var[i]->data.explicit_index = 0;
}
ir->head->insert_before(new_var[i]);
diff --git a/src/glsl/tests/builtin_variable_test.cpp b/src/glsl/tests/builtin_variable_test.cpp
index 6164e10..a2008cb 100644
--- a/src/glsl/tests/builtin_variable_test.cpp
+++ b/src/glsl/tests/builtin_variable_test.cpp
@@ -113,7 +113,7 @@ common_builtin::uniforms_and_system_values_dont_have_explicit_location()
if (var->data.mode != ir_var_uniform && var->data.mode != ir_var_system_value)
continue;
- EXPECT_FALSE(var->explicit_location);
+ EXPECT_FALSE(var->data.explicit_location);
EXPECT_EQ(-1, var->location);
}
}
@@ -127,7 +127,7 @@ common_builtin::constants_are_constant()
if (var->data.mode != ir_var_auto)
continue;
- EXPECT_FALSE(var->explicit_location);
+ EXPECT_FALSE(var->data.explicit_location);
EXPECT_EQ(-1, var->location);
EXPECT_TRUE(var->data.read_only);
}
@@ -179,10 +179,10 @@ TEST_F(vertex_builtin, inputs_have_explicit_location)
if (var->data.mode != ir_var_shader_in)
continue;
- EXPECT_TRUE(var->explicit_location);
+ EXPECT_TRUE(var->data.explicit_location);
EXPECT_NE(-1, var->location);
EXPECT_GT(VERT_ATTRIB_GENERIC0, var->location);
- EXPECT_EQ(0u, var->location_frac);
+ EXPECT_EQ(0u, var->data.location_frac);
}
}
@@ -194,10 +194,10 @@ TEST_F(vertex_builtin, outputs_have_explicit_location)
if (var->data.mode != ir_var_shader_out)
continue;
- EXPECT_TRUE(var->explicit_location);
+ EXPECT_TRUE(var->data.explicit_location);
EXPECT_NE(-1, var->location);
EXPECT_GT(VARYING_SLOT_VAR0, var->location);
- EXPECT_EQ(0u, var->location_frac);
+ EXPECT_EQ(0u, var->data.location_frac);
/* Several varyings only exist in the fragment shader. Be sure that no
* outputs with these locations exist.
@@ -247,10 +247,10 @@ TEST_F(fragment_builtin, inputs_have_explicit_location)
if (var->data.mode != ir_var_shader_in)
continue;
- EXPECT_TRUE(var->explicit_location);
+ EXPECT_TRUE(var->data.explicit_location);
EXPECT_NE(-1, var->location);
EXPECT_GT(VARYING_SLOT_VAR0, var->location);
- EXPECT_EQ(0u, var->location_frac);
+ EXPECT_EQ(0u, var->data.location_frac);
/* Several varyings only exist in the vertex / geometry shader. Be sure
* that no inputs with these locations exist.
@@ -267,7 +267,7 @@ TEST_F(fragment_builtin, outputs_have_explicit_location)
if (var->data.mode != ir_var_shader_out)
continue;
- EXPECT_TRUE(var->explicit_location);
+ EXPECT_TRUE(var->data.explicit_location);
EXPECT_NE(-1, var->location);
/* gl_FragData[] has location FRAG_RESULT_DATA0. Locations beyond that
@@ -275,7 +275,7 @@ TEST_F(fragment_builtin, outputs_have_explicit_location)
*/
EXPECT_GE(FRAG_RESULT_DATA0, var->location);
- EXPECT_EQ(0u, var->location_frac);
+ EXPECT_EQ(0u, var->data.location_frac);
}
}
@@ -320,7 +320,7 @@ TEST_F(geometry_builtin, inputs_have_explicit_location)
if (var->is_interface_instance()) {
EXPECT_STREQ("gl_in", var->name);
- EXPECT_FALSE(var->explicit_location);
+ EXPECT_FALSE(var->data.explicit_location);
EXPECT_EQ(-1, var->location);
ASSERT_TRUE(var->type->is_array());
@@ -342,10 +342,10 @@ TEST_F(geometry_builtin, inputs_have_explicit_location)
EXPECT_NE(VARYING_SLOT_FACE, input->location);
}
} else {
- EXPECT_TRUE(var->explicit_location);
+ EXPECT_TRUE(var->data.explicit_location);
EXPECT_NE(-1, var->location);
EXPECT_GT(VARYING_SLOT_VAR0, var->location);
- EXPECT_EQ(0u, var->location_frac);
+ EXPECT_EQ(0u, var->data.location_frac);
}
/* Several varyings only exist in the fragment shader. Be sure that no
@@ -364,10 +364,10 @@ TEST_F(geometry_builtin, outputs_have_explicit_location)
if (var->data.mode != ir_var_shader_out)
continue;
- EXPECT_TRUE(var->explicit_location);
+ EXPECT_TRUE(var->data.explicit_location);
EXPECT_NE(-1, var->location);
EXPECT_GT(VARYING_SLOT_VAR0, var->location);
- EXPECT_EQ(0u, var->location_frac);
+ EXPECT_EQ(0u, var->data.location_frac);
/* Several varyings only exist in the fragment shader. Be sure that no
* outputs with these locations exist.
diff --git a/src/glsl/tests/invalidate_locations_test.cpp b/src/glsl/tests/invalidate_locations_test.cpp
index f70dc6f..b76491a 100644
--- a/src/glsl/tests/invalidate_locations_test.cpp
+++ b/src/glsl/tests/invalidate_locations_test.cpp
@@ -64,20 +64,20 @@ TEST_F(invalidate_locations, simple_vertex_in_generic)
"a",
ir_var_shader_in);
- EXPECT_FALSE(var->explicit_location);
+ EXPECT_FALSE(var->data.explicit_location);
EXPECT_EQ(-1, var->location);
var->location = VERT_ATTRIB_GENERIC0;
- var->location_frac = 2;
+ var->data.location_frac = 2;
ir.push_tail(var);
link_invalidate_variable_locations(&ir);
EXPECT_EQ(-1, var->location);
- EXPECT_EQ(0u, var->location_frac);
- EXPECT_FALSE(var->explicit_location);
- EXPECT_TRUE(var->is_unmatched_generic_inout);
+ EXPECT_EQ(0u, var->data.location_frac);
+ EXPECT_FALSE(var->data.explicit_location);
+ EXPECT_TRUE(var->data.is_unmatched_generic_inout);
}
TEST_F(invalidate_locations, explicit_location_vertex_in_generic)
@@ -87,20 +87,20 @@ TEST_F(invalidate_locations, explicit_location_vertex_in_generic)
"a",
ir_var_shader_in);
- EXPECT_FALSE(var->explicit_location);
+ EXPECT_FALSE(var->data.explicit_location);
EXPECT_EQ(-1, var->location);
var->location = VERT_ATTRIB_GENERIC0;
- var->explicit_location = true;
+ var->data.explicit_location = true;
ir.push_tail(var);
link_invalidate_variable_locations(&ir);
EXPECT_EQ(VERT_ATTRIB_GENERIC0, var->location);
- EXPECT_EQ(0u, var->location_frac);
- EXPECT_TRUE(var->explicit_location);
- EXPECT_FALSE(var->is_unmatched_generic_inout);
+ EXPECT_EQ(0u, var->data.location_frac);
+ EXPECT_TRUE(var->data.explicit_location);
+ EXPECT_FALSE(var->data.is_unmatched_generic_inout);
}
TEST_F(invalidate_locations, explicit_location_frac_vertex_in_generic)
@@ -110,21 +110,21 @@ TEST_F(invalidate_locations, explicit_location_frac_vertex_in_generic)
"a",
ir_var_shader_in);
- EXPECT_FALSE(var->explicit_location);
+ EXPECT_FALSE(var->data.explicit_location);
EXPECT_EQ(-1, var->location);
var->location = VERT_ATTRIB_GENERIC0;
- var->location_frac = 2;
- var->explicit_location = true;
+ var->data.location_frac = 2;
+ var->data.explicit_location = true;
ir.push_tail(var);
link_invalidate_variable_locations(&ir);
EXPECT_EQ(VERT_ATTRIB_GENERIC0, var->location);
- EXPECT_EQ(2u, var->location_frac);
- EXPECT_TRUE(var->explicit_location);
- EXPECT_FALSE(var->is_unmatched_generic_inout);
+ EXPECT_EQ(2u, var->data.location_frac);
+ EXPECT_TRUE(var->data.explicit_location);
+ EXPECT_FALSE(var->data.is_unmatched_generic_inout);
}
TEST_F(invalidate_locations, vertex_in_builtin)
@@ -134,20 +134,20 @@ TEST_F(invalidate_locations, vertex_in_builtin)
"gl_Vertex",
ir_var_shader_in);
- EXPECT_FALSE(var->explicit_location);
+ EXPECT_FALSE(var->data.explicit_location);
EXPECT_EQ(-1, var->location);
var->location = VERT_ATTRIB_POS;
- var->explicit_location = true;
+ var->data.explicit_location = true;
ir.push_tail(var);
link_invalidate_variable_locations(&ir);
EXPECT_EQ(VERT_ATTRIB_POS, var->location);
- EXPECT_EQ(0u, var->location_frac);
- EXPECT_TRUE(var->explicit_location);
- EXPECT_FALSE(var->is_unmatched_generic_inout);
+ EXPECT_EQ(0u, var->data.location_frac);
+ EXPECT_TRUE(var->data.explicit_location);
+ EXPECT_FALSE(var->data.is_unmatched_generic_inout);
}
TEST_F(invalidate_locations, simple_vertex_out_generic)
@@ -157,7 +157,7 @@ TEST_F(invalidate_locations, simple_vertex_out_generic)
"a",
ir_var_shader_out);
- EXPECT_FALSE(var->explicit_location);
+ EXPECT_FALSE(var->data.explicit_location);
EXPECT_EQ(-1, var->location);
var->location = VARYING_SLOT_VAR0;
@@ -167,9 +167,9 @@ TEST_F(invalidate_locations, simple_vertex_out_generic)
link_invalidate_variable_locations(&ir);
EXPECT_EQ(-1, var->location);
- EXPECT_EQ(0u, var->location_frac);
- EXPECT_FALSE(var->explicit_location);
- EXPECT_TRUE(var->is_unmatched_generic_inout);
+ EXPECT_EQ(0u, var->data.location_frac);
+ EXPECT_FALSE(var->data.explicit_location);
+ EXPECT_TRUE(var->data.is_unmatched_generic_inout);
}
TEST_F(invalidate_locations, vertex_out_builtin)
@@ -179,18 +179,18 @@ TEST_F(invalidate_locations, vertex_out_builtin)
"gl_FrontColor",
ir_var_shader_out);
- EXPECT_FALSE(var->explicit_location);
+ EXPECT_FALSE(var->data.explicit_location);
EXPECT_EQ(-1, var->location);
var->location = VARYING_SLOT_COL0;
- var->explicit_location = true;
+ var->data.explicit_location = true;
ir.push_tail(var);
link_invalidate_variable_locations(&ir);
EXPECT_EQ(VARYING_SLOT_COL0, var->location);
- EXPECT_EQ(0u, var->location_frac);
- EXPECT_TRUE(var->explicit_location);
- EXPECT_FALSE(var->is_unmatched_generic_inout);
+ EXPECT_EQ(0u, var->data.location_frac);
+ EXPECT_TRUE(var->data.explicit_location);
+ EXPECT_FALSE(var->data.is_unmatched_generic_inout);
}
--
1.8.3.1
More information about the mesa-dev
mailing list