dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [Bug 70327] New: Casting floating point variable to integer not working properly while constant gets converted properly
@ 2013-10-09 21:17 bugzilla-daemon
  2013-10-09 21:22 ` [Bug 70327] " bugzilla-daemon
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: bugzilla-daemon @ 2013-10-09 21:17 UTC (permalink / raw)
  To: dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 1495 bytes --]

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.

[-- Attachment #1.2: Type: text/html, Size: 3049 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 70327] Casting floating point variable to integer not working properly while constant gets converted properly
  2013-10-09 21:17 [Bug 70327] New: Casting floating point variable to integer not working properly while constant gets converted properly bugzilla-daemon
@ 2013-10-09 21:22 ` bugzilla-daemon
  2013-10-09 21:24 ` bugzilla-daemon
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bugzilla-daemon @ 2013-10-09 21:22 UTC (permalink / raw)
  To: dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 550 bytes --]

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

--- Comment #1 from tony.wasserka@dolphin-emu.org ---
...cf. first attachment "Full rendered scene with bug visible". Second
attachement "Full rendered scene with software renderer" shows the same scene
rendered properly with "LIBGL_ALWAYS_SOFTWARE=1" (I don't know if it was using
llvmpipe or swrast, took halve a minute to render if that says anything).

I'll provide a way to reproduce the issue in a followup comment.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[-- Attachment #1.2: Type: text/html, Size: 1459 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 70327] Casting floating point variable to integer not working properly while constant gets converted properly
  2013-10-09 21:17 [Bug 70327] New: Casting floating point variable to integer not working properly while constant gets converted properly bugzilla-daemon
  2013-10-09 21:22 ` [Bug 70327] " bugzilla-daemon
@ 2013-10-09 21:24 ` bugzilla-daemon
  2013-10-09 21:24 ` bugzilla-daemon
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bugzilla-daemon @ 2013-10-09 21:24 UTC (permalink / raw)
  To: dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 321 bytes --]

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

--- Comment #2 from tony.wasserka@dolphin-emu.org ---
Created attachment 87355
  --> https://bugs.freedesktop.org/attachment.cgi?id=87355&action=edit
Full rendered scene with software renderer

-- 
You are receiving this mail because:
You are the assignee for the bug.

[-- Attachment #1.2: Type: text/html, Size: 1375 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 70327] Casting floating point variable to integer not working properly while constant gets converted properly
  2013-10-09 21:17 [Bug 70327] New: Casting floating point variable to integer not working properly while constant gets converted properly bugzilla-daemon
  2013-10-09 21:22 ` [Bug 70327] " bugzilla-daemon
  2013-10-09 21:24 ` bugzilla-daemon
@ 2013-10-09 21:24 ` bugzilla-daemon
  2013-10-09 21:30 ` bugzilla-daemon
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bugzilla-daemon @ 2013-10-09 21:24 UTC (permalink / raw)
  To: dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 589 bytes --]

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

tony.wasserka@dolphin-emu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #87353|0                           |1
        is obsolete|                            |

--- Comment #3 from tony.wasserka@dolphin-emu.org ---
Created attachment 87356
  --> https://bugs.freedesktop.org/attachment.cgi?id=87356&action=edit
Full rendered scene with bug visible

-- 
You are receiving this mail because:
You are the assignee for the bug.

[-- Attachment #1.2: Type: text/html, Size: 2192 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 70327] Casting floating point variable to integer not working properly while constant gets converted properly
  2013-10-09 21:17 [Bug 70327] New: Casting floating point variable to integer not working properly while constant gets converted properly bugzilla-daemon
                   ` (2 preceding siblings ...)
  2013-10-09 21:24 ` bugzilla-daemon
@ 2013-10-09 21:30 ` bugzilla-daemon
  2013-10-09 21:36 ` bugzilla-daemon
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bugzilla-daemon @ 2013-10-09 21:30 UTC (permalink / raw)
  To: dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 366 bytes --]

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

--- Comment #4 from tony.wasserka@dolphin-emu.org ---
Created attachment 87357
  --> https://bugs.freedesktop.org/attachment.cgi?id=87357&action=edit
dff file to reproduce the issue by rendering a subset of the reference scene in
Dolphin

-- 
You are receiving this mail because:
You are the assignee for the bug.

[-- Attachment #1.2: Type: text/html, Size: 1510 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 70327] Casting floating point variable to integer not working properly while constant gets converted properly
  2013-10-09 21:17 [Bug 70327] New: Casting floating point variable to integer not working properly while constant gets converted properly bugzilla-daemon
                   ` (3 preceding siblings ...)
  2013-10-09 21:30 ` bugzilla-daemon
@ 2013-10-09 21:36 ` bugzilla-daemon
  2013-10-09 21:43 ` bugzilla-daemon
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bugzilla-daemon @ 2013-10-09 21:36 UTC (permalink / raw)
  To: dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 350 bytes --]

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

