mirror of
https://github.com/libretro/RetroArch
synced 2025-03-22 07:21:15 +00:00
Avoid having to call expensive matrix identity functions
This commit is contained in:
parent
bac1f1fd51
commit
7a87917c58
@ -43,6 +43,14 @@ static const float d3d8_tex_coords[] = {
|
|||||||
1, 0
|
1, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static float d3d8_mvp_ident[16] =
|
||||||
|
{
|
||||||
|
1.0f, 0.0f, 0.0f, 0.0f,
|
||||||
|
0.0f, 1.0f, 0.0f, 0.0f,
|
||||||
|
0.0f, 0.0f, 1.0f, 0.0f,
|
||||||
|
0.0f, 0.0f, 0.0f, 1.0f
|
||||||
|
};
|
||||||
|
|
||||||
static const float *gfx_display_d3d8_get_default_vertices(void)
|
static const float *gfx_display_d3d8_get_default_vertices(void)
|
||||||
{
|
{
|
||||||
return &d3d8_vertexes[0];
|
return &d3d8_vertexes[0];
|
||||||
@ -55,10 +63,7 @@ static const float *gfx_display_d3d8_get_default_tex_coords(void)
|
|||||||
|
|
||||||
static void *gfx_display_d3d8_get_default_mvp(void *data)
|
static void *gfx_display_d3d8_get_default_mvp(void *data)
|
||||||
{
|
{
|
||||||
static math_matrix_4x4 id;
|
return &d3d8_mvp_ident[0];
|
||||||
matrix_4x4_identity(id);
|
|
||||||
|
|
||||||
return &id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static INT32 gfx_display_prim_to_d3d8_enum(
|
static INT32 gfx_display_prim_to_d3d8_enum(
|
||||||
@ -185,7 +190,7 @@ static void gfx_display_d3d8_draw(gfx_display_ctx_draw_t *draw,
|
|||||||
d3d8_vertex_buffer_unlock(d3d->menu_display.buffer);
|
d3d8_vertex_buffer_unlock(d3d->menu_display.buffer);
|
||||||
|
|
||||||
if (!draw->matrix_data)
|
if (!draw->matrix_data)
|
||||||
draw->matrix_data = gfx_display_d3d8_get_default_mvp(d3d);
|
draw->matrix_data = &d3d8_mvp_ident[0];
|
||||||
|
|
||||||
/* ugh */
|
/* ugh */
|
||||||
matrix_4x4_scale(m1, 2.0, 2.0, 0);
|
matrix_4x4_scale(m1, 2.0, 2.0, 0);
|
||||||
|
@ -43,6 +43,14 @@ static const float d3d9_tex_coords[] = {
|
|||||||
1, 0
|
1, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static float d3d9_mvp_ident[16] =
|
||||||
|
{
|
||||||
|
1.0f, 0.0f, 0.0f, 0.0f,
|
||||||
|
0.0f, 1.0f, 0.0f, 0.0f,
|
||||||
|
0.0f, 0.0f, 1.0f, 0.0f,
|
||||||
|
0.0f, 0.0f, 0.0f, 1.0f
|
||||||
|
};
|
||||||
|
|
||||||
static const float *gfx_display_d3d9_get_default_vertices(void)
|
static const float *gfx_display_d3d9_get_default_vertices(void)
|
||||||
{
|
{
|
||||||
return &d3d9_vertexes[0];
|
return &d3d9_vertexes[0];
|
||||||
@ -55,10 +63,7 @@ static const float *gfx_display_d3d9_get_default_tex_coords(void)
|
|||||||
|
|
||||||
static void *gfx_display_d3d9_get_default_mvp(void *data)
|
static void *gfx_display_d3d9_get_default_mvp(void *data)
|
||||||
{
|
{
|
||||||
static math_matrix_4x4 id;
|
return &d3d9_mvp_ident[0];
|
||||||
matrix_4x4_identity(id);
|
|
||||||
|
|
||||||
return &id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static INT32 gfx_display_prim_to_d3d9_enum(
|
static INT32 gfx_display_prim_to_d3d9_enum(
|
||||||
@ -147,9 +152,9 @@ static void gfx_display_d3d9_draw(gfx_display_ctx_draw_t *draw,
|
|||||||
color = draw->coords->color;
|
color = draw->coords->color;
|
||||||
|
|
||||||
if (!vertex)
|
if (!vertex)
|
||||||
vertex = gfx_display_d3d9_get_default_vertices();
|
vertex = &d3d9_vertexes[0];
|
||||||
if (!tex_coord)
|
if (!tex_coord)
|
||||||
tex_coord = gfx_display_d3d9_get_default_tex_coords();
|
tex_coord = &d3d9_tex_coords[0];
|
||||||
|
|
||||||
for (i = 0; i < draw->coords->vertices; i++)
|
for (i = 0; i < draw->coords->vertices; i++)
|
||||||
{
|
{
|
||||||
@ -178,7 +183,7 @@ static void gfx_display_d3d9_draw(gfx_display_ctx_draw_t *draw,
|
|||||||
d3d->menu_display.buffer);
|
d3d->menu_display.buffer);
|
||||||
|
|
||||||
if (!draw->matrix_data)
|
if (!draw->matrix_data)
|
||||||
draw->matrix_data = gfx_display_d3d9_get_default_mvp(d3d);
|
draw->matrix_data = &d3d9_mvp_ident[0];
|
||||||
|
|
||||||
/* ugh */
|
/* ugh */
|
||||||
matrix_4x4_scale(m1, 2.0, 2.0, 0);
|
matrix_4x4_scale(m1, 2.0, 2.0, 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user