Bug 25771 - Implicit converting "int" to "float" should be allowed in GLSL
Summary: Implicit converting "int" to "float" should be allowed in GLSL
Alias: None
Product: piglit
Classification: Unclassified
Component: tests (show other bugs)
Version: unspecified
Hardware: All All
: medium normal
Assignee: Eric Anholt
QA Contact: Eric Anholt
Depends on:
Reported: 2009-12-22 23:42 UTC by Gordon Jin
Modified: 2010-01-05 00:52 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Note You need to log in before you can comment on or make changes to this bug.
Description Gordon Jin 2009-12-22 23:42:53 UTC
piglit/tests/glslparsertest/shaders/dataType5.frag expects it to fail:
void main()
    float f = 1; // int cannot be converted to float, use constructor to do the conversion explicitly

But section 4.1.10 "Implicit Conversions" of GLSL spec (v1.20 or 1.50) says this is allowed.
Comment 1 Ian Romanick 2009-12-23 11:59:45 UTC
This conversion is allowed, but only if the shader specifies '#version 120" or later.  If no #version is specified, the default version 110 is used.  In GLSL version 1.10 these automatic conversions are not allowed.

These GLSL tests were written by the authors of original the GLSL spec.  We should assume that any test failures are problems in our drivers, not in the tests.
Comment 2 Gordon Jin 2009-12-23 17:23:28 UTC
Thanks for the explanation. I was checking spec v1.20 and the latest v1.50, but didn't look into v1.10.

>> If no #version is specified, the default version 110 is used.
This default version is defined by mesa, right? Isn't mesa already supporting OpenGL 2.1 hence GLSL 1.2?
Comment 3 Ian Romanick 2009-12-25 00:39:33 UTC
The default is defined by the GLSL spec.  If no #version statement exists in the shader source, it is treated as if shader contained '#version 110'.  For example, see this language from page 10 of the GLSL 1.50 spec:

"Version 1.10 of the language does not require shaders to include this directive, and shaders that do not include a #version directive will be treated as targeting version 1.10."
Comment 4 Gordon Jin 2010-01-05 00:52:32 UTC
Agree this is not test case bug, but a driver bug.
I'm filing mesa bug#25877 to follow it up.

bug/show.html.tmpl processed on Feb 20, 2017 at 08:44:06.
(provided by the Example extension).