mirror of
https://github.com/libretro/RetroArch
synced 2025-02-22 12:40:09 +00:00
GL totally abstracted away now from menu drivers
This commit is contained in:
parent
ecffd040e2
commit
71ca469cda
@ -14,8 +14,8 @@
|
|||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __RARCH_SETTINGS_H__
|
#ifndef __RARCH_CONFIGURATION_H__
|
||||||
#define __RARCH_SETTINGS_H__
|
#define __RARCH_CONFIGURATION_H__
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <retro_miscellaneous.h>
|
#include <retro_miscellaneous.h>
|
||||||
|
4
driver.h
4
driver.h
@ -14,8 +14,8 @@
|
|||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __DRIVER__H
|
#ifndef __RARCH_DRIVER__H
|
||||||
#define __DRIVER__H
|
#define __RARCH_DRIVER__H
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <boolean.h>
|
#include <boolean.h>
|
||||||
|
@ -705,7 +705,7 @@ static void glui_frame(void)
|
|||||||
|
|
||||||
if (libretro_running)
|
if (libretro_running)
|
||||||
{
|
{
|
||||||
menu_display_frame_background(menu, settings,
|
menu_display_frame_background(
|
||||||
width, height,
|
width, height,
|
||||||
glui->textures.white, 0.75f, false,
|
glui->textures.white, 0.75f, false,
|
||||||
&white_transp_bg[0], &white_bg[0],
|
&white_transp_bg[0], &white_bg[0],
|
||||||
@ -727,7 +727,7 @@ static void glui_frame(void)
|
|||||||
white_transp_bg[11] = 0.30;
|
white_transp_bg[11] = 0.30;
|
||||||
white_transp_bg[15] = 0.30;
|
white_transp_bg[15] = 0.30;
|
||||||
|
|
||||||
menu_display_frame_background(menu, settings,
|
menu_display_frame_background(
|
||||||
width, height,
|
width, height,
|
||||||
glui->textures.bg.id, 0.75f, true,
|
glui->textures.bg.id, 0.75f, true,
|
||||||
&white_transp_bg[0], &white_bg[0],
|
&white_transp_bg[0], &white_bg[0],
|
||||||
@ -977,19 +977,15 @@ static void glui_layout(menu_handle_t *menu, glui_handle_t *glui)
|
|||||||
static void *glui_init(void)
|
static void *glui_init(void)
|
||||||
{
|
{
|
||||||
glui_handle_t *glui = NULL;
|
glui_handle_t *glui = NULL;
|
||||||
const video_driver_t *video_driver = NULL;
|
menu_handle_t *menu = (menu_handle_t*)
|
||||||
menu_handle_t *menu = NULL;
|
calloc(1, sizeof(*menu));
|
||||||
gl_t *gl = (gl_t*)
|
|
||||||
video_driver_get_ptr(&video_driver);
|
|
||||||
|
|
||||||
if (video_driver != &video_gl || !gl)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
menu = (menu_handle_t*)calloc(1, sizeof(*menu));
|
|
||||||
|
|
||||||
if (!menu)
|
if (!menu)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
if (!menu_display_check_compatibility(menu_ctx_glui.type))
|
||||||
|
goto error;
|
||||||
|
|
||||||
menu->userdata = (glui_handle_t*)calloc(1, sizeof(glui_handle_t));
|
menu->userdata = (glui_handle_t*)calloc(1, sizeof(glui_handle_t));
|
||||||
|
|
||||||
if (!menu->userdata)
|
if (!menu->userdata)
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "../menu_driver.h"
|
#include "../menu_driver.h"
|
||||||
|
#include "../menu_display.h"
|
||||||
#include "../menu.h"
|
#include "../menu.h"
|
||||||
#include "../../general.h"
|
#include "../../general.h"
|
||||||
|
|
||||||
|
@ -1570,7 +1570,7 @@ static void xmb_frame(void)
|
|||||||
coord_color[3] = coord_color[7] = coord_color[11] = coord_color[15] = (0.75f > xmb->alpha) ? xmb->alpha : 0.75f;
|
coord_color[3] = coord_color[7] = coord_color[11] = coord_color[15] = (0.75f > xmb->alpha) ? xmb->alpha : 0.75f;
|
||||||
coord_color2[3] = coord_color2[7] = coord_color2[11] = coord_color2[15] = xmb->alpha;
|
coord_color2[3] = coord_color2[7] = coord_color2[11] = coord_color2[15] = xmb->alpha;
|
||||||
|
|
||||||
menu_display_frame_background(menu, settings,
|
menu_display_frame_background(
|
||||||
width, height, xmb->textures.bg.id, xmb->alpha, false, &coord_color[0],
|
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_vertex[0], &rmb_tex_coord[0], 4,
|
||||||
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
|
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
|
||||||
@ -1674,7 +1674,7 @@ static void xmb_frame(void)
|
|||||||
|
|
||||||
if (render_background)
|
if (render_background)
|
||||||
{
|
{
|
||||||
menu_display_frame_background(menu, settings,
|
menu_display_frame_background(
|
||||||
width, height,
|
width, height,
|
||||||
xmb->textures.bg.id, xmb->alpha, true,
|
xmb->textures.bg.id, xmb->alpha, true,
|
||||||
&coord_color[0], &coord_color2[0],
|
&coord_color[0], &coord_color2[0],
|
||||||
@ -1821,26 +1821,15 @@ static void xmb_layout(menu_handle_t *menu, xmb_handle_t *xmb)
|
|||||||
static void *xmb_init(void)
|
static void *xmb_init(void)
|
||||||
{
|
{
|
||||||
unsigned width, height;
|
unsigned width, height;
|
||||||
menu_handle_t *menu = NULL;
|
xmb_handle_t *xmb = NULL;
|
||||||
xmb_handle_t *xmb = NULL;
|
menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu));
|
||||||
const video_driver_t *video_driver = NULL;
|
|
||||||
float scale_factor = 1;
|
|
||||||
gl_t *gl = (gl_t*)
|
|
||||||
video_driver_get_ptr(&video_driver);
|
|
||||||
|
|
||||||
(void)scale_factor;
|
|
||||||
|
|
||||||
if (video_driver != &video_gl || !gl)
|
|
||||||
{
|
|
||||||
RARCH_ERR("Cannot initialize XMB menu driver: GL video driver is not active.\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
menu = (menu_handle_t*)calloc(1, sizeof(*menu));
|
|
||||||
|
|
||||||
if (!menu)
|
if (!menu)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
if (!menu_display_check_compatibility(menu_ctx_xmb.type))
|
||||||
|
goto error;
|
||||||
|
|
||||||
video_driver_get_size(&width, &height);
|
video_driver_get_size(&width, &height);
|
||||||
|
|
||||||
menu->userdata = (xmb_handle_t*)calloc(1, sizeof(xmb_handle_t));
|
menu->userdata = (xmb_handle_t*)calloc(1, sizeof(xmb_handle_t));
|
||||||
|
@ -1065,7 +1065,7 @@ static void zarch_frame(void)
|
|||||||
|
|
||||||
menu_display_blend_end();
|
menu_display_blend_end();
|
||||||
|
|
||||||
menu_display_frame_background(menu, settings,
|
menu_display_frame_background(
|
||||||
zui->width, zui->height,
|
zui->width, zui->height,
|
||||||
zui->textures.bg.id, 0.75f, false,
|
zui->textures.bg.id, 0.75f, false,
|
||||||
&coord_color[0], &coord_color2[0],
|
&coord_color[0], &coord_color2[0],
|
||||||
@ -1083,29 +1083,15 @@ static void *zarch_init(void)
|
|||||||
{
|
{
|
||||||
int unused;
|
int unused;
|
||||||
zui_t *zui = NULL;
|
zui_t *zui = NULL;
|
||||||
const video_driver_t *video_driver = NULL;
|
|
||||||
menu_handle_t *menu = NULL;
|
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
gl_t *gl = (gl_t*)
|
menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu));
|
||||||
video_driver_get_ptr(&video_driver);
|
|
||||||
|
|
||||||
if (video_driver != &video_gl || !gl)
|
|
||||||
{
|
|
||||||
RARCH_ERR("Cannot initialize GLUI menu driver: gl video driver is not active.\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (settings->menu.mouse.enable)
|
|
||||||
{
|
|
||||||
RARCH_WARN("Forcing menu_mouse_enable=false\n");
|
|
||||||
settings->menu.mouse.enable = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
menu = (menu_handle_t*)calloc(1, sizeof(*menu));
|
|
||||||
|
|
||||||
if (!menu)
|
if (!menu)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
if (!menu_display_check_compatibility(menu_ctx_zarch.type))
|
||||||
|
goto error;
|
||||||
|
|
||||||
menu->userdata = (zui_t*)calloc(1, sizeof(zui_t));
|
menu->userdata = (zui_t*)calloc(1, sizeof(zui_t));
|
||||||
|
|
||||||
if (!menu->userdata)
|
if (!menu->userdata)
|
||||||
@ -1113,6 +1099,12 @@ static void *zarch_init(void)
|
|||||||
|
|
||||||
zui = (zui_t*)menu->userdata;
|
zui = (zui_t*)menu->userdata;
|
||||||
|
|
||||||
|
if (settings->menu.mouse.enable)
|
||||||
|
{
|
||||||
|
RARCH_WARN("Forcing menu_mouse_enable=false\n");
|
||||||
|
settings->menu.mouse.enable = false;
|
||||||
|
}
|
||||||
|
|
||||||
unused = 1000;
|
unused = 1000;
|
||||||
menu_display_ctl(MENU_DISPLAY_CTL_SET_HEADER_HEIGHT, &unused);
|
menu_display_ctl(MENU_DISPLAY_CTL_SET_HEADER_HEIGHT, &unused);
|
||||||
|
|
||||||
|
@ -584,8 +584,6 @@ void menu_display_draw_frame(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void menu_display_frame_background(
|
void menu_display_frame_background(
|
||||||
menu_handle_t *menu,
|
|
||||||
settings_t *settings,
|
|
||||||
unsigned width,
|
unsigned width,
|
||||||
unsigned height,
|
unsigned height,
|
||||||
GLuint texture,
|
GLuint texture,
|
||||||
@ -599,8 +597,9 @@ void menu_display_frame_background(
|
|||||||
enum menu_display_prim_type prim_type)
|
enum menu_display_prim_type prim_type)
|
||||||
{
|
{
|
||||||
struct gfx_coords coords;
|
struct gfx_coords coords;
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
gl_t *gl = (gl_t*)video_driver_get_ptr(NULL);
|
settings_t *settings = config_get_ptr();
|
||||||
|
gl_t *gl = (gl_t*)video_driver_get_ptr(NULL);
|
||||||
|
|
||||||
if (!gl)
|
if (!gl)
|
||||||
return;
|
return;
|
||||||
@ -642,6 +641,33 @@ void menu_display_clear_color(float r, float g, float b, float a)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool menu_display_check_compatibility(enum menu_display_driver_type type)
|
||||||
|
{
|
||||||
|
const video_driver_t *video_driver = NULL;
|
||||||
|
#ifdef HAVE_OPENGL
|
||||||
|
gl_t *gl = (gl_t*)video_driver_get_ptr(&video_driver);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case MENU_VIDEO_DRIVER_GENERIC:
|
||||||
|
return true;
|
||||||
|
case MENU_VIDEO_DRIVER_OPENGL:
|
||||||
|
#ifdef HAVE_OPENGL
|
||||||
|
if (video_driver == &video_gl || gl)
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case MENU_VIDEO_DRIVER_DIRECT3D:
|
||||||
|
/* TODO/FIXME */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
RARCH_ERR("Cannot initialize menu driver: video driver of type %d is not active.\n", type);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *menu_video_get_ident(void)
|
const char *menu_video_get_ident(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
|
@ -26,6 +26,13 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
enum menu_display_driver_type
|
||||||
|
{
|
||||||
|
MENU_VIDEO_DRIVER_GENERIC = 0,
|
||||||
|
MENU_VIDEO_DRIVER_OPENGL,
|
||||||
|
MENU_VIDEO_DRIVER_DIRECT3D
|
||||||
|
};
|
||||||
|
|
||||||
enum menu_display_ctl_state
|
enum menu_display_ctl_state
|
||||||
{
|
{
|
||||||
MENU_DISPLAY_CTL_SET_VIEWPORT = 0,
|
MENU_DISPLAY_CTL_SET_VIEWPORT = 0,
|
||||||
@ -107,8 +114,6 @@ void menu_display_blend_begin(void);
|
|||||||
void menu_display_blend_end(void);
|
void menu_display_blend_end(void);
|
||||||
|
|
||||||
void menu_display_frame_background(
|
void menu_display_frame_background(
|
||||||
menu_handle_t *menu,
|
|
||||||
settings_t *settings,
|
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
GLuint texture,
|
GLuint texture,
|
||||||
float handle_alpha,
|
float handle_alpha,
|
||||||
@ -130,6 +135,8 @@ void menu_display_clear_color(float r, float g, float b, float a);
|
|||||||
void menu_display_matrix_4x4_rotate_z(void *data, float rotation,
|
void menu_display_matrix_4x4_rotate_z(void *data, float rotation,
|
||||||
float scale_x, float scale_y, float scale_z, bool scale_enable);
|
float scale_x, float scale_y, float scale_z, bool scale_enable);
|
||||||
|
|
||||||
|
bool menu_display_check_compatibility(enum menu_display_driver_type type);
|
||||||
|
|
||||||
const char *menu_video_get_ident(void);
|
const char *menu_video_get_ident(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -61,13 +61,6 @@ typedef enum
|
|||||||
MENU_HELP_LAST
|
MENU_HELP_LAST
|
||||||
} menu_help_type_t;
|
} menu_help_type_t;
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
MENU_VIDEO_DRIVER_GENERIC = 0,
|
|
||||||
MENU_VIDEO_DRIVER_OPENGL,
|
|
||||||
MENU_VIDEO_DRIVER_DIRECT3D
|
|
||||||
} menu_video_driver_type_t;
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
void *userdata;
|
void *userdata;
|
||||||
@ -140,7 +133,7 @@ typedef struct menu_ctx_driver
|
|||||||
uint32_t label_hash, uint32_t menu_label_hash);
|
uint32_t label_hash, uint32_t menu_label_hash);
|
||||||
bool (*load_image)(void *data, menu_image_type_t type);
|
bool (*load_image)(void *data, menu_image_type_t type);
|
||||||
const char *ident;
|
const char *ident;
|
||||||
menu_video_driver_type_t type;
|
unsigned type;
|
||||||
int (*environ_cb)(menu_environ_cb_t type, void *data);
|
int (*environ_cb)(menu_environ_cb_t type, void *data);
|
||||||
int (*pointer_tap)(unsigned x, unsigned y, unsigned ptr,
|
int (*pointer_tap)(unsigned x, unsigned y, unsigned ptr,
|
||||||
menu_file_list_cbs_t *cbs,
|
menu_file_list_cbs_t *cbs,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user