summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/link_interface_blocks.cpp
diff options
context:
space:
mode:
authorNeil Roberts <[email protected]>2019-04-23 16:52:36 +0200
committerNeil Roberts <[email protected]>2019-06-14 09:29:53 +0200
commit235425771c5671b97af5f6b7d918ff606e00ac31 (patch)
tree0a52d81262eca0c84f6d52df7f2e3339a6898c99 /src/compiler/glsl/link_interface_blocks.cpp
parent19b27a85694bd2440609a218386ab6d9f834019a (diff)
glsl/linker: Make precision matching optional in intrastage_match
This function is confusingly also used to match interstage interfaces as well as intrastage. In the interstage case it needs to avoid comparing the precisions. This patch adds a parameter to specify whether to take the precision into account or not so that it can be used for both cases. Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/compiler/glsl/link_interface_blocks.cpp')
-rw-r--r--src/compiler/glsl/link_interface_blocks.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/compiler/glsl/link_interface_blocks.cpp b/src/compiler/glsl/link_interface_blocks.cpp
index 801fbcd5d9f..d7d228ee1a5 100644
--- a/src/compiler/glsl/link_interface_blocks.cpp
+++ b/src/compiler/glsl/link_interface_blocks.cpp
@@ -106,7 +106,8 @@ interstage_member_mismatch(struct gl_shader_program *prog,
bool
intrastage_match(ir_variable *a,
ir_variable *b,
- struct gl_shader_program *prog)
+ struct gl_shader_program *prog,
+ bool match_precision)
{
/* Types must match. */
if (a->get_interface_type() != b->get_interface_type()) {
@@ -136,12 +137,16 @@ intrastage_match(ir_variable *a,
return false;
}
+ bool type_match = (match_precision ?
+ a->type == b->type :
+ a->type->compare_no_precision(b->type));
+
/* If a block is an array then it must match across the shader.
* Unsized arrays are also processed and matched agaist sized arrays.
*/
- if (b->type != a->type && (b->type->is_array() || a->type->is_array()) &&
+ if (!type_match && (b->type->is_array() || a->type->is_array()) &&
(b->is_interface_instance() || a->is_interface_instance()) &&
- !validate_intrastage_arrays(prog, b, a))
+ !validate_intrastage_arrays(prog, b, a, match_precision))
return false;
return true;
@@ -337,7 +342,8 @@ validate_intrastage_interface_blocks(struct gl_shader_program *prog,
* it into the appropriate data structure.
*/
definitions->store(var);
- } else if (!intrastage_match(prev_def, var, prog)) {
+ } else if (!intrastage_match(prev_def, var, prog,
+ true /* match_precision */)) {
linker_error(prog, "definitions of interface block `%s' do not"
" match\n", iface_type->name);
return;
@@ -467,7 +473,7 @@ validate_interstage_uniform_blocks(struct gl_shader_program *prog,
* uniform matchin rules (for uniforms, it is as though all
* shaders are in the same shader stage).
*/
- if (!intrastage_match(old_def, var, prog)) {
+ if (!intrastage_match(old_def, var, prog, false /* precision */)) {
linker_error(prog, "definitions of uniform block `%s' do not "
"match\n", var->get_interface_type()->name);
return;