Skip to content

Instantly share code, notes, and snippets.

@Subv
Created June 8, 2017 03:18
Show Gist options
  • Save Subv/555030b89bf5f2882d7cc2444214ed3f to your computer and use it in GitHub Desktop.
Save Subv/555030b89bf5f2882d7cc2444214ed3f to your computer and use it in GitHub Desktop.
; 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
; 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 outclr, inclr
; We're finished
end
.end
; Example PICA200 vertex shader
; Uniforms
.fvec projection[4]
; Constants
.constf myconst(0.0, 1.0, -1.0, 0.1)
.constf myconst2(0.3, 0.0, 0.0, 0.0)
.alias zeros myconst.xxxx ; Vector full of zeros
.alias ones myconst.yyyy ; Vector full of ones
; 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
; Force the w component of inpos to be 1.0
mov r0.xyz, inpos
mov r0.w, ones
; 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 outclr.xyzw, r2.xyzw
; We're finished
end
.end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment