[3DS] Allow sideways screen rotation

This commit is contained in:
Justin Weiss 2020-10-27 21:13:19 -07:00
parent ce14fef217
commit 91c695ac52
4 changed files with 29 additions and 4 deletions

View File

@ -773,6 +773,7 @@ static bool ctr_frame(void* data, const void* frame,
GSPGPU_FlushDataCache(ctr->frame_coords, sizeof(ctr_vertex_t));
}
GPUCMD_AddWrite(GPUREG_GSH_BOOLUNIFORM, ctr->rotation & 1);
ctrGuSetVertexShaderFloatUniform(0, (float*)&ctr->scale_vector, 1);
ctrGuSetTexture(GPU_TEXUNIT0, VIRT_TO_PHYS(ctr->texture_swizzled), ctr->texture_width, ctr->texture_height,
(ctr->smooth? GPU_TEXTURE_MAG_FILTER(GPU_LINEAR) | GPU_TEXTURE_MIN_FILTER(GPU_LINEAR)
@ -854,6 +855,7 @@ static bool ctr_frame(void* data, const void* frame,
GPU_TEXTURE_WRAP_S(GPU_CLAMP_TO_EDGE) | GPU_TEXTURE_WRAP_T(GPU_CLAMP_TO_EDGE),
GPU_RGBA4);
GPUCMD_AddWrite(GPUREG_GSH_BOOLUNIFORM, 0);
ctrGuSetVertexShaderFloatUniform(0, (float*)&ctr->menu.scale_vector, 1);
ctrGuSetAttributeBuffersAddress(VIRT_TO_PHYS(ctr->menu.frame_coords));

View File

@ -5,6 +5,7 @@
.constf _N1N1 (-1.0, 1.0, -1.0, 1.0)
; Inputs
.alias rotate b0
.alias sprite_coords v0
.alias tex_frame_coords v1 ;(0.0, 1.0, w/tex_w, 1.0 - h/tex_h)
@ -26,25 +27,45 @@
setemit 0
mov pos.xy, top_left.xy
mov pos.zw, _N1N1
mov texcoord.xy, tex_top_left.xy
ifu rotate
mov texcoord.xy, tex_top_right.xy
.else
mov texcoord.xy, tex_top_left.xy
.end
emit
setemit 1
mov pos.xy, bottom_left.xy
mov pos.zw, _N1N1
mov texcoord.xy, tex_bottom_left.xy
ifu rotate
mov texcoord.xy, tex_top_left.xy
.else
mov texcoord.xy, tex_bottom_left.xy
.end
emit
setemit 2, prim inv
mov pos.xy, bottom_right.xy
mov pos.zw, _N1N1
mov texcoord.xy, tex_bottom_right.xy
ifu rotate
mov texcoord.xy, tex_bottom_left.xy
.else
mov texcoord.xy, tex_bottom_right.xy
.end
emit
setemit 1, prim
mov pos.xy, top_right.xy
mov pos.zw, _N1N1
mov texcoord.xy, tex_top_right.xy
ifu rotate
mov texcoord.xy, tex_bottom_right.xy
.else
mov texcoord.xy, tex_top_right.xy
.end
emit
end

View File

@ -49,6 +49,7 @@ static void gfx_display_ctr_draw(gfx_display_ctx_draw_t *draw,
ctr_set_scale_vector(&scale_vector,
CTR_TOP_FRAMEBUFFER_WIDTH, CTR_TOP_FRAMEBUFFER_HEIGHT,
texture->width, texture->height);
GPUCMD_AddWrite(GPUREG_GSH_BOOLUNIFORM, 0);
ctrGuSetVertexShaderFloatUniform(0, (float*)&scale_vector, 1);
if ((ctr->vertex_cache.size - (ctr->vertex_cache.current

View File

@ -230,6 +230,7 @@ static void ctr_font_render_line(
if (v == ctr->vertex_cache.current)
return;
GPUCMD_AddWrite(GPUREG_GSH_BOOLUNIFORM, 0);
ctrGuSetVertexShaderFloatUniform(0, (float*)&font->scale_vector, 1);
GSPGPU_FlushDataCache(ctr->vertex_cache.current,
(v - ctr->vertex_cache.current) * sizeof(ctr_vertex_t));