libctru/examples/gpu/data/test.vsh

57 lines
1.5 KiB
V Shell
Raw Normal View History

2014-11-20 02:13:43 +01:00
; make sure you update aemstro_as for this (15/11/14)
2014-08-26 06:47:50 +02:00
2014-03-11 19:08:45 +01:00
; setup constants
2014-11-20 02:13:43 +01:00
.const 20, 1.0, 0.0, 0.5, 1.0
2014-08-26 06:47:50 +02:00
2014-03-11 19:08:45 +01:00
; setup outmap
.out o0, result.position
.out o1, result.color
.out o2, result.texcoord0
.out o3, result.texcoord1
.out o4, result.texcoord2
2014-11-20 02:13:43 +01:00
; setup uniform map (required to use SHDR_GetUniformRegister)
.uniform 0, 3, projection ; c0-c3 = projection matrix
.uniform 4, 7, modelview ; c4-c7 = modelview matrix
.uniform 8, 8, lightDirection ; c8 = light direction vector
.uniform 9, 9, lightAmbient ; c9 = light ambient color
2014-08-26 06:47:50 +02:00
2014-03-11 19:08:45 +01:00
;code
main:
2014-11-20 02:13:43 +01:00
mov r1, v0 (0x6)
mov r1, c20 (0x3)
2014-05-27 20:47:53 +02:00
; tempreg = mdlvMtx * in.pos
2014-11-20 02:13:43 +01:00
dp4 r0, c4, r1 (0x0)
dp4 r0, c5, r1 (0x1)
dp4 r0, c6, r1 (0x2)
mov r0, c20 (0x3)
2014-05-27 20:47:53 +02:00
; result.pos = projMtx * tempreg
2014-11-20 02:13:43 +01:00
dp4 o0, c0, r0 (0x0)
dp4 o0, c1, r0 (0x1)
dp4 o0, c2, r0 (0x2)
dp4 o0, c3, r0 (0x3)
2014-05-27 20:47:53 +02:00
; result.texcoord = in.texcoord
2014-11-20 02:13:43 +01:00
mov o2, v1 (0x5)
mov o3, c20 (0x7)
mov o4, c20 (0x7)
2014-05-27 20:47:53 +02:00
; result.color = crappy lighting
2014-11-20 02:13:43 +01:00
dp3 r0, c8, v2 (0x6)
max r0, c20, r0 (0x4)
mul r0, c9, r0 (0x8)
add o1, c9, r0 (0x6)
mov o1, c20 (0x3)
2014-03-11 19:08:45 +01:00
flush
end
endmain:
2014-08-26 06:47:50 +02:00
2014-03-11 19:08:45 +01:00
;operand descriptors
.opdesc x___, xyzw, xyzw ; 0x0
.opdesc _y__, xyzw, xyzw ; 0x1
.opdesc __z_, xyzw, xyzw ; 0x2
.opdesc ___w, xyzw, xyzw ; 0x3
2014-11-20 02:13:43 +01:00
.opdesc xyz_, yyyy, xyzw ; 0x4
2014-03-11 19:08:45 +01:00
.opdesc xyzw, xyzw, xyzw ; 0x5
2014-05-27 20:47:53 +02:00
.opdesc xyz_, xyzw, xyzw ; 0x6
.opdesc xyzw, yyyw, xyzw ; 0x7
2014-11-20 02:13:43 +01:00
.opdesc xyz_, wwww, xyzw ; 0x8