Created
June 8, 2017 03:20
-
-
Save Subv/a353aac5037bce35393123b1cec99ec6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Example PICA200 vertex shader | |
; Uniforms | |
.fvec projection[4] | |
; Constants | |
.constf myconst(0.0, 1.0, 0.0, 1.0) | |
.constf myconst2(1.0, 2.0, 3.0, 0.0) | |
.constf outofbounds(96.0, 0.0, 0.0, 0.0) | |
.alias zeros myconst.xxxx ; Vector full of zeros | |
.alias ones myconst.yyyy ; Vector full of ones | |
.alias cols myconst2.xyzw | |
.alias red myconst.yxxy | |
.alias green myconst.xyxy | |
.alias blue myconst.xxyy | |
; Outputs | |
.out outpos position | |
.out outclr color | |
; Inputs (defined as aliases for convenience) | |
.alias inpos v0 | |
.alias vertex_color v1 | |
.alias inclr v2 | |
.bool test | |
.proc main | |
mova a0, ones | |
nop | |
; Force the w component of inpos to be 1.0 | |
mov r0.xyz, inpos | |
mov r0.w, ones | |
; mov r2, vertex_color | |
; outpos = projectionMatrix * inpos | |
dp4 outpos.x, projection[0], r0 | |
dp4 outpos.y, projection[1], r0 | |
dp4 outpos.z, projection[2], r0 | |
dp4 outpos.w, projection[3], r0 | |
mov r8.xyzw, myconst[a0].xyzw | |
nop | |
mov outclr, r8 | |
; We're finished | |
end | |
.end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment