gl1: fix matrix not loading when threaded video is on

This commit is contained in:
Brad Parker 2019-03-17 12:45:54 -04:00
parent cd5e844ee4
commit a8a06d498c
3 changed files with 24 additions and 19 deletions

View File

@ -468,7 +468,6 @@ static void draw_tex(gl1_t *gl1, int pot_width, int pot_height, int width, int h
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
/*glLoadMatrixf(gl1->mvp.data);*/
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
@ -1135,7 +1134,7 @@ static int video_texture_load_wrap_gl1_mipmap(void *data)
if (!data)
return 0;
video_texture_load_gl1((struct texture_image*)data,
TEXTURE_FILTER_MIPMAP_LINEAR, &id);
TEXTURE_FILTER_MIPMAP_NEAREST, &id);
return (int)id;
}
@ -1146,7 +1145,7 @@ static int video_texture_load_wrap_gl1(void *data)
if (!data)
return 0;
video_texture_load_gl1((struct texture_image*)data,
TEXTURE_FILTER_LINEAR, &id);
TEXTURE_FILTER_NEAREST, &id);
return (int)id;
}
#endif
@ -1249,19 +1248,6 @@ static uint32_t gl1_get_flags(void *data)
return flags;
}
static void gl1_set_mvp(void *data, void *shader_data, const void *mat_data)
{
const math_matrix_4x4 *mat = (const math_matrix_4x4*)mat_data;
(void)data;
(void)shader_data;
if (!mat)
return;
glLoadMatrixf(mat->data);
}
static void gl1_set_coords(void *handle_data, void *shader_data,
const struct video_coords *coords)
{
@ -1279,7 +1265,7 @@ static void gl1_set_coords(void *handle_data, void *shader_data,
static const video_poke_interface_t gl1_poke_interface = {
gl1_get_flags,
gl1_set_coords,
gl1_set_mvp,
NULL,
gl1_load_texture,
gl1_unload_texture,
gl1_set_video_mode,

View File

@ -2703,9 +2703,17 @@ bool video_driver_texture_load(void *data,
enum texture_filter_type filter_type,
uintptr_t *id)
{
#ifdef HAVE_THREADS
bool is_threaded = video_driver_is_threaded_internal();
#endif
if (!id || !video_driver_poke || !video_driver_poke->load_texture)
return false;
#ifdef HAVE_THREADS
if (is_threaded)
video_context_driver_make_current(false);
#endif
*id = video_driver_poke->load_texture(video_driver_data, data,
video_driver_is_threaded_internal(),
filter_type);
@ -2715,9 +2723,17 @@ bool video_driver_texture_load(void *data,
bool video_driver_texture_unload(uintptr_t *id)
{
#ifdef HAVE_THREADS
bool is_threaded = video_driver_is_threaded_internal();
#endif
if (!video_driver_poke || !video_driver_poke->unload_texture)
return false;
#ifdef HAVE_THREADS
if (is_threaded)
video_context_driver_make_current(false);
#endif
video_driver_poke->unload_texture(video_driver_data, *id);
*id = 0;
return true;
@ -3363,6 +3379,10 @@ enum gfx_ctx_api video_context_driver_get_api(void)
return GFX_CTX_GX_API;
else if (string_is_equal(video_driver, "gl"))
return GFX_CTX_OPENGL_API;
else if (string_is_equal(video_driver, "gl1"))
return GFX_CTX_OPENGL_API;
else if (string_is_equal(video_driver, "glcore"))
return GFX_CTX_OPENGL_API;
else if (string_is_equal(video_driver, "vulkan"))
return GFX_CTX_VULKAN_API;
else if (string_is_equal(video_driver, "metal"))

View File

@ -131,8 +131,7 @@ static void menu_display_gl1_draw(menu_display_ctx_draw_t *draw,
glMatrixMode(GL_PROJECTION);
glPushMatrix();
video_driver_set_mvp(&mvp);
glLoadMatrixf(mvp.matrix);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();