mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-26 09:41:15 +00:00
(3DS) refactor shaders. simplify texture combiner usage.
This commit is contained in:
parent
c370afd861
commit
ad0d73d8f0
@ -338,19 +338,12 @@ static void* ctr_init(const video_info_t* video,
|
||||
|
||||
GPU_SetTextureEnable(GPU_TEXUNIT0);
|
||||
|
||||
GPU_SetTexEnv(0,
|
||||
GPU_TEVSOURCES(GPU_TEXTURE0, GPU_PRIMARY_COLOR, 0),
|
||||
GPU_TEVSOURCES(GPU_TEXTURE0, GPU_PRIMARY_COLOR, 0),
|
||||
GPU_TEVOPERANDS(0, 0, 0),
|
||||
GPU_TEVOPERANDS(0, 0, 0),
|
||||
GPU_MODULATE, GPU_MODULATE,
|
||||
0xFFFFFFFF);
|
||||
|
||||
GPU_SetTexEnv(1, GPU_PREVIOUS,GPU_PREVIOUS, 0, 0, 0, 0, 0);
|
||||
GPU_SetTexEnv(2, GPU_PREVIOUS,GPU_PREVIOUS, 0, 0, 0, 0, 0);
|
||||
GPU_SetTexEnv(3, GPU_PREVIOUS,GPU_PREVIOUS, 0, 0, 0, 0, 0);
|
||||
GPU_SetTexEnv(4, GPU_PREVIOUS,GPU_PREVIOUS, 0, 0, 0, 0, 0);
|
||||
GPU_SetTexEnv(5, GPU_PREVIOUS,GPU_PREVIOUS, 0, 0, 0, 0, 0);
|
||||
GPU_SetTexEnv(0, GPU_TEXTURE0, GPU_TEXTURE0, 0, 0, GPU_REPLACE, GPU_REPLACE, 0);
|
||||
GPU_SetTexEnv(1, GPU_PREVIOUS, GPU_PREVIOUS, 0, 0, 0, 0, 0);
|
||||
GPU_SetTexEnv(2, GPU_PREVIOUS, GPU_PREVIOUS, 0, 0, 0, 0, 0);
|
||||
GPU_SetTexEnv(3, GPU_PREVIOUS, GPU_PREVIOUS, 0, 0, 0, 0, 0);
|
||||
GPU_SetTexEnv(4, GPU_PREVIOUS, GPU_PREVIOUS, 0, 0, 0, 0, 0);
|
||||
GPU_SetTexEnv(5, GPU_PREVIOUS, GPU_PREVIOUS, 0, 0, 0, 0, 0);
|
||||
|
||||
ctrGuSetAttributeBuffers(2,
|
||||
VIRT_TO_PHYS(ctr->menu.frame_coords),
|
||||
@ -615,15 +608,9 @@ static bool ctr_frame(void* data, const void* frame,
|
||||
/* restore */
|
||||
if (ctr->rgb32)
|
||||
{
|
||||
GPU_SetTexEnv(0,
|
||||
GPU_TEVSOURCES(GPU_TEXTURE0, GPU_PRIMARY_COLOR, 0),
|
||||
GPU_TEVSOURCES(GPU_TEXTURE0, GPU_PRIMARY_COLOR, 0),
|
||||
GPU_TEVOPERANDS(0, 0, 0),
|
||||
GPU_TEVOPERANDS(0, 0, 0),
|
||||
GPU_MODULATE, GPU_MODULATE,
|
||||
0xFFFFFFFF);
|
||||
GPU_SetTexEnv(1, GPU_PREVIOUS,GPU_PREVIOUS, 0, 0, 0, 0, 0);
|
||||
GPU_SetTexEnv(2, GPU_PREVIOUS,GPU_PREVIOUS, 0, 0, 0, 0, 0);
|
||||
GPU_SetTexEnv(0, GPU_TEXTURE0, GPU_TEXTURE0, 0, 0, GPU_REPLACE, GPU_REPLACE, 0);
|
||||
GPU_SetTexEnv(1, GPU_PREVIOUS, GPU_PREVIOUS, 0, 0, 0, 0, 0);
|
||||
GPU_SetTexEnv(2, GPU_PREVIOUS, GPU_PREVIOUS, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
if (ctr->menu_texture_enable)
|
||||
|
@ -1,65 +1,51 @@
|
||||
; Uniforms
|
||||
;.fvec scale_vector
|
||||
;.alias viewport_scale scale_vector.yxyx
|
||||
;.alias texture_scale scale_vector.zwzw
|
||||
.gsh
|
||||
.fvec c0_
|
||||
.entry main_gsh
|
||||
|
||||
.constf c20_(1.0, 1.0, 1.0, 1.0)
|
||||
.constf c21_(0.0, 0.0, 0.0, 0.0)
|
||||
.constf c22_(0.0, 1.0, 0.0, 1.0)
|
||||
.constf c23_(0.0, 0.0, -1.0, 1.0)
|
||||
; Constants
|
||||
.constf _01N1 (0.0, 1.0, -1.0, 1.0)
|
||||
.alias _0000 _01N1.xxxx
|
||||
.alias _1111 _01N1.yyyy
|
||||
.alias _0101 _01N1.xyxy
|
||||
.alias _N1N1 _01N1.zwzw
|
||||
|
||||
; Inputs
|
||||
.alias sprite_coords v0
|
||||
.alias tex_size v1
|
||||
.alias top_left sprite_coords.xyxy
|
||||
.alias bottom_right sprite_coords.zwzw
|
||||
|
||||
.out o0_ position
|
||||
.out o1_ color
|
||||
.out o2_ texcoord0
|
||||
; Outputs
|
||||
.out pos position
|
||||
.out texcoord texcoord0
|
||||
|
||||
.entry main_gsh
|
||||
.proc main_gsh
|
||||
setemit 0
|
||||
mov o0_.xy, v0
|
||||
|
||||
mov o0_.zw, c23_.zwzw
|
||||
mov o1_, c20_
|
||||
|
||||
mov o2_, v1
|
||||
mov pos.xy, top_left.xy
|
||||
mov pos.zw, _N1N1
|
||||
mov texcoord.xy, tex_size.xy
|
||||
emit
|
||||
|
||||
setemit 1
|
||||
mov o0_.x, v0
|
||||
mov o0_.y, v0.zwzw
|
||||
|
||||
mov o0_.zw, c23_.zwzw
|
||||
mov o1_, c20_
|
||||
|
||||
mov o2_.x, v1.zwzw
|
||||
mov o2_.yzw, v1.xyxy
|
||||
mov pos.x, top_left.x
|
||||
mov pos.y, bottom_right.y
|
||||
mov pos.zw, _N1N1
|
||||
mov texcoord.x, tex_size.z
|
||||
mov texcoord.y, tex_size.y
|
||||
emit
|
||||
|
||||
setemit 2, prim inv
|
||||
mov o0_.xy, v0.zw
|
||||
|
||||
mov o0_.zw, c23_.zwzw
|
||||
mov o1_, c20_
|
||||
|
||||
mov o2_, v1_.zwzw
|
||||
mov pos.xy, bottom_right.xy
|
||||
mov pos.zw, _N1N1
|
||||
mov texcoord.xy, tex_size.zw
|
||||
emit
|
||||
|
||||
setemit 1, prim
|
||||
mov o0_.x, v0.zwzw
|
||||
mov o0_.y, v0
|
||||
|
||||
mov o0_.zw, c23_.zwzw
|
||||
mov o1_, c20_
|
||||
|
||||
mov o2_.x, v1
|
||||
mov o2_.yzw, v1.zwzw
|
||||
mov pos.x, bottom_right.x
|
||||
mov pos.y, top_left.y
|
||||
mov pos.zw, _N1N1
|
||||
mov texcoord.x, tex_size.x
|
||||
mov texcoord.y, tex_size.w
|
||||
emit
|
||||
|
||||
|
||||
end
|
||||
.end
|
||||
|
@ -1,27 +1,33 @@
|
||||
; Uniforms
|
||||
;.fvec scale_vector
|
||||
;.alias viewport_scale scale_vector.yxyx
|
||||
;.alias texture_scale scale_vector.zwzw
|
||||
.fvec c0_
|
||||
;.vsh
|
||||
.entry main_vsh
|
||||
|
||||
.constf c20_(1.0, 1.0, 1.0, 1.0)
|
||||
.constf c21_(0.0, 0.0, 0.0, 0.0)
|
||||
.constf c22_(0.0, 1.0, 0.0, 1.0)
|
||||
.constf c23_(0.0, 0.0, -1.0, 1.0)
|
||||
; Uniforms
|
||||
.fvec scale_vector
|
||||
.alias viewport_scale scale_vector.yxyx
|
||||
.alias texture_scale scale_vector.zwzw
|
||||
|
||||
; Constants
|
||||
.constf _01N1 (0.0, 1.0, -1.0, 1.0)
|
||||
.alias _0000 _01N1.xxxx
|
||||
.alias _1111 _01N1.yyyy
|
||||
.alias _0101 _01N1.xyxy
|
||||
|
||||
; Inputs
|
||||
;.alias pos v0
|
||||
;.alias tex_coord v1
|
||||
.alias pos_in v0
|
||||
.alias texcoord_in v1
|
||||
|
||||
.out o0_ position
|
||||
.out o1_ texcoord0
|
||||
; Output
|
||||
.out pos position
|
||||
.out texcoord texcoord0
|
||||
.out color color
|
||||
|
||||
.entry main_vsh
|
||||
.proc main_vsh
|
||||
mul r0, c0_.yxyx, v0.yxwz
|
||||
add o0_, c20_, r0
|
||||
mul r1.zw, c0_.zwzw, v1.xyxy
|
||||
mov r1.xy, c21_
|
||||
add o1_, c22_, r1
|
||||
|
||||
mul r0, viewport_scale, pos_in.yxwz
|
||||
add pos, _1111, r0
|
||||
mul r1.zw, texture_scale, texcoord_in.xyxy
|
||||
mov r1.xy, _0000
|
||||
add texcoord, _0101, r1
|
||||
|
||||
end
|
||||
.end
|
||||
|
Loading…
Reference in New Issue
Block a user