diff options
author | Ilia Mirkin <[email protected]> | 2016-05-23 21:38:38 -0400 |
---|---|---|
committer | Ilia Mirkin <[email protected]> | 2016-05-23 22:22:06 -0400 |
commit | 979bcb9f4288564fb6c5807bcfbfd0a78176c3ef (patch) | |
tree | 3745984ea430424246cf087b03565f6a4dfb51ca /src/compiler/glsl/linker.cpp | |
parent | f236f1f506f06440886450392f01992998fca7af (diff) |
glsl: add EXT_clip_cull_distance support based on ARB_cull_distance
Signed-off-by: Ilia Mirkin <[email protected]>
Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/compiler/glsl/linker.cpp')
-rw-r--r-- | src/compiler/glsl/linker.cpp | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 3d95540256c..81a683e9423 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()) { |