summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/linker.cpp
diff options
context:
space:
mode:
authorIlia Mirkin <imirkin@alum.mit.edu>2016-05-23 21:38:38 -0400
committerIlia Mirkin <imirkin@alum.mit.edu>2016-05-23 22:22:06 -0400
commit979bcb9f4288564fb6c5807bcfbfd0a78176c3ef (patch)
tree3745984ea430424246cf087b03565f6a4dfb51ca /src/compiler/glsl/linker.cpp
parentf236f1f506f06440886450392f01992998fca7af (diff)
downloadexternal_mesa3d-979bcb9f4288564fb6c5807bcfbfd0a78176c3ef.zip
external_mesa3d-979bcb9f4288564fb6c5807bcfbfd0a78176c3ef.tar.gz
external_mesa3d-979bcb9f4288564fb6c5807bcfbfd0a78176c3ef.tar.bz2
glsl: add EXT_clip_cull_distance support based on ARB_cull_distance
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/compiler/glsl/linker.cpp')
-rw-r--r--src/compiler/glsl/linker.cpp39
1 files changed, 22 insertions, 17 deletions
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 3d95540..81a683e 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -661,7 +661,7 @@ analyze_clip_cull_usage(struct gl_shader_program *prog,
*clip_distance_array_size = 0;
*cull_distance_array_size = 0;
- if (!prog->IsES && prog->Version >= 130) {
+ if (prog->Version >= (prog->IsES ? 300 : 130)) {
/* From section 7.1 (Vertex Shader Special Variables) of the
* GLSL 1.30 spec:
*
@@ -669,13 +669,12 @@ analyze_clip_cull_usage(struct gl_shader_program *prog,
* gl_ClipVertex and gl_ClipDistance."
*
* This does not apply to GLSL ES shaders, since GLSL ES defines neither
- * gl_ClipVertex nor gl_ClipDistance.
+ * gl_ClipVertex nor gl_ClipDistance. However with
+ * GL_EXT_clip_cull_distance, this functionality is exposed in ES 3.0.
*/
- find_assignment_visitor clip_vertex("gl_ClipVertex");
find_assignment_visitor clip_distance("gl_ClipDistance");
find_assignment_visitor cull_distance("gl_CullDistance");
- clip_vertex.run(shader->ir);
clip_distance.run(shader->ir);
cull_distance.run(shader->ir);
@@ -685,20 +684,26 @@ analyze_clip_cull_usage(struct gl_shader_program *prog,
* a program to statically read or write both gl_ClipVertex and either
* gl_ClipDistance or gl_CullDistance.
*
- * This does not apply to GLSL ES shaders, since GLSL ES defines neither
- * gl_ClipVertex, gl_ClipDistance or gl_CullDistance.
+ * This does not apply to GLSL ES shaders, since GLSL ES doesn't define
+ * gl_ClipVertex.
*/
- if (clip_vertex.variable_found() && clip_distance.variable_found()) {
- linker_error(prog, "%s shader writes to both `gl_ClipVertex' "
- "and `gl_ClipDistance'\n",
- _mesa_shader_stage_to_string(shader->Stage));
- return;
- }
- if (clip_vertex.variable_found() && cull_distance.variable_found()) {
- linker_error(prog, "%s shader writes to both `gl_ClipVertex' "
- "and `gl_CullDistance'\n",
- _mesa_shader_stage_to_string(shader->Stage));
- return;
+ if (!prog->IsES) {
+ find_assignment_visitor clip_vertex("gl_ClipVertex");
+
+ clip_vertex.run(shader->ir);
+
+ if (clip_vertex.variable_found() && clip_distance.variable_found()) {
+ linker_error(prog, "%s shader writes to both `gl_ClipVertex' "
+ "and `gl_ClipDistance'\n",
+ _mesa_shader_stage_to_string(shader->Stage));
+ return;
+ }
+ if (clip_vertex.variable_found() && cull_distance.variable_found()) {
+ linker_error(prog, "%s shader writes to both `gl_ClipVertex' "
+ "and `gl_CullDistance'\n",
+ _mesa_shader_stage_to_string(shader->Stage));
+ return;
+ }
}
if (clip_distance.variable_found()) {