--- Comment #5 from tony.wasserka@dolphin-emu.org ---
Created attachment 87359
  --> https://bugs.freedesktop.org/attachment.cgi?id=87359&action=edit
Output of R600_DEBUG=vs,ps,fs,sbdisasm when rendering the reduced scene

-- 
You are receiving this mail because:
You are the assignee for the bug.

[-- Attachment #1.2: Type: text/html, Size: 1462 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 70327] Casting floating point variable to integer not working properly while constant gets converted properly
  2013-10-09 21:17 [Bug 70327] New: Casting floating point variable to integer not working properly while constant gets converted properly bugzilla-daemon
                   ` (4 preceding siblings ...)
  2013-10-09 21:36 ` bugzilla-daemon
@ 2013-10-09 21:43 ` bugzilla-daemon
  2013-10-09 21:51 ` bugzilla-daemon
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bugzilla-daemon @ 2013-10-09 21:43 UTC (permalink / raw)
  To: dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 1365 bytes --]

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

--- Comment #6 from tony.wasserka@dolphin-emu.org ---
Steps the reproduce the issue:
1. Clone the dolphin repository from the url provided at
http://code.google.com/p/dolphin-emu/source/checkout
2. Checkout the tev_fixes_new branch at commit 5d8cfade42ce .
3. Build Dolphin with the build instructions outlined at
http://code.google.com/p/dolphin-emu/wiki/Linux_Build . We use CMake for our
build system, so if you're familiar with that you should be able to get it
running quickly.
4. run "dolphin-emu -b -e <path to the attached dff file>". Alternatively, run
Dolphin normally and open the dff file manually.
5. You should be able to see Mario (the main character of the game in the
rendered scene), and only Mario (I removed all unimportant stuff from the
scene). If you don't, try to make sure things work all by running any gamecube
demo elf (sorry, got no link) and following the instructions at
http://wiki.dolphin-emu.org/index.php?title=FifoPlayer under "How to play back
a fifo log?"


Basically, r600g renders the broken screenshot that I attached, while the
software renderer renders the scene fine. Replacing "fog" in the "iprev.rgb =
(iprev.rgb * (int(256.0-fog))) / 256;" line with "0.0" makes the scene render
correctly.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[-- Attachment #1.2: Type: text/html, Size: 2504 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 70327] Casting floating point variable to integer not working properly while constant gets converted properly
  2013-10-09 21:17 [Bug 70327] New: Casting floating point variable to integer not working properly while constant gets converted properly bugzilla-daemon
                   ` (5 preceding siblings ...)
  2013-10-09 21:43 ` bugzilla-daemon
@ 2013-10-09 21:51 ` bugzilla-daemon
  2013-10-09 22:16 ` bugzilla-daemon
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bugzilla-daemon @ 2013-10-09 21:51 UTC (permalink / raw)
  To: dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 556 bytes --]

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

--- Comment #7 from tony.wasserka@dolphin-emu.org ---
Created attachment 87360
  --> https://bugs.freedesktop.org/attachment.cgi?id=87360&action=edit
Sample GLSL shader that is used during rendering the glitched character

Attached you find one of the glitched GLSL shaders which uses the mentioned
line at line 149.

Sorry for the dumb source layout, that's because the shaders aren't hand
written but automatically generated.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[-- Attachment #1.2: Type: text/html, Size: 1668 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 70327] Casting floating point variable to integer not working properly while constant gets converted properly
  2013-10-09 21:17 [Bug 70327] New: Casting floating point variable to integer not working properly while constant gets converted properly bugzilla-daemon
                   ` (6 preceding siblings ...)
  2013-10-09 21:51 ` bugzilla-daemon
@ 2013-10-09 22:16 ` bugzilla-daemon
  2013-10-09 22:18 ` bugzilla-daemon
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bugzilla-daemon @ 2013-10-09 22:16 UTC (permalink / raw)
  To: dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 360 bytes --]

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

--- Comment #8 from tony.wasserka@dolphin-emu.org ---
Created attachment 87361
  --> https://bugs.freedesktop.org/attachment.cgi?id=87361&action=edit
R600_DEBUG=vs,ps,fs,sbdisasm for small scene with the shader that we actually
use

-- 
You are receiving this mail because:
You are the assignee for the bug.

