[Mesa-dev] [PATCH] glsl: do not emit error for non written varyings on OpenGL ES

Tapani tapani.palli at intel.com
Tue Sep 16 09:56:58 PDT 2014


On 09/16/2014 05:48 PM, Ian Romanick wrote:
> On 09/16/2014 04:21 AM, Tapani Pälli wrote:
>> Patch fixes following test case from 'shaders-with-varyings' WebGL
>> conformance suite: "vertex shader with unused varying and fragment
>> shader with used varying must succeed"
> Oh bother.  Using the same rationale as before, could we get a warning
> from the linker?

Sure, will send a v2 patch with a warning.

>> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
>> ---
>>   src/glsl/link_varyings.cpp | 12 +++++++++++-
>>   1 file changed, 11 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp
>> index 54ceae1..fb2d88c 100644
>> --- a/src/glsl/link_varyings.cpp
>> +++ b/src/glsl/link_varyings.cpp
>> @@ -1451,7 +1451,7 @@ assign_varying_locations(struct gl_context *ctx,
>>   
>>            if (var && var->data.mode == ir_var_shader_in &&
>>                var->data.is_unmatched_generic_inout) {
>> -            if (prog->Version <= 120) {
>> +            if (prog->Version <= 120 && !prog->IsES) {
>>                  /* On page 25 (page 31 of the PDF) of the GLSL 1.20 spec:
>>                   *
>>                   *     Only those varying variables used (i.e. read) in
>> @@ -1463,6 +1463,16 @@ assign_varying_locations(struct gl_context *ctx,
>>                   * We interpret this text as meaning that the VS must
>>                   * write the variable for the FS to read it.  See
>>                   * "glsl1-varying read but not written" in piglit.
>> +                *
>> +                * Note that this is not an error on OpenGL ES:
>> +                *
>> +                * On Page 91 (Page 97 of the PDF) of the GLSL ES 1.0 spec:
>> +                *
>> +                *     If the vertex shader declares but doesn't write to a
>> +                *     varying and the fragment shader declares and reads it,
>> +                *     is this and error?
>> +                *
>> +                *     RESOLUTION: No.
>>                   */
>>   
>>                  linker_error(prog, "%s shader varying %s not written "
>>



More information about the mesa-dev mailing list