GL 3.2 and GLSL 1.50 specify that the ftransform() function is available only in the compatibility profile. GL 3.1 and GLSL 1.40 make a similar stipulation (except phrased in terms of ARB_compatibility).
Previous versions of GLSL make no such stipulation. However, since GL versions 3.1 and above are allowed to be mixed with older versions of GLSL, we need to avoid exposing ftransform() in the core profile for older GLSL versions too. Otherwise we open up a loophole to allow compatibility-only features to be used in a core context. To avoid exposing ftransform() in core contexts in GLSL 1.30, I had to remove it from the 110.vert, 120.vert, and 130.vert profile files, and move it to a new profile file called "compatibility.vert", which takes effect only when state->compatibility() returns true. --- src/glsl/builtins/profiles/110.vert | 2 -- src/glsl/builtins/profiles/120.vert | 2 -- src/glsl/builtins/profiles/130.vert | 2 -- src/glsl/builtins/profiles/compatibility.vert | 3 +++ src/glsl/builtins/tools/generate_builtins.py | 4 ++++ 5 files changed, 7 insertions(+), 6 deletions(-) delete mode 100644 src/glsl/builtins/profiles/130.vert create mode 100644 src/glsl/builtins/profiles/compatibility.vert diff --git a/src/glsl/builtins/profiles/110.vert b/src/glsl/builtins/profiles/110.vert index 2d32341..c10a2e9 100644 --- a/src/glsl/builtins/profiles/110.vert +++ b/src/glsl/builtins/profiles/110.vert @@ -1,7 +1,5 @@ #version 110 -vec4 ftransform(); - /* * 8.7 - Texture Lookup Functions * "The built-ins suffixed with "Lod" are only allowed in a vertex shader." diff --git a/src/glsl/builtins/profiles/120.vert b/src/glsl/builtins/profiles/120.vert index 41a1d96..a8bff18 100644 --- a/src/glsl/builtins/profiles/120.vert +++ b/src/glsl/builtins/profiles/120.vert @@ -1,7 +1,5 @@ #version 120 -vec4 ftransform(); - vec4 texture1DLod (sampler1D sampler, float coord, float lod); vec4 texture1DProjLod(sampler1D sampler, vec2 coord, float lod); vec4 texture1DProjLod(sampler1D sampler, vec4 coord, float lod); diff --git a/src/glsl/builtins/profiles/130.vert b/src/glsl/builtins/profiles/130.vert deleted file mode 100644 index 99d127e..0000000 --- a/src/glsl/builtins/profiles/130.vert +++ /dev/null @@ -1,2 +0,0 @@ -#version 130 -vec4 ftransform(); diff --git a/src/glsl/builtins/profiles/compatibility.vert b/src/glsl/builtins/profiles/compatibility.vert new file mode 100644 index 0000000..a8c7a70 --- /dev/null +++ b/src/glsl/builtins/profiles/compatibility.vert @@ -0,0 +1,3 @@ +#version 110 + +vec4 ftransform(); diff --git a/src/glsl/builtins/tools/generate_builtins.py b/src/glsl/builtins/tools/generate_builtins.py index 85bd5dd..83c8e12 100755 --- a/src/glsl/builtins/tools/generate_builtins.py +++ b/src/glsl/builtins/tools/generate_builtins.py @@ -289,6 +289,10 @@ _mesa_glsl_initialize_functions(struct _mesa_glsl_parse_state *state) version = version[:-2] check += 'state->language_version == ' + version check += ' && {0}state->es_shader'.format('' if is_es else '!') + elif version == 'compatibility': + # Special case: this profile should be included whenever + # compatibility-profile features are allowed. + check += 'state->compatibility()' else: # an extension name check += 'state->' + version + '_enable' -- 1.8.3.2 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev