Bug 25769 - [GLSL] "float" can be implicitly converted to "int"
Summary: [GLSL] "float" can be implicitly converted to "int"
Status: VERIFIED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: All All
: medium minor
Assignee: Ian Romanick
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 29044
  Show dependency treegraph
 
Reported: 2009-12-22 23:30 UTC by Gordon Jin
Modified: 2010-08-18 19:22 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gordon Jin 2009-12-22 23:30:46 UTC
GLSL is strict with type matching and doesn't allow automatic type conversion (except "int"->"float"), so below shader code is wrong but it is compiled successfully:
    int i = 1.0;

This impacts piglit case: 
piglit/tests/glslparsertest/shaders/dataType4.frag
Comment 1 DONGHE 2010-03-21 16:14:40 UTC
I had same kind of issue when testing MESA compiler.
Here is my clue to solve this problem, just enable this code in slang_codegen.c

#if 0 /* not used just yet - causes problems elsewhere */
   if (t0.spec.type == SLANG_SPEC_INT &&
       t1.spec.type == SLANG_SPEC_FLOAT)
      return GL_FALSE;
#endif

According to the comment on this code, to activate this code could cause other problems, so I guess you'd better run glean to test whether this change is safe for you.

DONG HE
Comment 2 Gordon Jin 2010-03-23 02:08:05 UTC
Let's keep it open until it's actually fixed
Comment 3 Gordon Jin 2010-07-05 01:48:15 UTC
Below piglit cases fail with the same reason:
comma1.vert
comma2.vert
comma3.vert
conditional3.frag
Comment 4 Eric Anholt 2010-08-17 09:12:28 UTC
Fixed in glsl2.
Comment 5 Gordon Jin 2010-08-18 19:22:10 UTC
verified with mesa master d442a01ac14382d83cdaac87d2832315ceb3e963


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.