Generate a warning when not writing gl_Position with GLES.
authorKalyan Kondapally <kondapallykalyancontribute@gmail.com>
Thu, 11 Sep 2014 03:20:23 +0000 (20:20 -0700)
committerTapani Pälli <tapani.palli@intel.com>
Mon, 15 Sep 2014 05:14:33 +0000 (08:14 +0300)
With GLES we don't give any kind of warning in case we don't
write to gl_position. This patch makes changes so that we
generate a warning in case of GLES (VER < 300) and an error
in case of GL.

Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
src/glsl/linker.cpp

index 97d29e257c16a2769cb68052f46a86b702e59882..7689198b066db229d7330e122bd589ac834f2ecf 100644 (file)
@@ -562,11 +562,18 @@ validate_vertex_shader_executable(struct gl_shader_program *prog,
     * All GLSL ES Versions are similar to GLSL 1.40--failing to write to
     * gl_Position is not an error.
     */
-   if (!prog->IsES && prog->Version < 140) {
+   if (prog->Version < (prog->IsES ? 300 : 140)) {
       find_assignment_visitor find("gl_Position");
       find.run(shader->ir);
       if (!find.variable_found()) {
-        linker_error(prog, "vertex shader does not write to `gl_Position'\n");
+        if (prog->IsES) {
+          linker_warning(prog,
+                         "vertex shader does not write to `gl_Position'."
+                         "It's value is undefined. \n");
+        } else {
+          linker_error(prog,
+                       "vertex shader does not write to `gl_Position'. \n");
+        }
         return;
       }
    }