(GLUI) White texture should be properly uploaded to GPU

in threaded video mode now too
This commit is contained in:
twinaphex 2015-05-09 13:12:43 +02:00
parent 31498e825f
commit 6f96b32df4

View File

@ -469,10 +469,22 @@ static void glui_frame(void)
menu_display_unset_viewport(menu);
}
static void glui_allocate_white_texture(glui_handle_t *glui)
{
static const uint8_t white_data[] = { 0xff, 0xff, 0xff, 0xff };
struct texture_image ti;
ti.width = 1;
ti.height = 1;
ti.pixels = (uint32_t*)&white_data;
glui->textures.white = video_texture_load(&ti,
TEXTURE_BACKEND_OPENGL, TEXTURE_FILTER_NEAREST);
}
static void *glui_init(void)
{
float dpi;
static const uint8_t white_data[] = { 0xff, 0xff, 0xff, 0xff };
glui_handle_t *glui = NULL;
const video_driver_t *video_driver = NULL;
menu_handle_t *menu = NULL;
@ -506,13 +518,7 @@ static void *glui_init(void)
menu->font.size = dpi / 8;
glui->textures.bg.id = 0;
glGenTextures(1, &glui->textures.white);
glBindTexture(GL_TEXTURE_2D, glui->textures.white);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, white_data);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glui_allocate_white_texture(glui);
rarch_main_data_msg_queue_push(DATA_TYPE_IMAGE,
settings->menu.wallpaper, "cb_menu_wallpaper", 0, 1, true);
@ -552,6 +558,7 @@ static void glui_context_bg_destroy(glui_handle_t *glui)
{
if (glui && glui->textures.bg.id)
glDeleteTextures(1, &glui->textures.bg.id);
glDeleteTextures(1, &glui->textures.white);
}
static void glui_context_destroy(void)
@ -671,6 +678,7 @@ static void glui_context_reset(void)
RARCH_WARN("Failed to load font.");
glui_context_bg_destroy(glui);
glui_allocate_white_texture(glui);
rarch_main_data_msg_queue_push(DATA_TYPE_IMAGE,
settings->menu.wallpaper, "cb_menu_wallpaper", 0, 1, true);