[Mesa-stable] [PATCH 3/3] glsl: Apply the link error conditions to GL_ARB_fragment_coord_conventions
Anuj Phogat
anuj.phogat at gmail.com
Tue Feb 11 02:29:58 CET 2014
Link error conditions added in previous patch are equally applicable
to GL_ARB_fragment_coord_conventions implementation. Extension's spec
says:
"If gl_FragCoord is redeclared in any fragment shader in a program,
it must be redeclared in all the fragment shaders in that program
that have a static use of gl_FragCoord. All redeclarations of
gl_FragCoord in all fragment shaders in a single program must have
the same set of qualifiers."
Cc: <mesa-stable at lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
src/glsl/glsl_parser_extras.cpp | 2 ++
src/glsl/linker.cpp | 7 ++++++-
src/mesa/main/mtypes.h | 6 ++++++
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 07fd1c7..89a8dbd 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -1391,6 +1391,8 @@ set_shader_inout_layout(struct gl_shader *shader,
shader->uses_gl_fragcoord = state->uses_gl_fragcoord;
shader->pixel_center_integer = state->fs_pixel_center_integer;
shader->origin_upper_left = state->fs_origin_upper_left;
+ shader->ARB_fragment_coord_conventions_enable =
+ state->ARB_fragment_coord_conventions_enable;
break;
default:
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index f8564ca..8f700ce 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1230,7 +1230,8 @@ link_fs_input_layout_qualifiers(struct gl_shader_program *prog,
linked_shader->origin_upper_left = false;
linked_shader->pixel_center_integer = false;
- if (linked_shader->Stage != MESA_SHADER_FRAGMENT || prog->Version < 150)
+ if (linked_shader->Stage != MESA_SHADER_FRAGMENT ||
+ (prog->Version < 150 && !prog->ARB_fragment_coord_conventions_enable))
return;
/* From the GLSL 1.50 spec, page 39:
@@ -2120,6 +2121,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
ralloc_free(prog->AtomicBuffers);
prog->AtomicBuffers = NULL;
prog->NumAtomicBuffers = 0;
+ prog->ARB_fragment_coord_conventions_enable = false;
/* Separate the shaders into groups based on their type.
*/
@@ -2146,6 +2148,9 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
goto done;
}
+ prog->ARB_fragment_coord_conventions_enable |=
+ prog->Shaders[i]->ARB_fragment_coord_conventions_enable;
+
gl_shader_stage shader_type = prog->Shaders[i]->Stage;
shader_list[shader_type][num_shaders[shader_type]] = prog->Shaders[i];
num_shaders[shader_type]++;
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index bbb6231..5e18faa 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2413,6 +2413,7 @@ struct gl_shader
bool uses_builtin_functions;
bool uses_gl_fragcoord;
+ bool ARB_fragment_coord_conventions_enable;
/**
* Fragment shader state from GLSL 1.50 layout qualifiers.
@@ -2736,6 +2737,11 @@ struct gl_shader_program
* \c NULL.
*/
struct gl_shader *_LinkedShaders[MESA_SHADER_STAGES];
+
+ /* True if any of the fragment shaders attached to this program use:
+ * #extension ARB_fragment_coord_conventions: enable
+ */
+ GLboolean ARB_fragment_coord_conventions_enable;
};
--
1.8.3.1
More information about the mesa-stable
mailing list