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: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0744070364==" Return-path: Received: from culpepper.freedesktop.org (unknown [131.252.210.165]) by gabe.freedesktop.org (Postfix) with ESMTP id A8090E6B4A for ; Wed, 9 Oct 2013 14:17:52 -0700 (PDT) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============0744070364== Content-Type: multipart/alternative; boundary="1381353472.0eea0.13437"; charset="us-ascii" --1381353472.0eea0.13437 Date: Wed, 9 Oct 2013 21:17:52 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" https://bugs.freedesktop.org/show_bug.cgi?id=70327 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 --> 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. --1381353472.0eea0.13437 Date: Wed, 9 Oct 2013 21:17:52 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8"
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


You are receiving this mail because:
  • You are the assignee for the bug.
--1381353472.0eea0.13437-- --===============0744070364== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel --===============0744070364==--