Mesa (master): glsl: Set default precision on record members
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jun 14 07:38:22 UTC 2019
Module: Mesa
Branch: master
Commit: 34d4b3e36765ff89db68c15464656167a2e9d79f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=34d4b3e36765ff89db68c15464656167a2e9d79f
Author: Neil Roberts <nroberts at igalia.com>
Date: Mon Apr 22 16:33:38 2019 +0200
glsl: Set default precision on record members
Record types have their own slot to store the precision for each
member in glsl_struct_field. Previously if the member didn’t have an
explicit precision qualifier this was being left as
GLSL_PRECISION_NONE. This patch makes it take into account the type’s
default precision qualifier like it does for regular variables in
apply_type_qualifier_to_variable.
This has the additional benefit of correctly reporting an error when a
float type is used in a struct without declaring the default type.
Reviewed-by: Eric Anholt <eric at anholt.net>
---
src/compiler/glsl/ast_to_hir.cpp | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 4f062ba1543..26f72fc0925 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -7360,7 +7360,6 @@ ast_process_struct_or_iface_block_members(exec_list *instructions,
fields[i].centroid = qual->flags.q.centroid ? 1 : 0;
fields[i].sample = qual->flags.q.sample ? 1 : 0;
fields[i].patch = qual->flags.q.patch ? 1 : 0;
- fields[i].precision = qual->precision;
fields[i].offset = -1;
fields[i].explicit_xfb_buffer = explicit_xfb_buffer;
fields[i].xfb_buffer = xfb_buffer;
@@ -7558,6 +7557,16 @@ ast_process_struct_or_iface_block_members(exec_list *instructions,
}
}
+ /* Precision qualifiers do not hold any meaning in Desktop GLSL */
+ if (state->es_shader) {
+ fields[i].precision = select_gles_precision(qual->precision,
+ field_type,
+ state,
+ &loc);
+ } else {
+ fields[i].precision = qual->precision;
+ }
+
i++;
}
}
More information about the mesa-commit
mailing list