mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2024-11-22 22:05:38 +00:00
57 lines
1.3 KiB
PostScript
57 lines
1.3 KiB
PostScript
ps_3_0
|
|
|
|
; input declarations
|
|
dcl_color0 v0.xyzw
|
|
dcl_texcoord0 v1.xyzw
|
|
dcl_texcoord1 v2.xyzw
|
|
dcl_texcoord2 v3.xyzw
|
|
dcl_color1 v4.xyzw
|
|
|
|
dcl_2d s0
|
|
|
|
; constants
|
|
def c0, 1.0f, 0.0f, 0.0f, 0.5f
|
|
def c1, 0.00048828125f, 0.000244140625f, 0.0f, 0.0f
|
|
|
|
|
|
|
|
rcp r30, v2.z ; calculate 1/width
|
|
rcp r31, v2.w ; calculate 1/height
|
|
|
|
mov r31.xy, c0.yy ; r31.xy <- 0,0 \ hopefully co-issue...
|
|
mov r31.z, r30.z ; /
|
|
|
|
add r1.xyzw, v1.xyxy, r31.yyzy ; texel[0][0], texel[1][0]
|
|
add r2.xyzw, v1.xyxy, r31.ywzw ; texel[0][1], texel[1][1]
|
|
frc r1.xyzw, r1.xyzw
|
|
frc r2.xyzw, r2.xyzw
|
|
mul r3, r1, v2.zwzw ; mul by width, height
|
|
mul r4, r2, v2.zwzw ; mul by width, height
|
|
add r10, r3, v2.xyxy ; add tex base
|
|
add r11, r4, v2.xyxy ; add tex base
|
|
mul r10, r10, c1.xyxy ; div by 2048
|
|
mul r11, r11, c1.xyxy ; div by 2048
|
|
|
|
frc r18, r3
|
|
|
|
texld r5, r10.xy, s0
|
|
texld r6, r10.zw, s0
|
|
texld r7, r11.xy, s0
|
|
texld r8, r11.zw, s0
|
|
|
|
lrp r12, r18.xxxx, r6, r5
|
|
lrp r13, r18.xxxx, r8, r7
|
|
lrp r15, r18.yyyy, r13, r12
|
|
|
|
;if_lt v0.a, c0.x ; if polygon alpha is enabled use that instead of texture alpha
|
|
; mov r15.a, v0.a
|
|
;endif
|
|
|
|
if_ne v4.x, c0.y ; if v4.x == 0 -> color, if v4.x != -> texture
|
|
mul_sat r15, v0, r15 ; modulate with color
|
|
else
|
|
mov r15, v0
|
|
endif
|
|
;mov r15, v0
|
|
|
|
mov oC0, r15 |