Mesa (master): glsl/es31: precision qualifier doesn' t need to match in shader interface block members
Samuel Iglesias Gonsálvez
samuelig at kemper.freedesktop.org
Mon Oct 24 05:06:46 UTC 2016
Module: Mesa
Branch: master
Commit: b50b82b8a553f93b4ee9ace734e4c53d5a388a35
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b50b82b8a553f93b4ee9ace734e4c53d5a388a35
Author: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
Date: Tue Oct 18 09:38:30 2016 +0200
glsl/es31: precision qualifier doesn't need to match in shader interface block members
It is specific only to GLSL ES 3.1. From the spec, section 4.3.9
"Interface Blocks":
"Matched block names within a shader interface (as defined above) must
match in terms of having the same number of declarations with the same
sequence of types and the same sequence of member names, as well as
having the same qualification as specified in section 9.2 (“Matching
of Qualifiers“)."
But in GLSL ES 3.0 and 3.2, it is the opposite:
"Matched block names within a shader interface (as defined above) must
match in terms of having the same number of declarations with the same
sequence of types, precisions and the same sequence of member names,
as well as having the matching member-wise layout qualification as
defined in section 9.2 (“Matching of Qualifiers”)."
Fixes:
dEQP-GLES31.functional.shaders.linkage.uniform.block.differing_precision
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98243
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
Reviewed-by: Tapani Pälli <tapani.palli at intel.com>
---
src/compiler/glsl/link_interface_blocks.cpp | 7 +++++--
src/compiler/glsl/linker.cpp | 10 +++++++++-
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/compiler/glsl/link_interface_blocks.cpp b/src/compiler/glsl/link_interface_blocks.cpp
index 9a0b6ec..a176c3b 100644
--- a/src/compiler/glsl/link_interface_blocks.cpp
+++ b/src/compiler/glsl/link_interface_blocks.cpp
@@ -112,8 +112,11 @@ intrastage_match(ir_variable *a,
* don't force their types to match. They might mismatch due to the two
* shaders using different GLSL versions, and that's ok.
*/
- if (a->data.how_declared != ir_var_declared_implicitly ||
- b->data.how_declared != ir_var_declared_implicitly)
+ if ((a->data.how_declared != ir_var_declared_implicitly ||
+ b->data.how_declared != ir_var_declared_implicitly) &&
+ (!prog->IsES || prog->Version != 310 ||
+ interstage_member_mismatch(prog, a->get_interface_type(),
+ b->get_interface_type())))
return false;
}
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 8599590..0b3c195 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -1063,7 +1063,15 @@ cross_validate_globals(struct gl_shader_program *prog,
return;
}
- if (prog->IsES && existing->data.precision != var->data.precision) {
+ /* Only in GLSL ES 3.10, the precision qualifier should not match
+ * between block members defined in matched block names within a
+ * shader interface.
+ *
+ * In GLSL ES 3.00 and ES 3.20, precision qualifier for each block
+ * member should match.
+ */
+ if (prog->IsES && (prog->Version != 310 || !var->get_interface_type()) &&
+ existing->data.precision != var->data.precision) {
linker_error(prog, "declarations for %s `%s` have "
"mismatching precision qualifiers\n",
mode_string(var), var->name);
More information about the mesa-commit
mailing list