Bug 89642

Summary: dEQP-GLES3: dEQP-GLES3.functional.shaders.preprocessor.predefined_macros.line_2_vertex fails because of wrong __LINE__ values
Product: Mesa Reporter: Samuel Iglesias Gonsálvez <siglesias>
Component: Mesa coreAssignee: Carl Worth <cworth>
Status: RESOLVED MOVED QA Contact: mesa-dev
Severity: normal    
Priority: medium CC: siglesias
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Samuel Iglesias Gonsálvez 2015-03-18 07:41:08 UTC
DEQP failed test:

dEQP-GLES3.functional.shaders.preprocessor.predefined_macros.line_2_vertex

-------

The test does a complex __LINE__ macro replacement. The shaders are created from the following template in modules/gles3/gles3/shader/preprocessor.test file:
         #version 300 es
         precision mediump float;
         ${DECLARATIONS:single-line}
         #define BBB      __LINE__, /*
            */ __LINE__
         #define AAA(a,b) BBB, a, b

         void main()
         {
            out0 = vec4(AAA(__LINE__,
                  __LINE__
                  ));
            ${OUTPUT}
         }

It expects to have out0 filled with (12, 12, 10, 11) values. Mesa gives (4, 5, 10, 11). I created a C program that mimics the shader (because Mesa follows a draft of C99 standard, see src/glsl/glcpp/README) but I got different results depending of which C compiler was used:

* gcc --std=c99 (or without c99, it doesn't matter) prints: 12, 12, 12, 12
* clang prints: 12, 12, 10, 11.

Mesa calculates the LINE macro values as the line numbers of where the macro is seen in the code before doing any expansion, as special case in glcpp-parse.y, function _glcpp_parser_expand_node().

-------

Tested on Haswell with Mesa master: 27bf37ba05b69ebf6f373d1637a26b4839265921
Comment 1 GitLab Migration User 2019-09-18 20:23:37 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/986.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.