[Mesa-dev] [PATCH] Generate a warning when not writing gl_Position with GLES.

Anuj Phogat anuj.phogat at gmail.com
Thu Sep 11 15:35:10 PDT 2014


On Wed, Sep 10, 2014 at 8:20 PM, Kalyan Kondapally
<kondapallykalyancontribute at gmail.com> wrote:
> 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 at intel.com>
> ---
>  src/glsl/linker.cpp |   11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
> index e9cf550..f4a35e2 100644
> --- a/src/glsl/linker.cpp
> +++ b/src/glsl/linker.cpp
> @@ -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;
>        }
>     }
> --
> 1.7.9.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>


More information about the mesa-dev mailing list