Create menu_display_texture_load and menu_display_texture_unload

This commit is contained in:
twinaphex 2015-11-02 22:06:51 +01:00
parent 1dab10ceda
commit a4eb49430c
5 changed files with 49 additions and 33 deletions

View File

@ -34,8 +34,6 @@
#include "../menu_hash.h"
#include "../menu_display.h"
#include "../../gfx/video_texture.h"
#include "../../runloop_data.h"
enum
@ -166,8 +164,8 @@ static void materialui_context_reset_textures(materialui_handle_t *materialui, c
texture_image_load(&ti, path);
materialui->textures.list[i].id = video_texture_load(&ti,
TEXTURE_BACKEND_OPENGL, TEXTURE_FILTER_MIPMAP_LINEAR);
materialui->textures.list[i].id = menu_display_texture_load(&ti,
TEXTURE_FILTER_MIPMAP_LINEAR);
texture_image_free(&ti);
}
@ -912,8 +910,8 @@ static void materialui_allocate_white_texture(materialui_handle_t *materialui)
ti.height = 1;
ti.pixels = (uint32_t*)&white_data;
materialui->textures.white = video_texture_load(&ti,
TEXTURE_BACKEND_OPENGL, TEXTURE_FILTER_NEAREST);
materialui->textures.white = menu_display_texture_load(&ti,
TEXTURE_FILTER_NEAREST);
}
static void materialui_font(menu_handle_t *menu)
@ -1029,8 +1027,8 @@ static void materialui_context_bg_destroy(materialui_handle_t *materialui)
if (!materialui)
return;
video_texture_unload((uintptr_t*)&materialui->textures.bg.id);
video_texture_unload((uintptr_t*)&materialui->textures.white);
menu_display_texture_unload((uintptr_t*)&materialui->textures.bg.id);
menu_display_texture_unload((uintptr_t*)&materialui->textures.white);
}
static void materialui_context_destroy(void)
@ -1048,7 +1046,7 @@ static void materialui_context_destroy(void)
return;
for (i = 0; i < GLUI_TEXTURE_LAST; i++)
video_texture_unload((uintptr_t*)&materialui->textures.list[i].id);
menu_display_texture_unload((uintptr_t*)&materialui->textures.list[i].id);
menu_display_free_main_font();
@ -1072,8 +1070,8 @@ static bool materialui_load_image(void *data, menu_image_type_t type)
case MENU_IMAGE_WALLPAPER:
materialui_context_bg_destroy(materialui);
materialui->textures.bg.id = video_texture_load(data,
TEXTURE_BACKEND_OPENGL, TEXTURE_FILTER_MIPMAP_LINEAR);
materialui->textures.bg.id = menu_display_texture_load(data,
TEXTURE_FILTER_MIPMAP_LINEAR);
materialui_allocate_white_texture(materialui);
break;
case MENU_IMAGE_BOXART:

View File

@ -38,7 +38,6 @@
#include "../menu_cbs.h"
#include "../../file_ext.h"
#include "../../gfx/video_texture.h"
#include "../../runloop_data.h"
@ -1932,7 +1931,7 @@ static void xmb_context_bg_destroy(xmb_handle_t *xmb)
if (!xmb)
return;
video_texture_unload((uintptr_t*)&xmb->textures.bg.id);
menu_display_texture_unload((uintptr_t*)&xmb->textures.bg.id);
}
static bool xmb_load_image(void *data, menu_image_type_t type)
@ -1954,12 +1953,12 @@ static bool xmb_load_image(void *data, menu_image_type_t type)
break;
case MENU_IMAGE_WALLPAPER:
xmb_context_bg_destroy(xmb);
xmb->textures.bg.id = video_texture_load(data,
TEXTURE_BACKEND_OPENGL, TEXTURE_FILTER_MIPMAP_LINEAR);
xmb->textures.bg.id = menu_display_texture_load(data,
TEXTURE_FILTER_MIPMAP_LINEAR);
break;
case MENU_IMAGE_BOXART:
xmb->boxart = video_texture_load(data,
TEXTURE_BACKEND_OPENGL, TEXTURE_FILTER_MIPMAP_LINEAR);
xmb->boxart = menu_display_texture_load(data,
TEXTURE_FILTER_MIPMAP_LINEAR);
break;
}
@ -2037,14 +2036,14 @@ static void xmb_context_reset_horizontal_list(xmb_handle_t *xmb,
texture_image_load(&ti, texturepath);
node->icon = video_texture_load(&ti,
TEXTURE_BACKEND_OPENGL, TEXTURE_FILTER_MIPMAP_LINEAR);
node->icon = menu_display_texture_load(&ti,
TEXTURE_FILTER_MIPMAP_LINEAR);
texture_image_free(&ti);
texture_image_load(&ti, content_texturepath);
node->content_icon = video_texture_load(&ti,
TEXTURE_BACKEND_OPENGL, TEXTURE_FILTER_MIPMAP_LINEAR);
node->content_icon = menu_display_texture_load(&ti,
TEXTURE_FILTER_MIPMAP_LINEAR);
texture_image_free(&ti);
}
@ -2173,8 +2172,8 @@ static void xmb_context_reset_textures(xmb_handle_t *xmb, const char *iconpath)
texture_image_load(&ti, path);
xmb->textures.list[i].id = video_texture_load(&ti,
TEXTURE_BACKEND_OPENGL, TEXTURE_FILTER_MIPMAP_LINEAR);
xmb->textures.list[i].id = menu_display_texture_load(&ti,
TEXTURE_FILTER_MIPMAP_LINEAR);
texture_image_free(&ti);
}
@ -2504,8 +2503,8 @@ static void xmb_context_destroy_horizontal_list(xmb_handle_t *xmb,
if (!node)
continue;
video_texture_unload((uintptr_t*)&node->icon);
video_texture_unload((uintptr_t*)&node->content_icon);
menu_display_texture_unload((uintptr_t*)&node->icon);
menu_display_texture_unload((uintptr_t*)&node->content_icon);
}
}
@ -2524,7 +2523,7 @@ static void xmb_context_destroy(void)
return;
for (i = 0; i < XMB_TEXTURE_LAST; i++)
video_texture_unload((uintptr_t*)&xmb->textures.list[i].id);
menu_display_texture_unload((uintptr_t*)&xmb->textures.list[i].id);
xmb_context_destroy_horizontal_list(xmb, menu);

