Bug 29626 - [swrast] glean glsl1 texture2D() regression
Summary: [swrast] glean glsl1 texture2D() regression
Status: CLOSED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Other (show other bugs)
Version: git
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Ian Romanick
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: mesa-7.9
  Show dependency treegraph
 
Reported: 2010-08-17 16:06 UTC by Vinson Lee
Modified: 2011-09-14 11:53 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Vinson Lee 2010-08-17 16:06:09 UTC
mesa: 8f5f44c9c8fa59e36efdf1acf3543ad81cb865d5 (master)

glean glsl1 texture2D() now fails but previously passed.

$ GLSL_TEST="texture2D()" glean -r results -t glsl1
FAILURE:
  Shader test: texture2D()
  Expected color: 1, 0, 0, 1
  Observed color: 0.498039, 0, 0, 1
glsl1:  FAIL rgb8, db, z16, s8, accrgba16, win+pmap, id 33
	0 tests passed, 1 tests failed.
Comment 1 Vinson Lee 2010-08-17 16:17:12 UTC
The regression is introduced with the glsl2 branch merge.
Comment 2 Ian Romanick 2010-09-03 12:27:10 UTC
(In reply to comment #1)
> The regression is introduced with the glsl2 branch merge.

Is this swrast the one built as a stand-alone libGL (e.g., make linux-x86) or swrast_dri.so?  This test has always failed on swrast_dri.so due to the alpha readback bug (alpha is always 0).

Though, looking more closely, swrast_dri.so gives this failure in addition to alpha=0.

FAILURE:
  Shader test: texture2D()
  Expected color: 1, 0, 0, 1
  Observed color: 0.498039, 0, 0, 0
Comment 3 Ian Romanick 2010-09-03 12:33:41 UTC
MESA_GLSL=dump shows the instructions listed below.  These look correct, so I'm not sure what the error is.

Mesa IR for linked fragment program 2:
  0: (tex (var_ref tex2d@0x90547c0)  (swiz xy (array_ref (var_ref gl_TexCoord@0x9050178) (constant int (0)) ) ) (0 0 0) 1 () )
     MOV TEMP[1], INPUT[4].xyyy;
  1: TEX TEMP[2], TEMP[1], texture[0], 2D;
  2: (assign (constant bool (1)) (xyzw) (var_ref gl_FragColor@0x9054530)  (tex (var_ref tex2d@0x90547c0)  (swiz xy (array_ref (var_ref gl_TexCoord@0x9050178) (constant int (0)) ) ) (0 0 0) 1 () )) 
     MOV OUTPUT[1], TEMP[2];
  3: END

Perhaps there's some bad interaction with fixed-function?  The test passes with hardware drivers, so this is odd.
Comment 4 Ian Romanick 2010-09-10 13:00:29 UTC
The problem seems to stem from the bogus way that swrast handles derivatives.  Since there's an extra MOV instruction, fetech_texel decides that there is no derivative available and fetches from the texture's base level.  This results in the wrong color.

I'm a little surprised that the copy propagation pass doesn't fix this.  I'll take a look into it, but I don't know that this will get fixed for 7.9.
Comment 5 Ian Romanick 2011-09-14 09:08:29 UTC
I just ran this test, and it passes.  I also don't see the extra MOV instruction in the generated code.
Comment 6 Vinson Lee 2011-09-14 11:53:25 UTC
mesa: 00792e3586746c833ffc9bb65712e38038916e06 (master)

Verified glean1 texture2D passes on swrast at the above commit.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.