103b705cfSriastradh/*
203b705cfSriastradh * Copyright © 2006 Intel Corporation
303b705cfSriastradh *
403b705cfSriastradh * Permission is hereby granted, free of charge, to any person obtaining a
503b705cfSriastradh * copy of this software and associated documentation files (the "Software"),
603b705cfSriastradh * to deal in the Software without restriction, including without limitation
703b705cfSriastradh * the rights to use, copy, modify, merge, publish, distribute, sublicense,
803b705cfSriastradh * and/or sell copies of the Software, and to permit persons to whom the
903b705cfSriastradh * Software is furnished to do so, subject to the following conditions:
1003b705cfSriastradh *
1103b705cfSriastradh * The above copyright notice and this permission notice (including the next
1203b705cfSriastradh * paragraph) shall be included in all copies or substantial portions of the
1303b705cfSriastradh * Software.
1403b705cfSriastradh *
1503b705cfSriastradh * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1603b705cfSriastradh * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1703b705cfSriastradh * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1803b705cfSriastradh * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1903b705cfSriastradh * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2003b705cfSriastradh * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
2103b705cfSriastradh * IN THE SOFTWARE.
2203b705cfSriastradh *
2303b705cfSriastradh * Authors:
2403b705cfSriastradh *    Keith Packard <keithp@keithp.com>
2503b705cfSriastradh *    Eric Anholt <eric@anholt.net>
2603b705cfSriastradh *    Wang Zhenyu <zhenyu.z.wang@intel.com>
2703b705cfSriastradh */
2803b705cfSriastradh
2903b705cfSriastradh/*
3003b705cfSriastradh * Inputs (note all sub-register addresses are bytes, not float indices)
3103b705cfSriastradh *
3203b705cfSriastradh * Note that the vertices will have been reordered:
3303b705cfSriastradh *
3403b705cfSriastradh * V0 is topmost (leftmost among topmost) (upper left)
3503b705cfSriastradh * V1 is next clockwise (lower right)
3603b705cfSriastradh * V2 is remaining (lower left)
3703b705cfSriastradh *
3803b705cfSriastradh *  V0 ...................... XX
3903b705cfSriastradh *  |                          .
4003b705cfSriastradh *  |                          .
4103b705cfSriastradh *  |                          .
4203b705cfSriastradh *  V2------------------------V1
4303b705cfSriastradh *
4403b705cfSriastradh *  G0	    thread state -- just pass along
4503b705cfSriastradh *
4603b705cfSriastradh *  G1 and G2 are fixed by SF spec
4703b705cfSriastradh *
4803b705cfSriastradh *  G1.0    reserved
4903b705cfSriastradh *  G1.4    Provoking vertex
5003b705cfSriastradh *  G1.8    Determinant
5103b705cfSriastradh *  G1.12   X1 - X0
5203b705cfSriastradh *  G1.16   X2 - X0
5303b705cfSriastradh *  G1.20   Y1 - Y0
5403b705cfSriastradh *  G1.24   Y2 - Y0
5503b705cfSriastradh *  G1.30   reserved
5603b705cfSriastradh *
5703b705cfSriastradh *  G2.0    Z0
5803b705cfSriastradh *  G2.4    1/W0
5903b705cfSriastradh *  G2.8    Z1
6003b705cfSriastradh *  G2.12   1/W1
6103b705cfSriastradh *  G2.16   Z2
6203b705cfSriastradh *  G2.20   1/W2
6303b705cfSriastradh *  G2.24   reserved
6403b705cfSriastradh *  G2.30   reserved
6503b705cfSriastradh *
6603b705cfSriastradh *  G3 is V0 Vertex Attribute Data from URB (upper left)
6703b705cfSriastradh *
6803b705cfSriastradh *  G3.0    u0
6903b705cfSriastradh *  G3.4    v0
7003b705cfSriastradh *
7103b705cfSriastradh *  G4 is V1 Vertex Attribute Data from URB (lower right)
7203b705cfSriastradh *
7303b705cfSriastradh *  G4.0    u1
7403b705cfSriastradh *  G4.4    v1
7503b705cfSriastradh *
7603b705cfSriastradh *  G5 is V2 Vertex Attribute Data from URB (lower left)
7703b705cfSriastradh *
7803b705cfSriastradh */
7903b705cfSriastradh
8003b705cfSriastradh/* Compute inverses of the input deltas */
8103b705cfSriastradhsend (4) 0 g6<1>F g1.12<4,4,1>F math inv mlen 1 rlen 1 { align1 };
8203b705cfSriastradh
8303b705cfSriastradh/* texture location at V0 */
8403b705cfSriastradhmov (8) m3<1>F g3<8,8,1>F { align1 };
8503b705cfSriastradh
8603b705cfSriastradh/* compute V1 - V2 (motion in X) for texture coordinates */
8703b705cfSriastradhadd (8) g7<1>F g4<8,8,1>F -g5<8,8,1>F { align1 };
8803b705cfSriastradh
8903b705cfSriastradh/* multiply by 1/dx */
9003b705cfSriastradhmul (8) m1<1>F g7<8,8,1>F g6.0<0,1,0>F { align1 };
9103b705cfSriastradh
9203b705cfSriastradh/* Compute V2 - V0 (motion in Y) for texture coordinates */
9303b705cfSriastradhadd (8) g7<1>F g5<8,8,1>F -g3<8,8,1>F { align1 };
9403b705cfSriastradh
9503b705cfSriastradh/* multiply by 1/dy */
9603b705cfSriastradhmul (8) m2<1>F g7<8,8,1>F g6.8<0,1,0>F {align1 };
9703b705cfSriastradh
9803b705cfSriastradh/* and we're done */
9903b705cfSriastradhsend (8) 0 null g0<8,8,1>F urb 0 transpose used complete mlen 4 rlen 0 { align1 EOT };
100