View File

@ -42,7 +42,6 @@
#include "../../runloop_data.h"
#include "../../gfx/font_driver.h"
#include "../../gfx/video_texture.h"
#if 0
#define ZARCH_DEBUG
@ -1157,8 +1156,8 @@ static void zarch_free(void *data)
static void zarch_context_bg_destroy(zui_t *zui)
{
video_texture_unload((uintptr_t*)&zui->textures.bg.id);
video_texture_unload((uintptr_t*)&zui->textures.white);
menu_display_texture_unload((uintptr_t*)&zui->textures.bg.id);
menu_display_texture_unload((uintptr_t*)&zui->textures.white);
}
static void zarch_context_destroy(void)
@ -1194,8 +1193,8 @@ static bool zarch_load_image(void *data, menu_image_type_t type)
break;
case MENU_IMAGE_WALLPAPER:
zarch_context_bg_destroy(zui);
zui->textures.bg.id = video_texture_load(data,
TEXTURE_BACKEND_OPENGL, TEXTURE_FILTER_MIPMAP_LINEAR);
zui->textures.bg.id = menu_display_texture_load(data,
TEXTURE_FILTER_MIPMAP_LINEAR);
break;
case MENU_IMAGE_BOXART:
break;
@ -1213,8 +1212,8 @@ static void zarch_allocate_white_texture(zui_t *zui)
ti.height = 1;
ti.pixels = (uint32_t*)&data;
zui->textures.white = video_texture_load(&ti,
TEXTURE_BACKEND_OPENGL, TEXTURE_FILTER_NEAREST);
zui->textures.white = menu_display_texture_load(&ti,
TEXTURE_FILTER_NEAREST);
}
static void zarch_context_reset(void)

View File

@ -23,6 +23,7 @@
#include "../gfx/font_renderer_driver.h"
#include "../gfx/video_context_driver.h"
#include "../gfx/video_thread_wrapper.h"
#include "../gfx/video_texture.h"
#include "menu.h"
#include "menu_animation.h"
@ -641,6 +642,18 @@ void menu_display_clear_color(float r, float g, float b, float a)
glClearColor(r, g, b, a);
glClear(GL_COLOR_BUFFER_BIT);
}
unsigned menu_display_texture_load(void *data, enum texture_filter_type type)
{
return video_texture_load(data, TEXTURE_BACKEND_OPENGL, type);
}
void menu_display_texture_unload(uintptr_t *id)
{
if (!id)
return;
video_texture_unload(id);
}
#endif
bool menu_display_check_compatibility(enum menu_display_driver_type type)

View File

@ -20,6 +20,8 @@
#include <stdlib.h>
#include <boolean.h>
#include "../gfx/video_texture.h"
#ifdef __cplusplus
extern "C" {
#endif
@ -133,6 +135,11 @@ void menu_display_clear_color(float r, float g, float b, float a);
void menu_display_matrix_4x4_rotate_z(void *data, float rotation,
float scale_x, float scale_y, float scale_z, bool scale_enable);
unsigned menu_display_texture_load(void *data,
enum texture_filter_type filter_type);
void menu_display_texture_unload(uintptr_t *id);
bool menu_display_check_compatibility(enum menu_display_driver_type type);
const char *menu_video_get_ident(void);