1fa225cbcSrjs/*
2fa225cbcSrjs * Copyright © 2006 Intel Corporation
3fa225cbcSrjs *
4fa225cbcSrjs * Permission is hereby granted, free of charge, to any person obtaining a
5fa225cbcSrjs * copy of this software and associated documentation files (the "Software"),
6fa225cbcSrjs * to deal in the Software without restriction, including without limitation
7fa225cbcSrjs * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8fa225cbcSrjs * and/or sell copies of the Software, and to permit persons to whom the
9fa225cbcSrjs * Software is furnished to do so, subject to the following conditions:
10fa225cbcSrjs *
11fa225cbcSrjs * The above copyright notice and this permission notice (including the next
12fa225cbcSrjs * paragraph) shall be included in all copies or substantial portions of the
13fa225cbcSrjs * Software.
14fa225cbcSrjs *
15fa225cbcSrjs * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16fa225cbcSrjs * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17fa225cbcSrjs * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18fa225cbcSrjs * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19fa225cbcSrjs * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20fa225cbcSrjs * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21fa225cbcSrjs * IN THE SOFTWARE.
22fa225cbcSrjs *
23fa225cbcSrjs * Authors:
24fa225cbcSrjs *    Keith Packard <keithp@keithp.com>
25fa225cbcSrjs *    Eric Anholt <eric@anholt.net>
26fa225cbcSrjs *
27fa225cbcSrjs */
28fa225cbcSrjs
29fa225cbcSrjs/*
30fa225cbcSrjs * Inputs (note all sub-register addresses are bytes, not float indices)
31fa225cbcSrjs *
32fa225cbcSrjs * Note that the vertices will have been reordered:
33fa225cbcSrjs *
34fa225cbcSrjs * V0 is topmost (leftmost among topmost) (upper left)
35fa225cbcSrjs * V1 is next clockwise (lower right)
36fa225cbcSrjs * V2 is remaining (lower left)
37fa225cbcSrjs *
38fa225cbcSrjs *  V0 ...................... XX
39fa225cbcSrjs *  |                          .
40fa225cbcSrjs *  |                          .
41fa225cbcSrjs *  |                          .
42fa225cbcSrjs *  V2------------------------V1
43fa225cbcSrjs *
44fa225cbcSrjs *  G0	    thread state -- just pass along
45fa225cbcSrjs *
46fa225cbcSrjs *  G1 and G2 are fixed by SF spec
47fa225cbcSrjs *
48fa225cbcSrjs *  G1.0    reserved
49fa225cbcSrjs *  G1.4    Provoking vertex
50fa225cbcSrjs *  G1.8    Determinant
51fa225cbcSrjs *  G1.12   X1 - X0
52fa225cbcSrjs *  G1.16   X2 - X0
53fa225cbcSrjs *  G1.20   Y1 - Y0
54fa225cbcSrjs *  G1.24   Y2 - Y0
55fa225cbcSrjs *  G1.30   reserved
56fa225cbcSrjs *
57fa225cbcSrjs *  G2.0    Z0
58fa225cbcSrjs *  G2.4    1/W0
59fa225cbcSrjs *  G2.8    Z1
60fa225cbcSrjs *  G2.12   1/W1
61fa225cbcSrjs *  G2.16   Z2
62fa225cbcSrjs *  G2.20   1/W2
63fa225cbcSrjs *  G2.24   reserved
64fa225cbcSrjs *  G2.30   reserved
65fa225cbcSrjs *
66fa225cbcSrjs *  G3 is V0 Vertex Attribute Data from URB (upper left)
67fa225cbcSrjs *
68fa225cbcSrjs *  G3.0    u0
69fa225cbcSrjs *  G3.4    v0
70fa225cbcSrjs *
71fa225cbcSrjs *  G4 is V1 Vertex Attribute Data from URB (lower right)
72fa225cbcSrjs *
73fa225cbcSrjs *  G4.0    u1
74fa225cbcSrjs *  G4.4    v1
75fa225cbcSrjs *
76fa225cbcSrjs *  G5 is V2 Vertex Attribute Data from URB (lower left)
77fa225cbcSrjs *
78fa225cbcSrjs */
79fa225cbcSrjs
80fa225cbcSrjs/* Compute inverses of the input deltas */
81fa225cbcSrjssend (4) 0 g6<1>F g1.12<4,4,1>F math inv mlen 1 rlen 1 { align1 };
82fa225cbcSrjs
83fa225cbcSrjs/* texture location at V0 */
84fa225cbcSrjsmov (4) m3<1>F g3<4,4,1>F { align1 };
85fa225cbcSrjs
86fa225cbcSrjs/* compute V1 - V2 (motion in X) for texture coordinates */
87fa225cbcSrjsadd (4) g7<1>F g4<4,4,1>F -g5<4,4,1>F { align1 };
88fa225cbcSrjs
89fa225cbcSrjs/* multiply by 1/dx */
90fa225cbcSrjsmul (4) m1<1>F g7<4,4,1>F g6.0<0,1,0>F { align1 };
91fa225cbcSrjs
92fa225cbcSrjs/* Compute V2 - V0 (motion in Y) for texture coordinates */
93fa225cbcSrjsadd (4) g7<1>F g5<4,4,1>F -g3<4,4,1>F { align1 };
94fa225cbcSrjs
95fa225cbcSrjs/* multiply by 1/dy */
96fa225cbcSrjsmul (4) m2<1>F g7<4,4,1>F g6.8<0,1,0>F {align1 };
97fa225cbcSrjs
98fa225cbcSrjs/* and we're done */
99fa225cbcSrjssend (8) 0 null g0<8,8,1>F urb 0 transpose used complete mlen 4 rlen 0 { align1 EOT };
100fa225cbcSrjsnop;
101fa225cbcSrjsnop;
102fa225cbcSrjsnop;
103fa225cbcSrjsnop;
104fa225cbcSrjsnop;
105fa225cbcSrjsnop;
106fa225cbcSrjsnop;
107fa225cbcSrjsnop;
108