aboutsummaryrefslogtreecommitdiff
path: root/plugins/gpu-gles
diff options
context:
space:
mode:
authortwinaphex2013-02-09 10:05:21 +0100
committertwinaphex2013-02-09 10:05:21 +0100
commitad72cb33d8ef068b92a059a774dd7871d052a707 (patch)
treef8623af5beeb8939631acceb2acb505c9497f71c /plugins/gpu-gles
parent2dfdc938c99783e187f60c1d13db73e0ee434c92 (diff)
parentd57557c0644f9294e30657f0c7cf673cf2914695 (diff)
downloadpcsx_rearmed-ad72cb33d8ef068b92a059a774dd7871d052a707.tar.gz
pcsx_rearmed-ad72cb33d8ef068b92a059a774dd7871d052a707.tar.bz2
pcsx_rearmed-ad72cb33d8ef068b92a059a774dd7871d052a707.zip
Merge git://github.com/notaz/pcsx_rearmed
Diffstat (limited to 'plugins/gpu-gles')
-rw-r--r--plugins/gpu-gles/Makefile2
-rw-r--r--plugins/gpu-gles/gpuDraw.c32
-rw-r--r--plugins/gpu-gles/gpuDraw.h2
-rw-r--r--plugins/gpu-gles/gpuExternals.h4
-rw-r--r--plugins/gpu-gles/gpuPlugin.c6
-rw-r--r--plugins/gpu-gles/gpuPrim.c3
-rw-r--r--plugins/gpu-gles/gpuStdafx.h6
-rw-r--r--plugins/gpu-gles/gpulib_if.c9
8 files changed, 39 insertions, 25 deletions
diff --git a/plugins/gpu-gles/Makefile b/plugins/gpu-gles/Makefile
index 769a68b..e914764 100644
--- a/plugins/gpu-gles/Makefile
+++ b/plugins/gpu-gles/Makefile
@@ -16,6 +16,6 @@ CFLAGS += $(CFLAGS_GLES)
LDLIBS += $(LDLIBS_GLES)
endif
-BIN_STANDLALONE = gpuGLES.so
+#BIN_STANDALONE = gpuGLES.so
BIN_GPULIB = gpu_gles.so
include ../gpulib/gpulib.mak
diff --git a/plugins/gpu-gles/gpuDraw.c b/plugins/gpu-gles/gpuDraw.c
index b619104..34d1c3b 100644
--- a/plugins/gpu-gles/gpuDraw.c
+++ b/plugins/gpu-gles/gpuDraw.c
@@ -248,9 +248,9 @@ void CreateScanLines(void)
int use_fsaa = 0;
EGLDisplay display;
-EGLConfig config;
-EGLContext context;
EGLSurface surface;
+static EGLConfig config;
+static EGLContext context;
#if defined(USE_X11)
#include "X11/Xlib.h"
@@ -435,10 +435,19 @@ static int initEGL(void)
return 0;
}
-int GLinitialize()
+static int created_gles_context;
+
+int GLinitialize(void *ext_gles_display, void *ext_gles_surface)
{
- if(initEGL()!=0)
- return -1;
+ if(ext_gles_display != NULL && ext_gles_surface != NULL) {
+ display = (EGLDisplay)ext_gles_display;
+ surface = (EGLSurface)ext_gles_surface;
+ }
+ else {
+ if(initEGL()!=0)
+ return -1;
+ created_gles_context=1;
+ }
//----------------------------------------------------//
@@ -448,7 +457,7 @@ int GLinitialize()
iResY-(rRatioRect.top+rRatioRect.bottom),
rRatioRect.right,
rRatioRect.bottom); glError();
-
+
glScissor(0, 0, iResX, iResY); glError(); // init clipping (fullscreen)
glEnable(GL_SCISSOR_TEST); glError();
@@ -532,16 +541,19 @@ void GLcleanup()
{
CleanupTextureStore(); // bye textures
- eglMakeCurrent( display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
- eglDestroySurface( display, surface );
- eglDestroyContext( display, context );
- eglTerminate( display );
+ if(created_gles_context) {
+ eglMakeCurrent( display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
+ eglDestroySurface( display, surface );
+ eglDestroyContext( display, context );
+ eglTerminate( display );
#if defined(USE_X11)
if (x11Window) XDestroyWindow(x11Display, x11Window);
if (x11Colormap) XFreeColormap( x11Display, x11Colormap );
if (x11Display) XCloseDisplay(x11Display);
#endif
+ created_gles_context=0;
+ }
}
////////////////////////////////////////////////////////////////////////
diff --git a/plugins/gpu-gles/gpuDraw.h b/plugins/gpu-gles/gpuDraw.h
index c59927d..a45bf46 100644
--- a/plugins/gpu-gles/gpuDraw.h
+++ b/plugins/gpu-gles/gpuDraw.h
@@ -49,7 +49,7 @@ extern "C" {
BOOL bSetupPixelFormat(HDC hDC);
#endif
-int GLinitialize();
+int GLinitialize(void *ext_gles_display, void *ext_gles_surface);
void GLcleanup();
#ifdef _WINDOWS
BOOL offset2(void);
diff --git a/plugins/gpu-gles/gpuExternals.h b/plugins/gpu-gles/gpuExternals.h
index 897b446..1260167 100644
--- a/plugins/gpu-gles/gpuExternals.h
+++ b/plugins/gpu-gles/gpuExternals.h
@@ -41,6 +41,10 @@ extern "C" {
#include <GLES/glext.h>
#endif
+#ifndef GL_BGRA_EXT
+#define GL_BGRA_EXT GL_RGBA // ??
+#endif
+
#ifdef __NANOGL__
#define glTexParameteri(x,y,z) glTexParameterf(x,y,z)
#define glAlphaFuncx(x,y) glAlphaFunc(x,y)
diff --git a/plugins/gpu-gles/gpuPlugin.c b/plugins/gpu-gles/gpuPlugin.c
index 9d749a5..60570ac 100644
--- a/plugins/gpu-gles/gpuPlugin.c
+++ b/plugins/gpu-gles/gpuPlugin.c
@@ -511,7 +511,7 @@ long CALLBACK GPUopen(int hwndGPU)
// lGPUstatusRet = 0x74000000;
// with some emus, we could do the OGL init right here... oh my
- if(bIsFirstFrame) GLinitialize();
+ if(bIsFirstFrame) GLinitialize(NULL, NULL);
return 0;
}
@@ -1170,7 +1170,7 @@ void CALLBACK GPUwriteStatus(unsigned long gdata)
{
unsigned long lCommand=(gdata>>24)&0xff;
-if(bIsFirstFrame) GLinitialize(); // real ogl startup (needed by some emus)
+if(bIsFirstFrame) GLinitialize(NULL, NULL); // real ogl startup (needed by some emus)
ulStatusControl[lCommand]=gdata;
@@ -2183,7 +2183,7 @@ unsigned long dmaMem;
unsigned char * baseAddrB;
short count;unsigned int DMACommandCounter = 0;
-if(bIsFirstFrame) GLinitialize();
+if(bIsFirstFrame) GLinitialize(NULL, NULL);
GPUIsBusy;
diff --git a/plugins/gpu-gles/gpuPrim.c b/plugins/gpu-gles/gpuPrim.c
index 2f200eb..218ff66 100644
--- a/plugins/gpu-gles/gpuPrim.c
+++ b/plugins/gpu-gles/gpuPrim.c
@@ -44,9 +44,6 @@
// globals
////////////////////////////////////////////////////////////////////////
-EGLSurface surface;
-EGLDisplay display;
-
BOOL bDrawTextured; // current active drawing states
BOOL bDrawSmoothShaded;
diff --git a/plugins/gpu-gles/gpuStdafx.h b/plugins/gpu-gles/gpuStdafx.h
index 69050b3..41051dc 100644
--- a/plugins/gpu-gles/gpuStdafx.h
+++ b/plugins/gpu-gles/gpuStdafx.h
@@ -82,12 +82,6 @@ extern "C" {
#define SHADETEXBIT(x) ((x>>24) & 0x1)
#define SEMITRANSBIT(x) ((x>>25) & 0x1)
-#ifndef _WINDOWS
-#ifndef GL_BGRA_EXT
-#define GL_BGRA_EXT GL_RGBA
-#endif
-#endif
-
#if 0
#define glError() { \
GLenum err = glGetError(); \
diff --git a/plugins/gpu-gles/gpulib_if.c b/plugins/gpu-gles/gpulib_if.c
index 2090553..1f4a23d 100644
--- a/plugins/gpu-gles/gpulib_if.c
+++ b/plugins/gpu-gles/gpulib_if.c
@@ -690,7 +690,7 @@ long GPUopen(void **dpy)
InitializeTextureStore(); // init texture mem
- ret = GLinitialize();
+ ret = GLinitialize(cbs->gles_display, cbs->gles_surface);
MakeDisplayLists();
is_opened = 1;
@@ -726,9 +726,16 @@ void renderer_set_config(const struct rearmed_cbs *cbs_)
bUseFastMdec = cbs->gpu_peopsgl.bUseFastMdec;
iTexGarbageCollection = cbs->gpu_peopsgl.iTexGarbageCollection;
iVRamSize = cbs->gpu_peopsgl.iVRamSize;
+
if (cbs->pl_set_gpu_caps)
cbs->pl_set_gpu_caps(GPU_CAP_OWNS_DISPLAY);
+ if (is_opened && cbs->gles_display != NULL && cbs->gles_surface != NULL) {
+ // HACK..
+ GPUclose();
+ GPUopen(NULL);
+ }
+
set_vram(gpu.vram);
}