mirror of
https://github.com/libretro/RetroArch
synced 2025-03-25 16:44:01 +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_SetTextureEnable(GPU_TEXUNIT0);
|
||||||
|
|
||||||
GPU_SetTexEnv(0,
|
GPU_SetTexEnv(0, GPU_TEXTURE0, GPU_TEXTURE0, 0, 0, GPU_REPLACE, GPU_REPLACE, 0);
|
||||||
GPU_TEVSOURCES(GPU_TEXTURE0, GPU_PRIMARY_COLOR, 0),
|
GPU_SetTexEnv(1, GPU_PREVIOUS, GPU_PREVIOUS, 0, 0, 0, 0, 0);
|
||||||
GPU_TEVSOURCES(GPU_TEXTURE0, GPU_PRIMARY_COLOR, 0),
|
GPU_SetTexEnv(2, GPU_PREVIOUS, GPU_PREVIOUS, 0, 0, 0, 0, 0);
|
||||||
GPU_TEVOPERANDS(0, 0, 0),
|
GPU_SetTexEnv(3, GPU_PREVIOUS, GPU_PREVIOUS, 0, 0, 0, 0, 0);
|
||||||
GPU_TEVOPERANDS(0, 0, 0),
|
GPU_SetTexEnv(4, GPU_PREVIOUS, GPU_PREVIOUS, 0, 0, 0, 0, 0);
|
||||||
GPU_MODULATE, GPU_MODULATE,
|
GPU_SetTexEnv(5, GPU_PREVIOUS, GPU_PREVIOUS, 0, 0, 0, 0, 0);
|
||||||
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);
|
|
||||||
|
|
||||||
ctrGuSetAttributeBuffers(2,
|
ctrGuSetAttributeBuffers(2,
|
||||||
VIRT_TO_PHYS(ctr->menu.frame_coords),
|
VIRT_TO_PHYS(ctr->menu.frame_coords),
|
||||||
@ -615,15 +608,9 @@ static bool ctr_frame(void* data, const void* frame,
|
|||||||
/* restore */
|
/* restore */
|
||||||
if (ctr->rgb32)
|
if (ctr->rgb32)
|
||||||
{
|
{
|
||||||
GPU_SetTexEnv(0,
|
GPU_SetTexEnv(0, GPU_TEXTURE0, GPU_TEXTURE0, 0, 0, GPU_REPLACE, GPU_REPLACE, 0);
|
||||||
GPU_TEVSOURCES(GPU_TEXTURE0, GPU_PRIMARY_COLOR, 0),
|
GPU_SetTexEnv(1, GPU_PREVIOUS, GPU_PREVIOUS, 0, 0, 0, 0, 0);
|
||||||
GPU_TEVSOURCES(GPU_TEXTURE0, GPU_PRIMARY_COLOR, 0),
|
GPU_SetTexEnv(2, GPU_PREVIOUS, GPU_PREVIOUS, 0, 0, 0, 0, 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctr->menu_texture_enable)
|
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
|
.gsh
|
||||||
.fvec c0_
|
.entry main_gsh
|
||||||
|
|
||||||
.constf c20_(1.0, 1.0, 1.0, 1.0)
|
; Constants
|
||||||
.constf c21_(0.0, 0.0, 0.0, 0.0)
|
.constf _01N1 (0.0, 1.0, -1.0, 1.0)
|
||||||
.constf c22_(0.0, 1.0, 0.0, 1.0)
|
.alias _0000 _01N1.xxxx
|
||||||
.constf c23_(0.0, 0.0, -1.0, 1.0)
|
.alias _1111 _01N1.yyyy
|
||||||
|
.alias _0101 _01N1.xyxy
|
||||||
|
.alias _N1N1 _01N1.zwzw
|
||||||
|
|
||||||
; Inputs
|
; Inputs
|
||||||
.alias sprite_coords v0
|
.alias sprite_coords v0
|
||||||
.alias tex_size v1
|
.alias tex_size v1
|
||||||
|
.alias top_left sprite_coords.xyxy
|
||||||
|
.alias bottom_right sprite_coords.zwzw
|
||||||
|
|
||||||
.out o0_ position
|
; Outputs
|
||||||
.out o1_ color
|
.out pos position
|
||||||
.out o2_ texcoord0
|
.out texcoord texcoord0
|
||||||
|
|
||||||
.entry main_gsh
|
|
||||||
.proc main_gsh
|
.proc main_gsh
|
||||||
setemit 0
|
setemit 0
|
||||||
mov o0_.xy, v0
|
mov pos.xy, top_left.xy
|
||||||
|
mov pos.zw, _N1N1
|
||||||
mov o0_.zw, c23_.zwzw
|
mov texcoord.xy, tex_size.xy
|
||||||
mov o1_, c20_
|
|
||||||
|
|
||||||
mov o2_, v1
|
|
||||||
emit
|
emit
|
||||||
|
|
||||||
setemit 1
|
setemit 1
|
||||||
mov o0_.x, v0
|
mov pos.x, top_left.x
|
||||||
mov o0_.y, v0.zwzw
|
mov pos.y, bottom_right.y
|
||||||
|
mov pos.zw, _N1N1
|
||||||
mov o0_.zw, c23_.zwzw
|
mov texcoord.x, tex_size.z
|
||||||
mov o1_, c20_
|
mov texcoord.y, tex_size.y
|
||||||
|
|
||||||
mov o2_.x, v1.zwzw
|
|
||||||
mov o2_.yzw, v1.xyxy
|
|
||||||
emit
|
emit
|
||||||
|
|
||||||
setemit 2, prim inv
|
setemit 2, prim inv
|
||||||
mov o0_.xy, v0.zw
|
mov pos.xy, bottom_right.xy
|
||||||
|
mov pos.zw, _N1N1
|
||||||
mov o0_.zw, c23_.zwzw
|
mov texcoord.xy, tex_size.zw
|
||||||
mov o1_, c20_
|
|
||||||
|
|
||||||
mov o2_, v1_.zwzw
|
|
||||||
emit
|
emit
|
||||||
|
|
||||||
setemit 1, prim
|
setemit 1, prim
|
||||||
mov o0_.x, v0.zwzw
|
mov pos.x, bottom_right.x
|
||||||
mov o0_.y, v0
|
mov pos.y, top_left.y
|
||||||
|
mov pos.zw, _N1N1
|
||||||
mov o0_.zw, c23_.zwzw
|
mov texcoord.x, tex_size.x
|
||||||
mov o1_, c20_
|
mov texcoord.y, tex_size.w
|
||||||
|
|
||||||
mov o2_.x, v1
|
|
||||||
mov o2_.yzw, v1.zwzw
|
|
||||||
emit
|
emit
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
.end
|
.end
|
||||||
|
@ -1,27 +1,33 @@
|
|||||||
; Uniforms
|
;.vsh
|
||||||
;.fvec scale_vector
|
.entry main_vsh
|
||||||
;.alias viewport_scale scale_vector.yxyx
|
|
||||||
;.alias texture_scale scale_vector.zwzw
|
|
||||||
.fvec c0_
|
|
||||||
|
|
||||||
.constf c20_(1.0, 1.0, 1.0, 1.0)
|
; Uniforms
|
||||||
.constf c21_(0.0, 0.0, 0.0, 0.0)
|
.fvec scale_vector
|
||||||
.constf c22_(0.0, 1.0, 0.0, 1.0)
|
.alias viewport_scale scale_vector.yxyx
|
||||||
.constf c23_(0.0, 0.0, -1.0, 1.0)
|
.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
|
; Inputs
|
||||||
;.alias pos v0
|
.alias pos_in v0
|
||||||
;.alias tex_coord v1
|
.alias texcoord_in v1
|
||||||
|
|
||||||
.out o0_ position
|
; Output
|
||||||
.out o1_ texcoord0
|
.out pos position
|
||||||
|
.out texcoord texcoord0
|
||||||
|
.out color color
|
||||||
|
|
||||||
.entry main_vsh
|
|
||||||
.proc main_vsh
|
.proc main_vsh
|
||||||
mul r0, c0_.yxyx, v0.yxwz
|
|
||||||
add o0_, c20_, r0
|
mul r0, viewport_scale, pos_in.yxwz
|
||||||
mul r1.zw, c0_.zwzw, v1.xyxy
|
add pos, _1111, r0
|
||||||
mov r1.xy, c21_
|
mul r1.zw, texture_scale, texcoord_in.xyxy
|
||||||
add o1_, c22_, r1
|
mov r1.xy, _0000
|
||||||
|
add texcoord, _0101, r1
|
||||||
|
|
||||||
end
|
end
|
||||||
.end
|
.end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user