mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
Merge pull request #9713 from Rinnegatamante/vitagl
Added gl1 video driver support to Vita build
This commit is contained in:
commit
53d18cf95e
@ -1157,6 +1157,14 @@ ifeq ($(HAVE_PLAIN_DRM), 1)
|
||||
LIBS += -ldrm
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_VITAGL), 1)
|
||||
DEFINES += -DHAVE_OPENGL1
|
||||
OBJ += gfx/drivers/gl1.o \
|
||||
gfx/drivers_font/gl1_raster_font.o \
|
||||
gfx/drivers_context/vita_ctx.o \
|
||||
menu/drivers_display/menu_display_gl1.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_GL_CONTEXT), 1)
|
||||
ifeq ($(HAVE_GL_MODERN), 1)
|
||||
DEFINES += -DHAVE_OPENGL
|
||||
|
@ -35,6 +35,7 @@ else
|
||||
HAVE_ZLIB := 1
|
||||
HAVE_7ZIP := 1
|
||||
HAVE_VITA2D := 1
|
||||
HAVE_VITAGL := 1
|
||||
HAVE_NETWORKING := 1
|
||||
HAVE_SOCKET_LEGACY := 1
|
||||
HAVE_MENU := 1
|
||||
@ -115,7 +116,8 @@ CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
||||
VITA_LIBS := -lSceDisplay_stub -lSceGxm_stub -lSceNet_stub -lSceNetCtl_stub -lSceAppUtil_stub \
|
||||
-lSceSysmodule_stub -lSceCtrl_stub -lSceHid_stub -lSceTouch_stub -lSceAudio_stub \
|
||||
-lScePower_stub -lSceRtc_stub -lSceCommonDialog_stub -lScePgf_stub -lSceMotion_stub \
|
||||
-lSceFiber_stub -lSceMotion_stub -lSceAppMgr_stub -lpthread -lpng -lz
|
||||
-lSceFiber_stub -lSceMotion_stub -lSceAppMgr_stub -lpthread -lpng -lz -lvitagl \
|
||||
-lmathneon
|
||||
|
||||
LIBS := $(WHOLE_START) -lretro_vita $(WHOLE_END) $(VITA_LIBS) -lm -lc
|
||||
|
||||
|
@ -4,10 +4,10 @@
|
||||
#include <psp2/kernel/sysmem.h>
|
||||
#include <psp2/kernel/threadmgr.h>
|
||||
|
||||
#define RAM_THRESHOLD 0xA00000 // Memory left to the system for threads and other internal stuffs
|
||||
#define RAM_THRESHOLD 0x1000000 // Memory left to the system for threads and other internal stuffs
|
||||
|
||||
static int _newlib_heap_memblock;
|
||||
static unsigned _newlib_heap_size;
|
||||
int _newlib_heap_memblock;
|
||||
unsigned _newlib_heap_size;
|
||||
char *_newlib_heap_base, *_newlib_heap_end, *_newlib_heap_cur;
|
||||
static char _newlib_sbrk_mutex[32] __attribute__ ((aligned (8)));
|
||||
|
||||
|
@ -89,18 +89,6 @@ static void frontend_psp_get_environment_settings(int *argc, char *argv[],
|
||||
|
||||
(void)args;
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
#if defined(HAVE_LOGGER)
|
||||
logger_init();
|
||||
#elif defined(HAVE_FILE_LOGGER)
|
||||
#ifndef VITA
|
||||
retro_main_log_file_init("ms0:/temp/retroarch-log.txt", false);
|
||||
#else
|
||||
retro_main_log_file_init("ux0:/temp/retroarch-log.txt", false);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VITA
|
||||
strlcpy(eboot_path, "app0:/", sizeof(eboot_path));
|
||||
strlcpy(g_defaults.dirs[DEFAULT_DIR_PORT], eboot_path, sizeof(g_defaults.dirs[DEFAULT_DIR_PORT]));
|
||||
@ -245,10 +233,6 @@ static void frontend_psp_deinit(void *data)
|
||||
(void)data;
|
||||
#ifndef IS_SALAMANDER
|
||||
verbosity_disable();
|
||||
#ifdef HAVE_FILE_LOGGER
|
||||
command_event(CMD_EVENT_LOG_FILE_DEINIT, NULL);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -30,12 +30,23 @@
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#ifdef VITA
|
||||
#include <vitaGL.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "../../retroarch.h"
|
||||
|
||||
#ifdef VITA
|
||||
#define GL_RGBA8 GL_RGBA
|
||||
#define GL_RGB8 GL_RGB
|
||||
#define GL_BGRA_EXT GL_RGBA // Currently unsupported in vitaGL
|
||||
#define GL_CLAMP GL_CLAMP_TO_EDGE
|
||||
#endif
|
||||
|
||||
#define RARCH_GL1_INTERNAL_FORMAT32 GL_RGBA8
|
||||
#define RARCH_GL1_TEXTURE_TYPE32 GL_BGRA_EXT
|
||||
#define RARCH_GL1_FORMAT32 GL_UNSIGNED_BYTE
|
||||
|
@ -56,6 +56,10 @@
|
||||
#include "../video_thread_wrapper.h"
|
||||
#endif
|
||||
|
||||
#ifdef VITA
|
||||
static bool vgl_inited = false;
|
||||
#endif
|
||||
|
||||
static unsigned char *gl1_menu_frame = NULL;
|
||||
static unsigned gl1_menu_width = 0;
|
||||
static unsigned gl1_menu_height = 0;
|
||||
@ -285,7 +289,14 @@ static void *gl1_gfx_init(const video_info_t *video,
|
||||
full_y = mode.height;
|
||||
mode.width = 0;
|
||||
mode.height = 0;
|
||||
|
||||
#ifdef VITA
|
||||
if (!vgl_inited) {
|
||||
vglInitExtended(0x1400000, full_x, full_y, 0x100000, SCE_GXM_MULTISAMPLE_4X);
|
||||
vglUseVram(GL_TRUE);
|
||||
vglStartRendering();
|
||||
vgl_inited = true;
|
||||
}
|
||||
#endif
|
||||
/* Clear out potential error flags in case we use cached context. */
|
||||
glGetError();
|
||||
|
||||
@ -395,7 +406,9 @@ static void *gl1_gfx_init(const video_info_t *video,
|
||||
glDisable(GL_CULL_FACE);
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
#ifndef VITA
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
#endif
|
||||
glGenTextures(1, &gl1->tex);
|
||||
glGenTextures(1, &gl1->menu_tex);
|
||||
|
||||
@ -553,6 +566,33 @@ static void draw_tex(gl1_t *gl1, int pot_width, int pot_height, int width, int h
|
||||
GLenum format = gl1->supports_bgra ? GL_BGRA_EXT : GL_RGBA;
|
||||
GLenum type = GL_UNSIGNED_BYTE;
|
||||
|
||||
float vertices[] = {
|
||||
-1.0f, -1.0f, 0.0f,
|
||||
-1.0f, 1.0f, 0.0f,
|
||||
1.0f, -1.0f, 0.0f,
|
||||
1.0f, 1.0f, 0.0f,
|
||||
};
|
||||
|
||||
float colors[] = {
|
||||
1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f
|
||||
};
|
||||
|
||||
float norm_width = (1.0f / (float)pot_width) * (float)width;
|
||||
float norm_height = (1.0f / (float)pot_height) * (float)height;
|
||||
|
||||
float texcoords[] = {
|
||||
0.0f, 0.0f,
|
||||
0.0f, 0.0f,
|
||||
0.0f, 0.0f,
|
||||
0.0f, 0.0f
|
||||
};
|
||||
|
||||
texcoords[1] = texcoords[5] = norm_height;
|
||||
texcoords[4] = texcoords[6] = norm_width;
|
||||
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_CULL_FACE);
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
@ -562,14 +602,12 @@ static void draw_tex(gl1_t *gl1, int pot_width, int pot_height, int width, int h
|
||||
/* Multi-texture not part of GL 1.1 */
|
||||
/*glActiveTexture(GL_TEXTURE0);*/
|
||||
|
||||
#ifndef VITA
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, pot_width);
|
||||
#endif
|
||||
glBindTexture(GL_TEXTURE_2D, tex);
|
||||
|
||||
/* For whatever reason you can't send NULL in GLDirect,
|
||||
so we send the frame as dummy data */
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, pot_width, pot_height, 0, format, type, frame_to_copy);
|
||||
|
||||
frame = (uint8_t*)frame_to_copy;
|
||||
if (!gl1->supports_bgra)
|
||||
{
|
||||
@ -592,8 +630,9 @@ static void draw_tex(gl1_t *gl1, int pot_width, int pot_height, int width, int h
|
||||
}
|
||||
}
|
||||
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, format, type, frame);
|
||||
free(frame_rgba);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, pot_width, pot_height, 0, format, type, frame);
|
||||
if (frame_rgba)
|
||||
free(frame_rgba);
|
||||
|
||||
if (tex == gl1->tex)
|
||||
{
|
||||
@ -617,62 +656,22 @@ static void draw_tex(gl1_t *gl1, int pot_width, int pot_height, int width, int h
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
|
||||
/* stock coord set does not handle POT, disable for now */
|
||||
/*glEnableClientState(GL_COLOR_ARRAY);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
||||
glColorPointer(4, GL_FLOAT, 0, gl1->coords.color);
|
||||
glVertexPointer(2, GL_FLOAT, 0, gl1->coords.vertex);
|
||||
glTexCoordPointer(2, GL_FLOAT, 0, gl1->coords.tex_coord);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, gl1->coords.vertices);
|
||||
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);*/
|
||||
|
||||
if (gl1->rotation && tex == gl1->tex)
|
||||
glRotatef(gl1->rotation, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
||||
glColorPointer(4, GL_FLOAT, 0, colors);
|
||||
glVertexPointer(3, GL_FLOAT, 0, vertices);
|
||||
glTexCoordPointer(2, GL_FLOAT, 0, texcoords);
|
||||
|
||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
|
||||
{
|
||||
float tex_BL[2] = {0.0f, 0.0f};
|
||||
float tex_BR[2] = {1.0f, 0.0f};
|
||||
float tex_TL[2] = {0.0f, 1.0f};
|
||||
float tex_TR[2] = {1.0f, 1.0f};
|
||||
float *tex_mirror_BL = tex_TL;
|
||||
float *tex_mirror_BR = tex_TR;
|
||||
float *tex_mirror_TL = tex_BL;
|
||||
float *tex_mirror_TR = tex_BR;
|
||||
float norm_width = (1.0f / (float)pot_width) * (float)width;
|
||||
float norm_height = (1.0f / (float)pot_height) * (float)height;
|
||||
|
||||
/* remove extra POT padding */
|
||||
tex_mirror_BR[0] = norm_width;
|
||||
tex_mirror_TR[0] = norm_width;
|
||||
|
||||
/* normally this would be 1.0 - height, but we're drawing upside-down */
|
||||
tex_mirror_BL[1] = norm_height;
|
||||
tex_mirror_BR[1] = norm_height;
|
||||
|
||||
glTexCoord2f(tex_mirror_BL[0], tex_mirror_BL[1]);
|
||||
glVertex2f(-1.0f, -1.0f);
|
||||
|
||||
glTexCoord2f(tex_mirror_TL[0], tex_mirror_TL[1]);
|
||||
glVertex2f(-1.0f, 1.0f);
|
||||
|
||||
glTexCoord2f(tex_mirror_TR[0], tex_mirror_TR[1]);
|
||||
glVertex2f(1.0f, 1.0f);
|
||||
|
||||
glTexCoord2f(tex_mirror_BR[0], tex_mirror_BR[1]);
|
||||
glVertex2f(1.0f, -1.0f);
|
||||
}
|
||||
|
||||
glEnd();
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
@ -686,10 +685,11 @@ static void gl1_readback(
|
||||
unsigned fmt, unsigned type,
|
||||
void *src)
|
||||
{
|
||||
#ifndef VITA
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, alignment);
|
||||
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
|
||||
glReadBuffer(GL_BACK);
|
||||
|
||||
#endif
|
||||
glReadPixels(gl1->vp.x, gl1->vp.y,
|
||||
gl1->vp.width, gl1->vp.height,
|
||||
(GLenum)fmt, (GLenum)type, (GLvoid*)src);
|
||||
@ -710,7 +710,7 @@ static bool gl1_gfx_frame(void *data, const void *frame,
|
||||
unsigned pot_height = 0;
|
||||
|
||||
gl1_context_bind_hw_render(gl1, false);
|
||||
|
||||
|
||||
/* FIXME: Force these settings off as they interfere with the rendering */
|
||||
video_info->xmb_shadows_enable = false;
|
||||
video_info->menu_shader_pipeline = 0;
|
||||
@ -917,7 +917,7 @@ static bool gl1_gfx_frame(void *data, const void *frame,
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glFinish();
|
||||
}
|
||||
|
||||
|
||||
gl1_context_bind_hw_render(gl1, true);
|
||||
|
||||
return true;
|
||||
@ -1259,7 +1259,10 @@ static void gl1_load_texture_data(
|
||||
|
||||
gl1_bind_texture(id, wrap, mag_filter, min_filter);
|
||||
|
||||
#ifndef VITA
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
|
||||
#endif
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D,
|
||||
0,
|
||||
(use_rgba || !rgb32) ? GL_RGBA : RARCH_GL1_INTERNAL_FORMAT32,
|
||||
|
@ -42,8 +42,13 @@ static void gfx_ctx_null_swap_buffers(void *data, void *data2)
|
||||
static void gfx_ctx_null_get_video_size(void *data, unsigned *width, unsigned *height)
|
||||
{
|
||||
(void)data;
|
||||
#ifdef VITA
|
||||
*width = 960;
|
||||
*height = 544;
|
||||
#else
|
||||
*width = 320;
|
||||
*height = 240;
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool gfx_ctx_null_set_video_mode(void *data,
|
||||
|
176
gfx/drivers_context/vita_ctx.c
Normal file
176
gfx/drivers_context/vita_ctx.c
Normal file
@ -0,0 +1,176 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* Vita context. */
|
||||
|
||||
#include "../../retroarch.h"
|
||||
|
||||
static void vita_swap_interval(void *data, int interval)
|
||||
{
|
||||
(void)data;
|
||||
vglWaitVblankStart(interval);
|
||||
}
|
||||
|
||||
static void vita_get_video_size(void *data, unsigned *width, unsigned *height)
|
||||
{
|
||||
(void)data;
|
||||
*width = 960;
|
||||
*height = 544;
|
||||
}
|
||||
|
||||
static void vita_check_window(void *data, bool *quit,
|
||||
bool *resize, unsigned *width, unsigned *height, bool is_shutdown)
|
||||
{
|
||||
unsigned new_width, new_height;
|
||||
|
||||
vita_get_video_size(data, &new_width, &new_height);
|
||||
|
||||
if (new_width != *width || new_height != *height)
|
||||
{
|
||||
*width = new_width;
|
||||
*height = new_height;
|
||||
*resize = true;
|
||||
}
|
||||
|
||||
*quit = (bool)false;
|
||||
}
|
||||
|
||||
static void vita_swap_buffers(void *data, void *data2)
|
||||
{
|
||||
(void)data;
|
||||
vglStopRendering();
|
||||
vglStartRendering();
|
||||
}
|
||||
|
||||
static bool vita_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
(void)data;
|
||||
(void)width;
|
||||
(void)height;
|
||||
(void)fullscreen;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void vita_destroy(void *data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static void vita_input_driver(void *data,
|
||||
const char *name,
|
||||
input_driver_t **input, void **input_data)
|
||||
{
|
||||
(void)data;
|
||||
(void)input;
|
||||
(void)input_data;
|
||||
}
|
||||
|
||||
static bool vita_has_focus(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool vita_suppress_screensaver(void *data, bool enable)
|
||||
{
|
||||
(void)data;
|
||||
(void)enable;
|
||||
return false;
|
||||
}
|
||||
|
||||
static enum gfx_ctx_api vita_get_api(void *data)
|
||||
{
|
||||
return GFX_CTX_NONE;
|
||||
}
|
||||
|
||||
static bool vita_bind_api(void *data, enum gfx_ctx_api api, unsigned major, unsigned minor)
|
||||
{
|
||||
(void)data;
|
||||
(void)api;
|
||||
(void)major;
|
||||
(void)minor;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void vita_show_mouse(void *data, bool state)
|
||||
{
|
||||
(void)data;
|
||||
(void)state;
|
||||
}
|
||||
|
||||
static void vita_bind_hw_render(void *data, bool enable)
|
||||
{
|
||||
(void)data;
|
||||
(void)enable;
|
||||
}
|
||||
|
||||
static void *vita_init(video_frame_info_t *video_info, void *video_driver)
|
||||
{
|
||||
(void)video_driver;
|
||||
|
||||
return (void*)"vita";
|
||||
}
|
||||
|
||||
static uint32_t vita_get_flags(void *data)
|
||||
{
|
||||
uint32_t flags = 0;
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
static void vita_set_flags(void *data, uint32_t flags)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
const gfx_ctx_driver_t vita_ctx = {
|
||||
vita_init,
|
||||
vita_destroy,
|
||||
vita_get_api,
|
||||
vita_bind_api,
|
||||
vita_swap_interval,
|
||||
vita_set_video_mode,
|
||||
vita_get_video_size,
|
||||
NULL, /* get_refresh_rate */
|
||||
NULL, /* get_video_output_size */
|
||||
NULL, /* get_video_output_prev */
|
||||
NULL, /* get_video_output_next */
|
||||
NULL, /* get_metrics */
|
||||
NULL,
|
||||
NULL, /* update_title */
|
||||
vita_check_window,
|
||||
NULL, /* set_resize */
|
||||
vita_has_focus,
|
||||
vita_suppress_screensaver,
|
||||
false, /* has_windowed */
|
||||
vita_swap_buffers,
|
||||
vita_input_driver,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
vita_show_mouse,
|
||||
"vita",
|
||||
vita_get_flags,
|
||||
vita_set_flags,
|
||||
vita_bind_hw_render,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
@ -43,6 +43,10 @@
|
||||
|
||||
#define MAX_MSG_LEN_CHUNK 64
|
||||
|
||||
#ifdef VITA
|
||||
static float *vertices3 = NULL;
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gl1_t *gl;
|
||||
@ -79,7 +83,7 @@ static void gl1_raster_font_free_font(void *data,
|
||||
}
|
||||
|
||||
#if 0
|
||||
static bool gl1_raster_font_upload_atlas_components_4(gl1_raster_t *font)
|
||||
static bool gl1_raster_font_upload_atlas(gl1_raster_t *font)
|
||||
{
|
||||
unsigned i, j;
|
||||
GLint gl_internal = GL_RGBA;
|
||||
@ -263,8 +267,22 @@ static void gl1_raster_font_draw_vertices(gl1_raster_t *font,
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
||||
glColorPointer(4, GL_FLOAT, 0, coords->color);
|
||||
#ifdef VITA
|
||||
if (vertices3)
|
||||
free(vertices3);
|
||||
vertices3 = (float*)malloc(sizeof(float) * 3 * coords->vertices);
|
||||
int i;
|
||||
for (i = 0; i < coords->vertices; i++) {
|
||||
memcpy(&vertices3[i*3], &coords->vertex[i*2], sizeof(float) * 2);
|
||||
vertices3[i*3] -= 0.5f;
|
||||
vertices3[i*3+2] = 0.0f;
|
||||
}
|
||||
glVertexPointer(3, GL_FLOAT, 0, vertices3);
|
||||
#else
|
||||
glVertexPointer(2, GL_FLOAT, 0, coords->vertex);
|
||||
#endif
|
||||
|
||||
glColorPointer(4, GL_FLOAT, 0, coords->color);
|
||||
glTexCoordPointer(2, GL_FLOAT, 0, coords->tex_coord);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, coords->vertices);
|
||||
|
@ -26,6 +26,10 @@
|
||||
|
||||
#include "../menu_driver.h"
|
||||
|
||||
#ifdef VITA
|
||||
static float *vertices3 = NULL;
|
||||
#endif
|
||||
|
||||
static const GLfloat gl1_menu_vertexes[] = {
|
||||
0, 0,
|
||||
1, 0,
|
||||
@ -133,8 +137,22 @@ static void menu_display_gl1_draw(menu_display_ctx_draw_t *draw,
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
||||
glColorPointer(4, GL_FLOAT, 0, draw->coords->color);
|
||||
#ifdef VITA
|
||||
if (vertices3)
|
||||
free(vertices3);
|
||||
vertices3 = (float*)malloc(sizeof(float) * 3 * draw->coords->vertices);
|
||||
int i;
|
||||
for (i = 0; i < draw->coords->vertices; i++) {
|
||||
memcpy(&vertices3[i*3], &draw->coords->vertex[i*2], sizeof(float) * 2);
|
||||
vertices3[i*3] -= 0.5f;
|
||||
vertices3[i*3+2] = 0.0f;
|
||||
}
|
||||
glVertexPointer(3, GL_FLOAT, 0, vertices3);
|
||||
#else
|
||||
glVertexPointer(2, GL_FLOAT, 0, draw->coords->vertex);
|
||||
#endif
|
||||
|
||||
glColorPointer(4, GL_FLOAT, 0, draw->coords->color);
|
||||
glTexCoordPointer(2, GL_FLOAT, 0, draw->coords->tex_coord);
|
||||
|
||||
glDrawArrays(menu_display_prim_to_gl1_enum(
|
||||
|
@ -340,6 +340,9 @@ static const audio_driver_t *audio_drivers[] = {
|
||||
|
||||
|
||||
static const video_driver_t *video_drivers[] = {
|
||||
#ifdef HAVE_VITA2D
|
||||
&video_vita2d,
|
||||
#endif
|
||||
#ifdef HAVE_OPENGL
|
||||
&video_gl2,
|
||||
#endif
|
||||
@ -373,9 +376,6 @@ static const video_driver_t *video_drivers[] = {
|
||||
#if defined(HAVE_D3D8)
|
||||
&video_d3d8,
|
||||
#endif
|
||||
#ifdef HAVE_VITA2D
|
||||
&video_vita2d,
|
||||
#endif
|
||||
#ifdef PSP
|
||||
&video_psp1,
|
||||
#endif
|
||||
@ -452,6 +452,9 @@ static const gfx_ctx_driver_t *gfx_ctx_drivers[] = {
|
||||
#if defined(ORBIS)
|
||||
&orbis_ctx,
|
||||
#endif
|
||||
#if defined(VITA)
|
||||
&vita_ctx,
|
||||
#endif
|
||||
#if defined(HAVE_LIBNX) && defined(HAVE_OPENGL)
|
||||
&switch_ctx,
|
||||
#endif
|
||||
|
@ -1926,6 +1926,7 @@ extern const gfx_ctx_driver_t gfx_ctx_sixel;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_network;
|
||||
extern const gfx_ctx_driver_t switch_ctx;
|
||||
extern const gfx_ctx_driver_t orbis_ctx;
|
||||
extern const gfx_ctx_driver_t vita_ctx;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_null;
|
||||
|
||||
extern const shader_backend_t gl_glsl_backend;
|
||||
|
Loading…
x
Reference in New Issue
Block a user