all repos — mgba @ 39230ca9acbf63224aadf43e030bfa7b95264181

mGBA Game Boy Advance Emulator

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; Uniforms
 9.fvec projectionMtx[4]
10.fvec textureMtx[2]
11
12; Constants
13.constf consts1(0.0, 1.0, -0.5, -1.0)
14
15; Outputs : here only position and color
16.out out_pos position
17.out out_tc0 texcoord0
18.out out_col color
19
20; Inputs : here we have only vertices
21.alias in_pos v0
22.alias in_tc0 v1
23.alias in_col v2
24
25.gsh
26.proc main
27	; Set up the vertex endpoints
28	mov r0.xy, in_pos.xy
29	mov r0.zw, consts1.zy
30	add r1.xy, r0.xy, in_pos.zw
31
32	dp4 r2.x, projectionMtx[0], r0
33	dp4 r2.y, projectionMtx[1], r0
34	dp4 r2.z, projectionMtx[2], r0
35	dp4 r2.w, projectionMtx[3], r0
36
37	dp4 r3.x, projectionMtx[0], r1
38	dp4 r3.y, projectionMtx[1], r1
39	dp4 r3.z, projectionMtx[2], r1
40	dp4 r3.w, projectionMtx[3], r1
41
42	; Set up the texture endpoints
43	mov r0.xy, in_tc0.xy
44	mov r0.zw, consts1.xy
45	add r1.xy, r0.xy, in_tc0.zw
46
47	dp4 r4.x, textureMtx[0], r0
48	dp4 r4.y, textureMtx[1], r0
49	mov r4.zw, consts1.xy
50
51	dp4 r5.x, textureMtx[0], r1
52	dp4 r5.y, textureMtx[1], r1
53	mov r5.zw, consts1.xy
54
55	; Emit top-left
56	setemit 0
57	mov out_pos.xyzw, r2.xyzw
58	mov out_tc0.xyzw, r4.xyzw
59	mov out_col, in_col
60	emit
61
62	; Emit bottom-left
63	setemit 1
64	mov out_pos.x, r2.x
65	mov out_pos.y, r3.y
66	mov out_pos.z, consts1.z
67	mov out_pos.w, consts1.y
68	mov out_tc0.x, r5.x
69	mov out_tc0.y, r4.y
70	mov out_tc0.z, consts1.x
71	mov out_tc0.w, consts1.y
72	mov out_col, in_col
73	emit
74
75	; Emit bottom-right
76	setemit 2, prim
77	mov out_pos.xyzw, r3.xyzw
78	mov out_tc0.xyzw, r5.xyzw
79	mov out_col, in_col
80	emit
81
82	; Emit top-right
83	setemit 1, prim inv
84	mov out_pos.x, r3.x
85	mov out_pos.y, r2.y
86	mov out_pos.z, consts1.z
87	mov out_pos.w, consts1.y
88	mov out_tc0.x, r4.x
89	mov out_tc0.y, r5.y
90	mov out_tc0.z, consts1.x
91	mov out_tc0.w, consts1.y
92	mov out_col, in_col
93	emit
94
95	end
96.end