Bug 25769 - [GLSL] "float" can be implicitly converted to "int"
[GLSL] "float" can be implicitly converted to "int"
Product: Mesa
Classification: Unclassified
Component: Mesa core
All All
: medium minor
Assigned To: Ian Romanick
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:


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: 
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;

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.

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:
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