Don't use the same vertex array in every menu driver

This commit is contained in:
twinaphex 2015-11-01 22:24:10 +01:00
parent b0c94e22fb
commit eefc33ef07
5 changed files with 16 additions and 36 deletions

View File

@ -104,13 +104,6 @@ typedef struct glui_handle
gfx_font_raster_block_t list_block;
} glui_handle_t;
static const GRfloat glui_vertexes[] = {
0, 0,
1, 0,
0, 1,
1, 1
};
static const GRfloat glui_tex_coords[] = {
0, 1,
1, 1,
@ -192,7 +185,6 @@ static void glui_draw_icon(gl_t *gl, glui_handle_t *glui,
matrix_4x4_multiply(&mymat, &mscal, &mymat);
coords.vertices = 4;
coords.vertex = glui_vertexes;
coords.tex_coord = glui_tex_coords;
coords.lut_tex_coord = glui_tex_coords;
coords.color = (const float*)color;
@ -246,7 +238,6 @@ static void glui_render_quad(gl_t *gl, int x, int y, int w, int h,
glui_handle_t *glui = (glui_handle_t*)menu->userdata;
coords.vertices = 4;
coords.vertex = glui_vertexes;
coords.tex_coord = glui_tex_coords;
coords.lut_tex_coord = glui_tex_coords;
coords.color = coord_color;
@ -586,7 +577,6 @@ static void glui_draw_cursor(gl_t *gl, glui_handle_t *glui,
matrix_4x4_multiply(&mymat, &mrot, &gl->mvp_no_rot);
coords.vertices = 4;
coords.vertex = glui_vertexes;
coords.tex_coord = glui_tex_coords;
coords.lut_tex_coord = glui_tex_coords;
coords.color = (const float*)color;
@ -726,7 +716,7 @@ static void glui_frame(void)
gl, width, height,
glui->textures.white, 0.75f, false,
&white_transp_bg[0], &white_bg[0],
&glui_vertexes[0], &glui_tex_coords[0], 4,
&glui_tex_coords[0], 4,
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
}
else
@ -748,7 +738,7 @@ static void glui_frame(void)
gl, width, height,
glui->textures.bg.id, 0.75f, true,
&white_transp_bg[0], &white_bg[0],
&glui_vertexes[0], &glui_tex_coords[0], 4,
&glui_tex_coords[0], 4,
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
/* Restore opacity of transposed white background */

View File

@ -224,13 +224,6 @@ typedef struct xmb_handle
gfx_font_raster_block_t raster_block;
} xmb_handle_t;
static const GRfloat rmb_vertex[] = {
0, 0,
1, 0,
0, 1,
1, 1,
};
static const GRfloat rmb_tex_coord[] = {
0, 1,
1, 1,
@ -368,7 +361,6 @@ static void xmb_draw_icon(gl_t *gl, xmb_handle_t *xmb,
matrix_4x4_multiply(&mymat, &mscal, &mymat);
coords.vertices = 4;
coords.vertex = rmb_vertex;
coords.tex_coord = rmb_tex_coord;
coords.lut_tex_coord = rmb_tex_coord;
coords.color = (const float*)color;
@ -400,7 +392,6 @@ static void xmb_draw_icon_predone(gl_t *gl, xmb_handle_t *xmb,
return;
coords.vertices = 4;
coords.vertex = rmb_vertex;
coords.tex_coord = rmb_tex_coord;
coords.lut_tex_coord = rmb_tex_coord;
coords.color = color;
@ -432,7 +423,6 @@ static void xmb_draw_boxart(gl_t *gl, xmb_handle_t *xmb, GRfloat *color, unsigne
matrix_4x4_multiply(&mymat, &mscal, &mymat);
coords.vertices = 4;
coords.vertex = rmb_vertex;
coords.tex_coord = rmb_tex_coord;
coords.lut_tex_coord = rmb_tex_coord;
coords.color = (const float*)color;
@ -1435,7 +1425,6 @@ static void xmb_draw_cursor(gl_t *gl, xmb_handle_t *xmb,
matrix_4x4_multiply(&mymat, &mrot, &gl->mvp_no_rot);
coords.vertices = 4;
coords.vertex = rmb_vertex;
coords.tex_coord = rmb_tex_coord;
coords.lut_tex_coord = rmb_tex_coord;
coords.color = (const float*)color;
@ -1603,7 +1592,7 @@ static void xmb_frame(void)
menu_display_frame_background(menu, settings,
gl, width, height, xmb->textures.bg.id, xmb->alpha, false, &coord_color[0],
&coord_color2[0], &rmb_vertex[0], &rmb_tex_coord[0], 4,
&coord_color2[0], &rmb_tex_coord[0], 4,
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
xmb_draw_text(menu, xmb,
@ -1713,7 +1702,7 @@ static void xmb_frame(void)
width, height,
xmb->textures.bg.id, xmb->alpha, true,
&coord_color[0], &coord_color2[0],
&rmb_vertex[0], &rmb_tex_coord[0], 4,
&rmb_tex_coord[0], 4,
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
xmb_frame_messagebox(msg);
}

View File

@ -200,13 +200,6 @@ static enum
LAY_SETTINGS
} layout = LAY_HOME;
static const GRfloat zarch_vertexes[] = {
0, 0,
1, 0,
0, 1,
1, 1
};
static const GRfloat zarch_tex_coords[] = {
0, 1,
1, 1,
@ -1073,7 +1066,7 @@ static void zarch_frame(void)
gl, zui->width, zui->height,
zui->textures.bg.id, 0.75f, false,
&coord_color[0], &coord_color2[0],
&zarch_vertexes[0], &zarch_tex_coords[0], 4,
&zarch_tex_coords[0], 4,
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
menu_display_font_flush_block(zui->menu, driver->font_osd_driver);

View File

@ -487,6 +487,13 @@ void menu_display_msg_queue_push(const char *msg, unsigned prio, unsigned durati
}
#ifdef HAVE_OPENGL
static const GRfloat menu_display_vertex[] = {
0, 0,
1, 0,
0, 1,
1, 1,
};
static GLenum menu_display_prim_to_gl_enum(enum menu_display_prim_type prim_type)
{
switch (prim_type)
@ -542,6 +549,9 @@ void menu_display_draw_frame(
if (height <= 0)
height = 1;
if (!coords->vertex)
coords->vertex = menu_display_vertex;
glViewport(x, y, width, height);
glBindTexture(GL_TEXTURE_2D, texture);
@ -562,7 +572,6 @@ void menu_display_frame_background(
bool force_transparency,
GRfloat *coord_color,
GRfloat *coord_color2,
const GRfloat *vertex,
const GRfloat *tex_coord,
size_t vertex_count,
enum menu_display_prim_type prim_type)
@ -572,7 +581,7 @@ void menu_display_frame_background(
global_t *global = global_get_ptr();
coords.vertices = vertex_count;
coords.vertex = vertex;
coords.vertex = menu_display_vertex;
coords.tex_coord = tex_coord;
coords.lut_tex_coord = tex_coord;
coords.color = (const float*)coord_color;

View File

@ -118,7 +118,6 @@ void menu_display_frame_background(
bool force_transparency,
GRfloat *color,
GRfloat *color2,
const GRfloat *vertex,
const GRfloat *tex_coord,
size_t vertex_count,
enum menu_display_prim_type prim_type