From mboxrd@z Thu Jan 1 00:00:00 1970
From: bugzilla-daemon@freedesktop.org
Subject: [Bug 70327] New: Casting floating point variable to integer not
working properly while constant gets converted properly
Date: Wed, 09 Oct 2013 21:17:52 +0000
Message-ID:
Priority
medium
Bug ID
70327
Assignee
dri-devel@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@dolphin-emu.org
Hardware
All
Status
NEW
Version
git
Component
Drivers/Gallium/r600
Product
Mesa
Created attachment 87353 [details]
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