dEQP-GLES3: dEQP-GLES3.functional.shaders.preprocessor.predefined_macros.line_2_vertex fails because of wrong __LINE__ values
@samuelig
Submitted by Samuel Iglesias Gonsálvez Assigned to Carl Worth @cworth
Description
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: 27bf37ba
Version: git