- 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;
+ }