glsl: declare gl_Layer/gl_ViewportIndex/gl_ViewportMask as vs builtins
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Tue, 19 May 2020 12:42:19 +0000 (14:42 +0200)
committerMarge Bot <eric+marge@anholt.net>
Thu, 9 Jul 2020 11:59:09 +0000 (11:59 +0000)
commit49d35f3d882bd0f4418a1ce056344b8f06bd75dd
treebf1fd373a542b147349eae0904c38bbd7c3e46ca
parent26b75daef57c0ab7bde8dabf2a169bd755df51c3
glsl: declare gl_Layer/gl_ViewportIndex/gl_ViewportMask as vs builtins

Otherwise a VS doing the following:

out gl_PerVertex {
    vec4 gl_Position;
    int gl_ViewportIndex;
};

cannot be compiled because of the following error:
  "redeclaration of gl_PerVertex must be a subset of the built-in
  members of gl_PerVertex"

v2: add GLSL_PRECISION_HIGH param to add_varying() for "gl_Layer" in
    generate_fs_special_vars.
v3: add GLSL_PRECISION_HIGH param to add_varying() for "gl_Layer" in
    generate_varyings.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2946
Tested-by: John Galt <johngalt@fake.mail>
Reviewed-by: Marek Olšák <marek.olsak@amd.com> (v3)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v3)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5167>
src/compiler/glsl/builtin_variables.cpp