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