Skip to contentSkip to conversation

New: r600g: Sampling from an alpha texture in a fragment shader

Bug 31810 [email protected] 1 participant 4 messages Nov 21, 2010 – Nov 22, 2010

lore
Share & tools
lore
#0 lore raw

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

Summary: r600g: Sampling from an alpha texture in a fragment
shader
Product: Mesa
Version: git
Platform: Other
OS/Version: All
Status: NEW
Severity: normal
Priority: medium
Component: Drivers/Gallium/r600
AssignedTo: [email protected]
ReportedBy: [email protected]

Created an attachment (id=40447)
--> (https://bugs.freedesktop.org/attachment.cgi?id=40447)
piglit patch described

The attach piglit addition works on g600c and softpipe fails on r600g.

(The test is close to minimal, but not having diagnosed the bug I don't know if "sampling from an alpha texture" is the fundamental thing that needs to be tested or not... or there could even be failing piglit tests elsewhere that are showing the same problem.)

The TGSI looks right:

DCL IN[0], COLOR, LINEAR
DCL IN[1], GENERIC[0], PERSPECTIVE
DCL OUT[0], COLOR
DCL SAMP[0]
DCL TEMP[0]
0: TEX TEMP[0], IN[1], SAMP[0], 2D
1: MUL OUT[0], IN[0], TEMP[0].wwww
2: END
VERT

Despite spending a lot of time fooling around this yesterday and checking what I thought were the obvious things I really have no idea what is going on; hopefully it will be obvious for someone more familiar with the R700 shader code.

Signature · 3 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
#1 lore raw

[Bug 31810] r600g: Sampling from an alpha texture in a fragment shader

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

Owen Taylor <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

  Attachment #40447|0                           |1

is obsolete| |

--- Comment #1 from Owen Taylor <[email protected]> 2010-11-21 06:53:37 PST --- Created an attachment (id=40449)
View: https://bugs.freedesktop.org/attachment.cgi?id=40449
Review: https://bugs.freedesktop.org/review?bug=31810&attachment=40449

Slightly simpler version of Piglit test

Here's a slightly simpler version of the test (gets rid of multiplying by a color)

I'm a little reluctant to provide any of the results of my experiments trying to understand this, since I'm still confused and maybe will just confuse anybody following on, but in the SQ_TEX_WORD1 generated from:

0: TEX TEMP[0], IN[0], SAMP[0], 2D

If I manually tweak the DST_SEL_X/DEST_SEL_Y/DEST_SEL_Z/DEST_SEL_W I see the following results for the loaded stored into the temporary:

Sel Result
xyzw xyzw
---------
1000 1000
0100 0100
0010 0010
0001 0001

0w00 0000
0w01 0001

100w 1001
1w00 1100 (example A)

w000 w000
w001 w001
ww01 ww01 (example B)
w100 w100
w00w w00w

So, in the marked example A above, if I set DST_SEL_X to SQ_SEL_1 and DST_SEL_Y to SQ_SEL_W and DST_SEL_Z and DST_SEL_W to SQ_SEL_0, then I end up with a value that has 1's for x and y, and 0's for z and w.

Possibly wrong interpretation: In all the cases above what you an observe is that the value of a component is the same as if you first replaced w with the value selected by DST_SEL_X and then applied the actual selector.

So, DST_SEL_Y=SQ_SEL_W in example A gave us 1 because DST_SEL_X=SQ_SEL_1, but in example B it gave us w because DST_SEL_X=SQ_SEL_1.

This might have something to do with the interaction with the swizzle inherent to the A8 texture format that sets X,Y,Z=0 and W=X. That would match up with this only occurring for A8 textures and not for RGBA textures. but I don't understand why a swizzle at texture load time would cause the selectors from INST_TEX to have a double effect. Anyways, I'm still confused. I don't really have time to work on this more, but if it isn't obvious, then one possible approach would be to compare the bytecode and texture setup of the classic driver (which works for this) to what the gallium driver is doing.

Oh, and I should mention that I did my testing on an RV710, in case it's a r6xx/r7xx difference.

Signature · 3 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
#2 lore raw

[Bug 31810] r600g: Sampling from an alpha texture in a fragment shader

In reply to [email protected]

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

--- Comment #2 from Dave Airlie <[email protected]> 2010-11-21 21:56:01 PST --- just FYI for anyone else looking at this:

its something to do with the staged texture upload code. disabling it makes it all a lot happier

Signature · 3 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
#3 lore raw

[Bug 31810] r600g: Sampling from an alpha texture in a fragment shader

In reply to [email protected]

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

Dave Airlie <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #3 from Dave Airlie <[email protected]> 2010-11-21 22:05:49 PST --- should be fixed by
d5aadf0d80e8c973ef5cf9d82e97f23f0e3c032b in mesa master.

Thanks Owen for the test program made it a lot easier to track down.

Signature · 3 lines
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.