[Bug 70327] New: Casting floating point variable to integer not working properly while constant gets converted properly

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Oct 9 23:17:52 CEST 2013


https://bugs.freedesktop.org/show_bug.cgi?id=70327

          Priority: medium
            Bug ID: 70327
          Assignee: dri-devel at lists.freedesktop.org
           Summary: Casting floating point variable to integer not working
                    properly while constant gets converted properly
          Severity: normal
    Classification: Unclassified
                OS: Linux (All)
          Reporter: tony.wasserka at dolphin-emu.org
          Hardware: All
            Status: NEW
           Version: git
         Component: Drivers/Gallium/r600
           Product: Mesa

Created attachment 87353
  --> https://bugs.freedesktop.org/attachment.cgi?id=87353&action=edit
Full rendered scene with bug visible

I've recently been working on converting the shaders used by the Dolphin
emulator to use integers instead of floating point numbers (for better
emulation accuracy). This seems to have exposed a bug in the r600g driver
possibly related to float->int casting.

The core of the issue is this GLSL code line:
"iprev.rgb = (iprev.rgb * (int(256.0-fog))) / 256;" (*)

where fog has been initialized before as 
"float fog = clamp(ze - fog_uniform.z, 0.0, 1.0);"

The point is, while "fog" seems to be zero (a "fog==0.0" condition in the code
will return true), the pixel shader result of (*) is different than the one
that I get by substituting "fog" with 0.0. This gets very apparent in the
rendered scene, cf

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20131009/aa385d98/attachment.html>


More information about the dri-devel mailing list