Bug 94488 - type mismatch of constant return value
Summary: type mismatch of constant return value
Status: RESOLVED NOTABUG
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: 11.1
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Ian Romanick
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-11 10:52 UTC by yousry
Modified: 2016-03-12 08:10 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description yousry 2016-03-11 10:52:05 UTC
The following trivial method creates a compile time error:

#version 330 core

...

float nothing()
{
    return 0;
}
...


2016-03-11 11:44:31.223 yaogl[4191:4191] [YAShader] Configuration: cs:0 vs:37 tcs:0 tes:0 gs:0 fs:38
2016-03-11 11:44:31.226 yaogl[4191:4191] [YAShader] Shader 37 compiled.
2016-03-11 11:44:31.236 yaogl[4191:4191] [YAShader] GLSL compiler error: 0:89(2): error: `return' with wrong type int, in function `nothing' returning float
2016-03-11 11:44:31.236 yaogl[4191:4191] [YAShader] Shader 38 compiled with errors.
Comment 1 Ian Romanick 2016-03-11 17:06:55 UTC
Implicit conversions on return values was added in GLSL 4.20 and GL_ARB_shading_language_420pack.  Section 1.2.6 (Summary of Changes from Version 4.10) of the GLSL 4.20 spec says, "Allow implicit conversions of return values to the declared type of the function."  The overview section of the GL_ARB_shading_language_420pack spec says the same thing.

Does this work if you add

#extension GL_ARB_shading_language_420pack: require

to the shader?
Comment 2 yousry 2016-03-12 08:10:55 UTC
GL_ARB_shading_language_420pack resolved the problem.


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.