[Mesa-dev] [PATCH 2/2] glsl: allow linking ES shaders with desktop shaders in desktop GL
Timothy Arceri
tarceri at itsqueeze.com
Thu May 17 04:30:11 UTC 2018
On 17/05/18 14:23, Ilia Mirkin wrote:
> Was this trace taken with mesa? Looks like the app was subjected to
> adverse conditions...
Oh right I need a fresh trace the GLSL ES 1.10 is not supported issue
was cause by a dodgy change I made.
>
> 60876 glCreateShader(type = GL_VERTEX_SHADER) = 5
> 60877 glShaderSource(shader = 5, count = 1, string = &"#version 100
>
> uniform mat4 uClipFromEyeMatrix;
> uniform mat4 uStartFromModelMatrix;
> uniform mat4 uEyeFromStartMatrix;
> uniform mat4 uHeadFromStartMatrix;
> attribute vec3 aVertex;
> attribute vec2 aTexCoords;
> varying vec2 vTexCoords;
>
> void main(void) {
> vTexCoords = aTexCoords;
> gl_Position = uClipFromEyeMatrix * uEyeFromStartMatrix *
> uStartFromModelMatrix * vec4(aVertex, 1.);
> }
> ", length = NULL)
> 60878 glCompileShader(shader = 5)
> 60879 glGetShaderiv(shader = 5, pname = GL_COMPILE_STATUS, params = &0)
> 60880 glGetShaderInfoLog(shader = 5, bufSize = 2047, length = NULL,
> infoLog = "0:1(10): error: GLSL ES 1.10 is not supported. Supported
> versions are: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 1.00 ES, and 3.00 ES
> ")
> 60881 glDeleteShader(shader = 5)
>
> Dunno where GLSL ES 1.10 came from, but that's not even a thing. Nor
> is it requested... perhaps some kind of override going wrong?
>
> Anyways, it does seem to try to link version 100 + version 110
> together later on. But perhaps that only ends up happening because
> compiling the ES shader fails (from the application's standpoint)
>
> -ilia
>
> On Thu, May 17, 2018 at 12:12 AM, Timothy Arceri <tarceri at itsqueeze.com> wrote:
>>
>>
>> On 17/05/18 10:55, Ilia Mirkin wrote:
>>>
>>> ES has all kinds of additional linking rules. I suspect they'll break
>>> down if some of the shaders are ES and some are not-ES.
>>>
>>> This all does sound very odd -- what did you see in practice?
>>
>>
>> Here is a trace is you want to have a look at the various isses for
>> yourself:
>>
>> https://drive.google.com/open?id=16z5udwUFUmCbg9kEyO741ydXzgRLB7kK
>>
>>
>>>
>>> On Wed, May 16, 2018 at 3:04 AM, Timothy Arceri <tarceri at itsqueeze.com>
>>> wrote:
>>>>
>>>> In GLES shader versions must match but there is nothing
>>>> in the ARB_ES*_compatibility specs that say they must match.
>>>>
>>>> This fixes some compilation errors in Google Earth VR.
>>>> ---
>>>> src/compiler/glsl/linker.cpp | 6 ++++--
>>>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
>>>> index f060c5316fa..2b7ee0ad5a6 100644
>>>> --- a/src/compiler/glsl/linker.cpp
>>>> +++ b/src/compiler/glsl/linker.cpp
>>>> @@ -83,6 +83,7 @@
>>>> #include "builtin_functions.h"
>>>> #include "shader_cache.h"
>>>>
>>>> +#include "main/context.h"
>>>> #include "main/imports.h"
>>>> #include "main/shaderobj.h"
>>>> #include "main/enums.h"
>>>> @@ -4799,7 +4800,8 @@ link_shaders(struct gl_context *ctx, struct
>>>> gl_shader_program *prog)
>>>> min_version = MIN2(min_version, prog->Shaders[i]->Version);
>>>> max_version = MAX2(max_version, prog->Shaders[i]->Version);
>>>>
>>>> - if (prog->Shaders[i]->IsES != prog->Shaders[0]->IsES) {
>>>> + if (!_mesa_is_desktop_gl(ctx) &&
>>>> + prog->Shaders[i]->IsES != prog->Shaders[0]->IsES) {
>>>> linker_error(prog, "all shaders must use same shading "
>>>> "language version\n");
>>>> goto done;
>>>> @@ -4817,7 +4819,7 @@ link_shaders(struct gl_context *ctx, struct
>>>> gl_shader_program *prog)
>>>> /* In desktop GLSL, different shader versions may be linked
>>>> together. In
>>>> * GLSL ES, all shader versions must be the same.
>>>> */
>>>> - if (prog->Shaders[0]->IsES && min_version != max_version) {
>>>> + if (!_mesa_is_desktop_gl(ctx) && min_version != max_version) {
>>>> linker_error(prog, "all shaders must use same shading "
>>>> "language version\n");
>>>> goto done;
>>>> --
>>>> 2.17.0
>>>>
>>>> _______________________________________________
>>>> mesa-dev mailing list
>>>> mesa-dev at lists.freedesktop.org
>>>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list