[Mesa-dev] [PATCH 59/70] mesa/glsl: move redeclares_gl_fragcoord to gl_shader
Timothy Arceri
timothy.arceri at collabora.com
Tue Dec 20 10:38:09 UTC 2016
This is never used in gl_linked_shader other than as a temp
during linking so just use a temp instead.
---
src/compiler/glsl/glsl_parser_extras.cpp | 3 +--
src/compiler/glsl/linker.cpp | 21 ++++++++-------------
src/mesa/main/mtypes.h | 3 ++-
3 files changed, 11 insertions(+), 16 deletions(-)
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
index b70b1dc..bd13e00 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -1808,8 +1808,7 @@ set_shader_inout_layout(struct gl_shader *shader,
break;
case MESA_SHADER_FRAGMENT:
- shader->info.redeclares_gl_fragcoord =
- state->fs_redeclares_gl_fragcoord;
+ shader->redeclares_gl_fragcoord = state->fs_redeclares_gl_fragcoord;
shader->info.uses_gl_fragcoord = state->fs_uses_gl_fragcoord;
shader->info.pixel_center_integer = state->fs_pixel_center_integer;
shader->info.origin_upper_left = state->fs_origin_upper_left;
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 2bbb112..e7c36e8 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -1825,7 +1825,7 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog,
struct gl_shader **shader_list,
unsigned num_shaders)
{
- linked_shader->info.redeclares_gl_fragcoord = false;
+ bool redeclares_gl_fragcoord = false;
linked_shader->info.uses_gl_fragcoord = false;
linked_shader->info.origin_upper_left = false;
linked_shader->info.pixel_center_integer = false;
@@ -1843,12 +1843,10 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog,
* it must be redeclared in all the fragment shaders in that program
* that have a static use gl_FragCoord."
*/
- if ((linked_shader->info.redeclares_gl_fragcoord
- && !shader->info.redeclares_gl_fragcoord
- && shader->info.uses_gl_fragcoord)
- || (shader->info.redeclares_gl_fragcoord
- && !linked_shader->info.redeclares_gl_fragcoord
- && linked_shader->info.uses_gl_fragcoord)) {
+ if ((redeclares_gl_fragcoord && !shader->redeclares_gl_fragcoord &&
+ shader->info.uses_gl_fragcoord)
+ || (shader->redeclares_gl_fragcoord && !redeclares_gl_fragcoord &&
+ linked_shader->info.uses_gl_fragcoord)) {
linker_error(prog, "fragment shader defined with conflicting "
"layout qualifiers for gl_FragCoord\n");
}
@@ -1858,8 +1856,7 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog,
* "All redeclarations of gl_FragCoord in all fragment shaders in a
* single program must have the same set of qualifiers."
*/
- if (linked_shader->info.redeclares_gl_fragcoord &&
- shader->info.redeclares_gl_fragcoord &&
+ if (redeclares_gl_fragcoord && shader->redeclares_gl_fragcoord &&
(shader->info.origin_upper_left !=
linked_shader->info.origin_upper_left ||
shader->info.pixel_center_integer !=
@@ -1873,10 +1870,8 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog,
* are multiple redeclarations, all the fields except uses_gl_fragcoord
* are already known to be the same.
*/
- if (shader->info.redeclares_gl_fragcoord ||
- shader->info.uses_gl_fragcoord) {
- linked_shader->info.redeclares_gl_fragcoord =
- shader->info.redeclares_gl_fragcoord;
+ if (shader->redeclares_gl_fragcoord || shader->info.uses_gl_fragcoord) {
+ redeclares_gl_fragcoord = shader->redeclares_gl_fragcoord;
linked_shader->info.uses_gl_fragcoord =
linked_shader->info.uses_gl_fragcoord ||
shader->info.uses_gl_fragcoord;
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 3793580..e4c7fdf 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2235,7 +2235,6 @@ struct gl_subroutine_function
struct gl_shader_info
{
bool uses_gl_fragcoord;
- bool redeclares_gl_fragcoord;
bool PostDepthCoverage;
bool InnerCoverage;
@@ -2429,6 +2428,8 @@ struct gl_shader
bool ARB_fragment_coord_conventions_enable;
+ bool redeclares_gl_fragcoord;
+
struct gl_shader_info info;
};
--
2.9.3
More information about the mesa-dev
mailing list