vita: fix PVR_PSP2 (GLES) + gl4es4fita (GL)

This commit is contained in:
Anonymous Maarten 2023-01-22 21:02:35 +01:00 committed by Anonymous Maarten
parent ec3234ea21
commit 3cb819ac48
7 changed files with 31 additions and 24 deletions

View File

@ -2460,6 +2460,7 @@ elseif(VITA)
list(APPEND SDL_EXTRA_LIBS
libgpu_es4_ext_stub_weak
libIMGEGL_stub_weak
SceIme_stub
)
set(HAVE_VIDEO_VITA_PVR ON)

View File

@ -27,6 +27,8 @@
#if !defined(_MSC_VER) && !defined(__ANDROID__) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS)
#if defined(__vita__) || defined(__psp2__)
#include <psp2/display.h>
#include <psp2/gxm.h>
#include <psp2/types.h>
#endif

View File

@ -32,6 +32,9 @@
#if SDL_VIDEO_DRIVER_RPI
#include <unistd.h>
#endif
#if SDL_VIDEO_VITA_PVR_OGL
#include <GLES2/gl2.h>
#endif
#include "SDL_sysvideo.h"
#include "SDL_egl_c.h"

View File

@ -34,10 +34,10 @@
#define MAX_PATH 256 // vita limits are somehow wrong
/* Defaults */
int FB_WIDTH = 960;
int FB_HEIGHT = 544;
static int FB_WIDTH = 960;
static int FB_HEIGHT = 544;
void getFBSize(int *width, int *height)
static void getFBSize(int *width, int *height)
{
*width = FB_WIDTH;
*height = FB_HEIGHT;
@ -51,33 +51,33 @@ int VITA_GL_LoadLibrary(_THIS, const char *path)
char *default_path = "app0:module";
char target_path[MAX_PATH];
if (skip_init == NULL) // we don't care about actual value {
if (skip_init == NULL) { // we don't care about actual value
if (override != NULL) {
default_path = override;
}
sceKernelLoadStartModule("vs0:sys/external/libfios2.suprx", 0, NULL, 0, NULL, NULL);
sceKernelLoadStartModule("vs0:sys/external/libc.suprx", 0, NULL, 0, NULL, NULL);
sceKernelLoadStartModule("vs0:sys/external/libfios2.suprx", 0, NULL, 0, NULL, NULL);
sceKernelLoadStartModule("vs0:sys/external/libc.suprx", 0, NULL, 0, NULL, NULL);
SDL_snprintf(target_path, MAX_PATH, "%s/%s", default_path, "libGL.suprx");
sceKernelLoadStartModule(target_path, 0, NULL, 0, NULL, NULL);
SDL_snprintf(target_path, MAX_PATH, "%s/%s", default_path, "libGL.suprx");
sceKernelLoadStartModule(target_path, 0, NULL, 0, NULL, NULL);
SDL_snprintf(target_path, MAX_PATH, "%s/%s", default_path, "libgpu_es4_ext.suprx");
sceKernelLoadStartModule(target_path, 0, NULL, 0, NULL, NULL);
SDL_snprintf(target_path, MAX_PATH, "%s/%s", default_path, "libgpu_es4_ext.suprx");
sceKernelLoadStartModule(target_path, 0, NULL, 0, NULL, NULL);
SDL_snprintf(target_path, MAX_PATH, "%s/%s", default_path, "libIMGEGL.suprx");
sceKernelLoadStartModule(target_path, 0, NULL, 0, NULL, NULL);
SDL_snprintf(target_path, MAX_PATH, "%s/%s", default_path, "libIMGEGL.suprx");
sceKernelLoadStartModule(target_path, 0, NULL, 0, NULL, NULL);
PVRSRVInitializeAppHint(&hint);
PVRSRVInitializeAppHint(&hint);
SDL_snprintf(hint.szGLES1, MAX_PATH, "%s/%s", default_path, "libGLESv1_CM.suprx");
SDL_snprintf(hint.szGLES2, MAX_PATH, "%s/%s", default_path, "libGLESv2.suprx");
SDL_snprintf(hint.szWindowSystem, MAX_PATH, "%s/%s", default_path, "libpvrPSP2_WSEGL.suprx");
SDL_snprintf(hint.szGLES1, MAX_PATH, "%s/%s", default_path, "libGLESv1_CM.suprx");
SDL_snprintf(hint.szGLES2, MAX_PATH, "%s/%s", default_path, "libGLESv2.suprx");
SDL_snprintf(hint.szWindowSystem, MAX_PATH, "%s/%s", default_path, "libpvrPSP2_WSEGL.suprx");
PVRSRVCreateVirtualAppHint(&hint);
}
PVRSRVCreateVirtualAppHint(&hint);
}
return SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType)0, 0);
return SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType)0, 0);
}
SDL_GLContext
@ -115,7 +115,7 @@ VITA_GL_CreateContext(_THIS, SDL_Window *window)
return context;
}
void *
SDL_FunctionPointer
VITA_GL_GetProcAddress(_THIS, const char *proc)
{
return gl4es_GetProcAddress(proc);

View File

@ -177,9 +177,10 @@ int VITA_GLES_SetSwapInterval(_THIS, int interval)
return SDL_SetError("Unable to set the EGL swap interval");
}
int VITA_GLES_GetSwapInterval(_THIS)
int VITA_GLES_GetSwapInterval(_THIS, int *interval)
{
return _this->gl_data->swapinterval;
*interval = _this->gl_data->swapinterval;
return 0;
}
int VITA_GLES_SwapWindow(_THIS, SDL_Window *window)

View File

@ -48,6 +48,6 @@ extern SDL_GLContext VITA_GLES_CreateContext(_THIS, SDL_Window *window);
extern int VITA_GLES_LoadLibrary(_THIS, const char *path);
extern void VITA_GLES_UnloadLibrary(_THIS);
extern int VITA_GLES_SetSwapInterval(_THIS, int interval);
extern int VITA_GLES_GetSwapInterval(_THIS);
extern int VITA_GLES_GetSwapInterval(_THIS, int *interval);
#endif /* SDL_vitagles_c_h_ */

View File

@ -97,7 +97,7 @@ void VITA_GLES_UnloadLibrary(_THIS);
SDL_GLContext VITA_GLES_CreateContext(_THIS, SDL_Window *window);
int VITA_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context);
int VITA_GLES_SetSwapInterval(_THIS, int interval);
int VITA_GLES_GetSwapInterval(_THIS);
int VITA_GLES_GetSwapInterval(_THIS, int *interval);
int VITA_GLES_SwapWindow(_THIS, SDL_Window *window);
void VITA_GLES_DeleteContext(_THIS, SDL_GLContext context);
#endif