[-- Attachment #1.2: Type: text/html, Size: 1492 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 70327] Casting floating point variable to integer not working properly while constant gets converted properly
  2013-10-09 21:17 [Bug 70327] New: Casting floating point variable to integer not working properly while constant gets converted properly bugzilla-daemon
                   ` (7 preceding siblings ...)
  2013-10-09 22:16 ` bugzilla-daemon
@ 2013-10-09 22:18 ` bugzilla-daemon
  2013-10-10  1:15 ` bugzilla-daemon
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bugzilla-daemon @ 2013-10-09 22:18 UTC (permalink / raw)
  To: dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 397 bytes --]

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

--- Comment #9 from tony.wasserka@dolphin-emu.org ---
Created attachment 87362
  --> https://bugs.freedesktop.org/attachment.cgi?id=87362&action=edit
R600_DEBUG=vs,ps,fs,sbdisasm for small scene with the shader where I replaced
"fog" with "0.0" in the problematic line

-- 
You are receiving this mail because:
You are the assignee for the bug.

[-- Attachment #1.2: Type: text/html, Size: 1663 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 70327] Casting floating point variable to integer not working properly while constant gets converted properly
  2013-10-09 21:17 [Bug 70327] New: Casting floating point variable to integer not working properly while constant gets converted properly bugzilla-daemon
                   ` (8 preceding siblings ...)
  2013-10-09 22:18 ` bugzilla-daemon
@ 2013-10-10  1:15 ` bugzilla-daemon
  2013-10-10  8:55 ` bugzilla-daemon
  2013-10-14  6:45 ` bugzilla-daemon
  11 siblings, 0 replies; 13+ messages in thread
From: bugzilla-daemon @ 2013-10-10  1:15 UTC (permalink / raw)
  To: dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 437 bytes --]

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

--- Comment #10 from Vadim Girlin <ptpzz@yandex.ru> ---
Created attachment 87364
  --> https://bugs.freedesktop.org/attachment.cgi?id=87364&action=edit
patch

This patch should fix the issue (only compile-tested so far, I can't test with
r600g card right now, but hopefully it's simple enough to be correct).

-- 
You are receiving this mail because:
You are the assignee for the bug.

[-- Attachment #1.2: Type: text/html, Size: 1498 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 70327] Casting floating point variable to integer not working properly while constant gets converted properly
  2013-10-09 21:17 [Bug 70327] New: Casting floating point variable to integer not working properly while constant gets converted properly bugzilla-daemon
                   ` (9 preceding siblings ...)
  2013-10-10  1:15 ` bugzilla-daemon
@ 2013-10-10  8:55 ` bugzilla-daemon
  2013-10-14  6:45 ` bugzilla-daemon
  11 siblings, 0 replies; 13+ messages in thread
From: bugzilla-daemon @ 2013-10-10  8:55 UTC (permalink / raw)
  To: dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 239 bytes --]

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

--- Comment #11 from tony.wasserka@dolphin-emu.org ---
I can confirm that the patch fixes the issue, thanks :)

-- 
You are receiving this mail because:
You are the assignee for the bug.

[-- Attachment #1.2: Type: text/html, Size: 1119 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug 70327] Casting floating point variable to integer not working properly while constant gets converted properly
  2013-10-09 21:17 [Bug 70327] New: Casting floating point variable to integer not working properly while constant gets converted properly bugzilla-daemon
                   ` (10 preceding siblings ...)
  2013-10-10  8:55 ` bugzilla-daemon
@ 2013-10-14  6:45 ` bugzilla-daemon
  11 siblings, 0 replies; 13+ messages in thread
From: bugzilla-daemon @ 2013-10-14  6:45 UTC (permalink / raw)
  To: dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 584 bytes --]

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

Fabio Pedretti <fabio.ped@libero.it> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #12 from Fabio Pedretti <fabio.ped@libero.it> ---
Applied in
http://cgit.freedesktop.org/mesa/mesa/commit/?id=10ddeb910ba8386a6b46396d827aed4116091b0b

-- 
You are receiving this mail because:
You are the assignee for the bug.

[-- Attachment #1.2: Type: text/html, Size: 2313 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-10-14  6:45 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-09 21:17 [Bug 70327] New: Casting floating point variable to integer not working properly while constant gets converted properly bugzilla-daemon
2013-10-09 21:22 ` [Bug 70327] " bugzilla-daemon
2013-10-09 21:24 ` bugzilla-daemon
2013-10-09 21:24 ` bugzilla-daemon
2013-10-09 21:30 ` bugzilla-daemon
2013-10-09 21:36 ` bugzilla-daemon
2013-10-09 21:43 ` bugzilla-daemon
2013-10-09 21:51 ` bugzilla-daemon
2013-10-09 22:16 ` bugzilla-daemon
2013-10-09 22:18 ` bugzilla-daemon
2013-10-10  1:15 ` bugzilla-daemon
2013-10-10  8:55 ` bugzilla-daemon
2013-10-14  6:45 ` bugzilla-daemon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).