Don't do rotate_z call for every draw_texture_slice call

This commit is contained in:
twinaphex 2021-09-21 21:38:07 +02:00
parent ecdf20ea49
commit 1ff024be26
4 changed files with 35 additions and 28 deletions

View File

@ -622,12 +622,12 @@ void gfx_display_draw_texture_slice(
int x, int y, unsigned w, unsigned h,
unsigned new_w, unsigned new_h,
unsigned width, unsigned height,
float *color, unsigned offset, float scale_factor, uintptr_t texture)
float *color, unsigned offset, float scale_factor, uintptr_t texture,
math_matrix_4x4 *mymat
)
{
gfx_display_ctx_draw_t draw;
gfx_display_ctx_rotate_draw_t rotate_draw;
struct video_coords coords;
math_matrix_4x4 mymat;
gfx_display_ctx_driver_t
*dispctx = p_disp->dispctx;
float V_BL[2], V_BR[2], V_TL[2], V_TR[2], T_BL[2], T_BR[2], T_TL[2], T_TR[2];
@ -725,12 +725,6 @@ void gfx_display_draw_texture_slice(
T_TR[0] = tex_woff;
T_TR[1] = 0.0f;
rotate_draw.matrix = &mymat;
rotate_draw.rotation = 0.0;
rotate_draw.scale_x = 1.0;
rotate_draw.scale_y = 1.0;
rotate_draw.scale_z = 1;
rotate_draw.scale_enable = true;
coords.vertices = 4;
coords.vertex = vert_coord;
coords.tex_coord = tex_coord;
@ -738,13 +732,11 @@ void gfx_display_draw_texture_slice(
draw.width = width;
draw.height = height;
draw.coords = &coords;
draw.matrix_data = &mymat;
draw.matrix_data = mymat;
draw.prim_type = GFX_DISPLAY_PRIM_TRIANGLESTRIP;
draw.pipeline_id = 0;
coords.color = (const float*)(color == NULL ? colors : color);
gfx_display_rotate_z(p_disp, &rotate_draw, userdata);
draw.texture = texture;
draw.x = 0;
draw.y = 0;

View File

@ -303,7 +303,8 @@ void gfx_display_draw_texture_slice(
int x, int y, unsigned w, unsigned h,
unsigned new_w, unsigned new_h,
unsigned width, unsigned height,
float *color, unsigned offset, float scale_factor, uintptr_t texture);
float *color, unsigned offset, float scale_factor, uintptr_t texture,
math_matrix_4x4 *mymat);
void gfx_display_rotate_z(gfx_display_t *p_disp,
gfx_display_ctx_rotate_draw_t *draw, void *data);

View File

@ -2484,7 +2484,8 @@ static void ozone_draw_cursor_slice(
unsigned video_height,
int x_offset,
unsigned width, unsigned height,
size_t y, float alpha)
size_t y, float alpha,
math_matrix_4x4 *mymat)
{
float scale_factor = ozone->last_scale_factor;
int slice_x = x_offset - 12 * scale_factor;
@ -2520,7 +2521,8 @@ static void ozone_draw_cursor_slice(
video_width, video_height,
ozone->theme_dynamic.cursor_alpha,
20, scale_factor,
ozone->theme->textures[OZONE_THEME_TEXTURE_CURSOR_NO_BORDER]
ozone->theme->textures[OZONE_THEME_TEXTURE_CURSOR_NO_BORDER],
mymat
);
/* Tainted border */
@ -2537,7 +2539,8 @@ static void ozone_draw_cursor_slice(
video_width, video_height,
ozone->theme_dynamic.cursor_border,
20, scale_factor,
ozone->textures[OZONE_TEXTURE_CURSOR_BORDER]
ozone->textures[OZONE_TEXTURE_CURSOR_BORDER],
mymat
);
if (dispctx && dispctx->blend_end)
@ -2650,7 +2653,8 @@ static void ozone_draw_cursor(
unsigned video_height,
int x_offset,
unsigned width, unsigned height,
size_t y, float alpha)
size_t y, float alpha,
math_matrix_4x4 *mymat)
{
int new_x = x_offset;
size_t new_y = y;
@ -2665,7 +2669,8 @@ static void ozone_draw_cursor(
p_disp,
userdata,
video_width, video_height,
new_x, width, height, new_y, alpha);
new_x, width, height, new_y, alpha,
mymat);
else
ozone_draw_cursor_fallback(ozone,
p_disp,
@ -2826,7 +2831,8 @@ static void ozone_draw_sidebar(
entry_width - ozone->dimensions.spacer_5px,
ozone->dimensions.sidebar_entry_height + ozone->dimensions.spacer_1px,
selection_y + ozone->animations.scroll_y_sidebar,
ozone->animations.cursor_alpha);
ozone->animations.cursor_alpha,
mymat);
if (ozone->cursor_in_sidebar_old)
ozone_draw_cursor(
@ -2839,7 +2845,8 @@ static void ozone_draw_sidebar(
entry_width - ozone->dimensions.spacer_5px,
ozone->dimensions.sidebar_entry_height + ozone->dimensions.spacer_1px,
selection_old_y + ozone->animations.scroll_y_sidebar,
1-ozone->animations.cursor_alpha);
1-ozone->animations.cursor_alpha,
mymat);
/* Menu tabs */
y = ozone->dimensions.header_height + ozone->dimensions.spacer_1px + ozone->dimensions.sidebar_padding_vertical;
@ -4520,7 +4527,8 @@ border_iterate:
entry_width - ozone->dimensions.spacer_5px,
button_height + ozone->dimensions.spacer_1px,
selection_y + scroll_y,
ozone->animations.cursor_alpha * alpha);
ozone->animations.cursor_alpha * alpha,
mymat);
/* Old*/
if (!ozone->cursor_in_sidebar_old)
@ -4539,7 +4547,8 @@ border_iterate:
entry_width - ozone->dimensions.spacer_5px,
button_height + ozone->dimensions.spacer_1px,
old_selection_y + scroll_y,
(1-ozone->animations.cursor_alpha) * alpha);
(1-ozone->animations.cursor_alpha) * alpha,
mymat);
/* Icons + text */
y = ozone->dimensions.header_height + ozone->dimensions.spacer_1px + ozone->dimensions.entry_padding_vertical;
@ -5574,7 +5583,8 @@ static void ozone_draw_messagebox(
void *userdata,
unsigned video_width,
unsigned video_height,
const char *message)
const char *message,
math_matrix_4x4 *mymat)
{
unsigned i, y_position;
char wrapped_message[MENU_SUBLABEL_MAX_LENGTH];
@ -5672,7 +5682,8 @@ static void ozone_draw_messagebox(
width, height,
ozone->theme_dynamic.message_background,
16, scale_factor,
ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_DIALOG_SLICE]
ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_DIALOG_SLICE],
mymat
);
}
@ -9380,7 +9391,8 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
userdata,
video_width,
video_height,
ozone->pending_message);
ozone->pending_message,
&mymat);
/* Flush second layer of text */
ozone_font_flush(video_width, video_height, &ozone->fonts.footer);

View File

@ -969,7 +969,8 @@ static void xmb_render_messagebox_internal(
gfx_display_t *p_disp,
unsigned video_width,
unsigned video_height,
xmb_handle_t *xmb, const char *message)
xmb_handle_t *xmb, const char *message,
math_matrix_4x4 *mymat)
{
unsigned i, y_position;
char wrapped_message[MENU_SUBLABEL_MAX_LENGTH];
@ -1051,7 +1052,8 @@ static void xmb_render_messagebox_internal(
video_width, video_height,
NULL,
xmb->margins_slice, xmb->last_scale_factor,
xmb->textures.list[XMB_TEXTURE_DIALOG_SLICE]);
xmb->textures.list[XMB_TEXTURE_DIALOG_SLICE],
mymat);
for (i = 0; i < list.size; i++)
{
@ -5454,7 +5456,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
userdata, video_width, video_height);
xmb_render_messagebox_internal(userdata, p_disp,
video_width, video_height,
xmb, msg);
xmb, msg, &mymat);
}
/* Cursor image */