summaryrefslogtreecommitdiffstats
path: root/src/glsl/tests
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2013-10-04 10:46:29 -0700
committerIan Romanick <ian.d.romanick@intel.com>2013-10-22 15:23:30 -0700
commit63974c0f5b26e369a790505af6820d4bbcf451b2 (patch)
tree227b453fc6e459d5cb04ae6a5baad96c5454134f /src/glsl/tests
parent1eee0a9f016a1049869f4677f5919186ee3785a2 (diff)
downloadexternal_mesa3d-63974c0f5b26e369a790505af6820d4bbcf451b2.zip
external_mesa3d-63974c0f5b26e369a790505af6820d4bbcf451b2.tar.gz
external_mesa3d-63974c0f5b26e369a790505af6820d4bbcf451b2.tar.bz2
glsl: Simplify the interface to link_invalidate_variable_locations
The unit tests added in the previous commits prove some things about the state of some internal data structures. The most important of these is that all built-in input and output variables have explicit_location set. This means that link_invalidate_variable_locations doesn't need to know the range of non-generic shader inputs or outputs. It can simply reset location state depending on whether explicit_location is set. There are two additional assumptions that were already implicit in the code that comments now document. - ir_variable::is_unmatched_generic_inout is only used by the linker when connecting outputs from one shader stage to inputs of another shader stage. - Any varying that has explicit_location set must be a built-in. This will be true until GL_ARB_separate_shader_objects is supported. As a result, the input_base and output_base parameters to link_invalidate_variable_locations are no longer necessary, and the code for resetting locations and setting is_unmatched_generic_inout can be simplified. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Paul Berry <stereotype441@gmail.com>
Diffstat (limited to 'src/glsl/tests')
-rw-r--r--src/glsl/tests/invalidate_locations_test.cpp24
1 files changed, 6 insertions, 18 deletions
diff --git a/src/glsl/tests/invalidate_locations_test.cpp b/src/glsl/tests/invalidate_locations_test.cpp
index cded1d5..f70dc6f 100644
--- a/src/glsl/tests/invalidate_locations_test.cpp
+++ b/src/glsl/tests/invalidate_locations_test.cpp
@@ -72,9 +72,7 @@ TEST_F(invalidate_locations, simple_vertex_in_generic)
ir.push_tail(var);
- link_invalidate_variable_locations(&ir,
- VERT_ATTRIB_GENERIC0,
- VARYING_SLOT_VAR0);
+ link_invalidate_variable_locations(&ir);
EXPECT_EQ(-1, var->location);
EXPECT_EQ(0u, var->location_frac);
@@ -97,9 +95,7 @@ TEST_F(invalidate_locations, explicit_location_vertex_in_generic)
ir.push_tail(var);
- link_invalidate_variable_locations(&ir,
- VERT_ATTRIB_GENERIC0,
- VARYING_SLOT_VAR0);
+ link_invalidate_variable_locations(&ir);
EXPECT_EQ(VERT_ATTRIB_GENERIC0, var->location);
EXPECT_EQ(0u, var->location_frac);
@@ -123,9 +119,7 @@ TEST_F(invalidate_locations, explicit_location_frac_vertex_in_generic)
ir.push_tail(var);
- link_invalidate_variable_locations(&ir,
- VERT_ATTRIB_GENERIC0,
- VARYING_SLOT_VAR0);
+ link_invalidate_variable_locations(&ir);
EXPECT_EQ(VERT_ATTRIB_GENERIC0, var->location);
EXPECT_EQ(2u, var->location_frac);
@@ -148,9 +142,7 @@ TEST_F(invalidate_locations, vertex_in_builtin)
ir.push_tail(var);
- link_invalidate_variable_locations(&ir,
- VERT_ATTRIB_GENERIC0,
- VARYING_SLOT_VAR0);
+ link_invalidate_variable_locations(&ir);
EXPECT_EQ(VERT_ATTRIB_POS, var->location);
EXPECT_EQ(0u, var->location_frac);
@@ -172,9 +164,7 @@ TEST_F(invalidate_locations, simple_vertex_out_generic)
ir.push_tail(var);
- link_invalidate_variable_locations(&ir,
- VERT_ATTRIB_GENERIC0,
- VARYING_SLOT_VAR0);
+ link_invalidate_variable_locations(&ir);
EXPECT_EQ(-1, var->location);
EXPECT_EQ(0u, var->location_frac);
@@ -197,9 +187,7 @@ TEST_F(invalidate_locations, vertex_out_builtin)
ir.push_tail(var);
- link_invalidate_variable_locations(&ir,
- VERT_ATTRIB_GENERIC0,
- VARYING_SLOT_VAR0);
+ link_invalidate_variable_locations(&ir);
EXPECT_EQ(VARYING_SLOT_COL0, var->location);
EXPECT_EQ(0u, var->location_frac);