From mboxrd@z Thu Jan 1 00:00:00 1970
From: bugzilla-daemon@freedesktop.org
Subject: [Bug 104143] r600/sb: clobbers gl_Position -> gl_FragCoord
Date: Wed, 06 Dec 2017 11:32:43 +0000
Message-ID:
Created [details]
piglit screen output of simplified piglit
Created attachment 136002 [details]
Version of the piglit that passes copy of gl_Position and tests it
Bug ID | 104143 |
---|---|
Summary | r600/sb: clobbers gl_Position -> gl_FragCoord |
Product | Mesa |
Version | git |
Hardware | x86-64 (AMD64) |
OS | Linux (All) |
Status | NEW |
Severity | normal |
Priority | medium |
Component | Drivers/Gallium/r600 |
Assignee | dri-devel@lists.freedesktop.org |
Reporter | gw.fossdev@gmail.com |
QA Contact | dri-devel@lists.freedesktop.org |
Created at=
tachment 135998 [details]
piglit drawing output with sb enabled
With a variation of the piglit=20
spec/glsl-1.10/execution/variable-indexing/vs-output-array-vec2-index-wr
r600/sb clobbers the gl_Position/gl_FragCoord.
The variation consists in replacing two arrays of vec2 by one array of vec4=
and
swizzling the elements to achieve the same result (by effectively interleav=
ing
the two arrays).=20
A few observations:=20
* As can be seen from the colour coding screen shots, the array content is=
=20=20
correctly passed from the vertex shader to the fragment shader.=20
* The error only occurs for the uniform index value 0.=20
* When passing an additional parameter that contains a copy of gl_Position,
then this parameter seems to have the correct value (i.e. the vertex shad=
er
correctly evaluates gl_Position).
* The byte code doesn't doesn't give any obvious indication why things go w=
rong
with the optimized shader.=20
My mesa is at fa8c1b92b7.=20
best,=20
Gert
Created attachment 136003 [details]
Piglit screen output with R600_DEBUG=3Dnosb of shaders with extra pos param=
eter
Created attachment 135999 [details]=
Version of the original piglit that passes
Created attachment 136001 [details]
Version of the piglit that uses interleaved array and fails with sb
Created attachment 136004 [details]
Piglit output with extra pos parameter and sb enabled
In this image on can see that the (corrected) position passed as extra
parameter differs from the gl_Position for index=3D0 (colour coded differen=
ce),
but only for index 0.
Created attachment 136=
005 [details]
Shader dump with pos test
I found the problem:=20 if KC0[0].x =3D=3D index (=3D0):=20=20 1 x: ADD_INT T0.x, KC0[0].x, [0xfffffffe -nan].x 2 x: MOVA_INT __.x, T0.x Address register is now -2 and hence, in the next step R1 is unconditional= ly written, and this is actually the gl_Vertex value ... 3 z: MOV R[3+AR].z, 0 w: MOV R[3+AR].w, [0x3dcccccd 0.1].x that is here used to evaluate the gl_Posuition.=20 5 x: MUL_IEEE T0.x, KC0[1].w, R1.x y: MUL_IEEE T0.y, KC0[1].z, R1.x 6 t: MULADD_IEEE T0.y, KC0[2].z, R1.y, T0.y SCL_212 ... In the un-optimized shader R[3+AR].w is only written to if (KC0[0].x >= =3D 2), and hence AR >=3D 0; I.e. the sb optimizer is to aggressive in optimizing away the conditional blocks.
Patch: https://patchwork.freedesktop.org/patch/192036/
Gert, should we close this considering the patch (fix?) has la= nded?
What | Removed | Added |
---|---|---|
Resolution | --- | FIXED |
Status | NEW | RESOLVED |
Fixed with commit 6c268ea79af80a65a89a23854bdbe8bc1e99ab23