src/platform/3ds/uishader.g.pica (view raw)
1; Copyright (c) 2015 Yuri Kunde Schlesner
2; Copyright (c) 2016 Jeffrey Pfau
3;
4; This Source Code Form is subject to the terms of the Mozilla Public
5; License, v. 2.0. If a copy of the MPL was not distributed with this
6; file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
8; Inputs
9.alias in_pos v0 ; [x, y, w, h]
10.alias in_tc0 v1 ; [u, v, uw, vh]
11.alias in_col v2
12.alias in_rot v3
13
14.gsh point c0
15
16; Uniforms
17.fvec projectionMtx[4]
18.fvec textureMtx[2]
19
20; Constants
21.constf consts1(0.0, 1.0, -0.5, -1.0)
22
23; Outputs
24.out out_pos position
25.out out_tc0 texcoord0
26.out out_col color
27
28.entry gshMain
29.proc gshMain
30 ; Set up the vertex endpoints
31 mov r0.xy, in_pos.zw
32 mov r0.zw, consts1.xx
33 mov r4.xy, in_pos.xy
34 add r5, r4.xyzw, r0.xwww
35 add r6, r4.xyzw, r0.xyww
36 add r7, r4.xyzw, r0.wyww
37
38 ; Create rotation matrix
39 mov r8, in_rot.xzww
40 mov r9, in_rot.yxww
41 mov r10.zw, consts1.zy
42
43 ; Transform coordinates
44 dp4 r10.x, r8, r4
45 dp4 r10.y, r9, r4
46 dp4 r0.x, projectionMtx[0], r10
47 dp4 r0.y, projectionMtx[1], r10
48 dp4 r0.z, projectionMtx[2], r10
49 dp4 r0.w, projectionMtx[3], r10
50
51 dp4 r10.x, r8, r5
52 dp4 r10.y, r9, r5
53 dp4 r1.x, projectionMtx[0], r10
54 dp4 r1.y, projectionMtx[1], r10
55 dp4 r1.z, projectionMtx[2], r10
56 dp4 r1.w, projectionMtx[3], r10
57
58 dp4 r10.x, r8, r6
59 dp4 r10.y, r9, r6
60 dp4 r2.x, projectionMtx[0], r10
61 dp4 r2.y, projectionMtx[1], r10
62 dp4 r2.z, projectionMtx[2], r10
63 dp4 r2.w, projectionMtx[3], r10
64
65 dp4 r10.x, r8, r7
66 dp4 r10.y, r9, r7
67 dp4 r3.x, projectionMtx[0], r10
68 dp4 r3.y, projectionMtx[1], r10
69 dp4 r3.z, projectionMtx[2], r10
70 dp4 r3.w, projectionMtx[3], r10
71
72 ; Set up the texture endpoints
73 mov r6.xy, in_tc0.xy
74 add r7.xy, r6.xy, in_tc0.zw
75
76 dp4 r4.x, textureMtx[0], r6
77 dp4 r4.y, textureMtx[1], r6
78 mov r4.zw, consts1.xy
79
80 dp4 r5.x, textureMtx[0], r7
81 dp4 r5.y, textureMtx[1], r7
82 mov r5.zw, consts1.xy
83
84 ; Emit top-left
85 setemit 0
86 mov out_pos, r0
87 mov out_tc0.xyzw, r4.xyzw
88 mov out_col, in_col
89 emit
90
91 ; Emit bottom-left
92 setemit 1
93 mov out_pos, r1
94 mov out_tc0.x, r5.x
95 mov out_tc0.y, r4.y
96 mov out_tc0.z, consts1.x
97 mov out_tc0.w, consts1.y
98 mov out_col, in_col
99 emit
100
101 ; Emit bottom-right
102 setemit 2, prim
103 mov out_pos, r2
104 mov out_tc0.xyzw, r5.xyzw
105 mov out_col, in_col
106 emit
107
108 ; Emit top-right
109 setemit 1, prim inv
110 mov out_pos, r3
111 mov out_tc0.x, r4.x
112 mov out_tc0.y, r5.y
113 mov out_tc0.z, consts1.x
114 mov out_tc0.w, consts1.y
115 mov out_col, in_col
116 emit
117
118 end
119.end