summaryrefslogtreecommitdiffstats
path: root/src/glsl/tests
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2013-10-02 12:39:29 -0700
committerIan Romanick <[email protected]>2014-05-02 07:19:40 -0700
commit7ff937e5793dc8709c916e043b41142033c8e69e (patch)
treed5eb892659bf47bf335554d8f4fe2ad24b741ddd /src/glsl/tests
parentd030a3404ca0fedf365cb0fd41eaad7abc8ff132 (diff)
linker: Modify cross_validate_outputs_to_inputs to match using explicit locations
This will be used for GL_ARB_separate_shader_objects. That extension not only allows separable shaders to rendezvous by location, but it also allows traditionally linked shaders to rendezvous by location. The spec says: 36. How does the behavior of input/output interface matching differ between separable programs and non-separable programs? RESOLVED: The rules for matching individual variables or block members between stages are identical for separable and non-separable programs, with one exception -- matching variables of different type with the same location, as discussed in issue 34, applies only to separable programs. However, the ability to enforce matching requirements differs between program types. In non-separable programs, both sides of an interface are contained in the same linked program. In this case, if the linker detects a mismatch, it will generate a link error. v2: Make sure consumer_inputs_with_locations is initialized when consumer is NULL. Noticed by Chia-I. v3: Rebase on removal of ir_variable::user_location. v4: Replace a (stale) FINISHME with some good explanation comments from Eric. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/glsl/tests')
-rw-r--r--src/glsl/tests/varyings_test.cpp35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/glsl/tests/varyings_test.cpp b/src/glsl/tests/varyings_test.cpp
index 174911245f7..8a188a7b6a8 100644
--- a/src/glsl/tests/varyings_test.cpp
+++ b/src/glsl/tests/varyings_test.cpp
@@ -38,13 +38,15 @@ namespace linker {
bool
populate_consumer_input_sets(void *mem_ctx, exec_list *ir,
hash_table *consumer_inputs,
- hash_table *consumer_interface_inputs);
+ hash_table *consumer_interface_inputs,
+ ir_variable *consumer_inputs_with_locations[MAX_VARYING]);
ir_variable *
get_matching_input(void *mem_ctx,
const ir_variable *output_var,
hash_table *consumer_inputs,
- hash_table *consumer_interface_inputs);
+ hash_table *consumer_interface_inputs,
+ ir_variable *consumer_inputs_with_locations[MAX_VARYING]);
}
class link_varyings : public ::testing::Test {
@@ -68,6 +70,7 @@ public:
hash_table *consumer_interface_inputs;
const glsl_type *simple_interface;
+ ir_variable *junk[MAX_VARYING];
};
link_varyings::link_varyings()
@@ -164,7 +167,8 @@ TEST_F(link_varyings, single_simple_input)
ASSERT_TRUE(linker::populate_consumer_input_sets(mem_ctx,
&ir,
consumer_inputs,
- consumer_interface_inputs));
+ consumer_interface_inputs,
+ junk));
EXPECT_EQ((void *) v, hash_table_find(consumer_inputs, "a"));
EXPECT_EQ(1u, num_elements(consumer_inputs));
@@ -190,7 +194,8 @@ TEST_F(link_varyings, gl_ClipDistance)
ASSERT_TRUE(linker::populate_consumer_input_sets(mem_ctx,
&ir,
consumer_inputs,
- consumer_interface_inputs));
+ consumer_interface_inputs,
+ junk));
EXPECT_EQ((void *) clipdistance,
hash_table_find(consumer_inputs, "gl_ClipDistance"));
@@ -212,8 +217,8 @@ TEST_F(link_varyings, single_interface_input)
ASSERT_TRUE(linker::populate_consumer_input_sets(mem_ctx,
&ir,
consumer_inputs,
- consumer_interface_inputs));
-
+ consumer_interface_inputs,
+ junk));
char *const full_name = interface_field_name(simple_interface);
EXPECT_EQ((void *) v, hash_table_find(consumer_interface_inputs, full_name));
@@ -243,7 +248,8 @@ TEST_F(link_varyings, one_interface_and_one_simple_input)
ASSERT_TRUE(linker::populate_consumer_input_sets(mem_ctx,
&ir,
consumer_inputs,
- consumer_interface_inputs));
+ consumer_interface_inputs,
+ junk));
char *const iface_field_name = interface_field_name(simple_interface);
@@ -269,7 +275,8 @@ TEST_F(link_varyings, invalid_interface_input)
EXPECT_FALSE(linker::populate_consumer_input_sets(mem_ctx,
&ir,
consumer_inputs,
- consumer_interface_inputs));
+ consumer_interface_inputs,
+ junk));
}
TEST_F(link_varyings, interface_field_doesnt_match_noninterface)
@@ -288,7 +295,8 @@ TEST_F(link_varyings, interface_field_doesnt_match_noninterface)
ASSERT_TRUE(linker::populate_consumer_input_sets(mem_ctx,
&ir,
consumer_inputs,
- consumer_interface_inputs));
+ consumer_interface_inputs,
+ junk));
/* Create an output variable, "v", that is part of an interface block named
* "a". They should not match.
@@ -304,7 +312,8 @@ TEST_F(link_varyings, interface_field_doesnt_match_noninterface)
linker::get_matching_input(mem_ctx,
out_v,
consumer_inputs,
- consumer_interface_inputs);
+ consumer_interface_inputs,
+ junk);
EXPECT_EQ(NULL, match);
}
@@ -328,7 +337,8 @@ TEST_F(link_varyings, interface_field_doesnt_match_noninterface_vice_versa)
ASSERT_TRUE(linker::populate_consumer_input_sets(mem_ctx,
&ir,
consumer_inputs,
- consumer_interface_inputs));
+ consumer_interface_inputs,
+ junk));
/* Create an output variable "a.v". They should not match.
*/
@@ -341,7 +351,8 @@ TEST_F(link_varyings, interface_field_doesnt_match_noninterface_vice_versa)
linker::get_matching_input(mem_ctx,
out_v,
consumer_inputs,
- consumer_interface_inputs);
+ consumer_interface_inputs,
+ junk);
EXPECT_EQ(NULL, match);
}