1/* Assemble with  ".../intel-gen4asm/src/intel-gen4asm -g 7" */
2
3
4/* Move pixels into g10-g13. The pixel shaader does not load what you want. It
5 * loads the input data for a plane function to calculate what you want. The
6 * following is boiler plate code to move our normalized texture coordinates
7 * (u,v) into g10-g13. It does this 4 subspans (16 pixels) at a time.
8 *
9 * This should do the same thing, but it doesn't work for some reason.
10 *   pln(16) g10 g6<0,1,0>F g2<8,8,1>F	{ align1 };
11 *   pln(16) g12 g6.16<1>F g2<8,8,1>F	{ align1 };
12 */
13/* U */
14pln (8) g10<1>F g6.0<0,1,0>F g2.0<8,8,1>F { align1 }; /* pixel 0-7 */
15pln (8) g11<1>F g6.0<0,1,0>F g4.0<8,8,1>F { align1 }; /* pixel 8-15 */
16/* V */
17pln (8) g12<1>F g6.16<0,1,0> g2.0<8,8,1>F { align1 }; /* pixel 0-7 */
18pln (8) g13<1>F g6.16<0,1,0> g4.0<8,8,1>F { align1 }; /* pixel 8-15 */
19
20
21/* Next the we want the sampler to fetch the src texture (ie. src buffer). This
22 * is done with a pretty simple send message. The output goes to g112, which is
23 * exactly what we're supposed to use in our final send message.
24 * In intel-gen4asm, we should end up parsed by the following rule:
25 *   predicate SEND execsize dst sendleadreg sndopr directsrcoperand instoptions
26 *
27 * Send message descriptor:
28 * 28:25 = message len = 4 // our 4 registers have 16 pixels
29 * 24:20 = response len = 8 // Each pixel is RGBA32, so we need 8 registers
30 * 19:19 = header present = 0
31 * 18:17 = SIMD16 = 2
32 * 16:12 = TYPE = 0  (regular sample)
33 * 11:08 = Sampler index = ignored/0
34 * 7:0 = binding table index = src = 1
35 * 0x8840001
36 *
37 * Send message extra descriptor
38 * 5:5 = End of Thread = 0
39 * 3:0 = Target Function ID = SFID_SAMPLER (2)
40 * 0x2
41 */
42
43send(16) g112 g10 0x2 0x8840001 { align1 };
44
45/* g112-g119 now contains the sample source input, and all we must do is write
46 * it out to the destination render target. This is done with the send message
47 * as well. The only extra bits are to terminate the pixel shader.
48 *
49 * Send message descriptor:
50 * 28:25 = message len = 8 // 16 pixels RGBA32
51 * 24:20 = response len = 0
52 * 19:19 = header present = 0
53 * 17:14 = message type = Render Target Write (12)
54 * 12:12 = Last Render Target Select = 1
55 * 10:08 = Message Type = SIMD16 (0)
56 * 07:00 = Binding Table Index = dest = 0
57 * 0x10031000
58 *
59 * Send message extra descriptor
60 * 5:5 = End of Thread = 1
61 * 3:0 = Target Function ID = SFID_DP_RC (5)
62 * 0x25
63 */
64send(16) null g112  0x25 0x10031000 { align1, EOT };
65
66/* vim: set ft=c ts=4 sw=2 tw=80 et: */
67