aboutsummaryrefslogtreecommitdiff
path: root/plugins/gpu-gles
diff options
context:
space:
mode:
authornotaz2012-01-21 23:22:30 +0200
committernotaz2012-01-21 23:22:30 +0200
commitbb88ec28db0535102b70a7c18ef095cb904e3c6c (patch)
tree29b8be7a70d4133266e2dba2917b8b8b3bdc30cc /plugins/gpu-gles
parentedee4a7fc46dd881c2a45d14ce569fbfd8336516 (diff)
downloadpcsx_rearmed-bb88ec28db0535102b70a7c18ef095cb904e3c6c.tar.gz
pcsx_rearmed-bb88ec28db0535102b70a7c18ef095cb904e3c6c.tar.bz2
pcsx_rearmed-bb88ec28db0535102b70a7c18ef095cb904e3c6c.zip
gpu-gles: refactor for caanoo/wiz support
too bad it's unusable there.
Diffstat (limited to 'plugins/gpu-gles')
-rw-r--r--plugins/gpu-gles/Makefile8
-rw-r--r--plugins/gpu-gles/gpuDraw.c43
-rw-r--r--plugins/gpu-gles/gpulib_if.c7
3 files changed, 39 insertions, 19 deletions
diff --git a/plugins/gpu-gles/Makefile b/plugins/gpu-gles/Makefile
index 241fad0..06552ed 100644
--- a/plugins/gpu-gles/Makefile
+++ b/plugins/gpu-gles/Makefile
@@ -8,7 +8,13 @@ SRC_STANDALONE += gpuDraw.c gpuFps.c gpuPlugin.c gpuPrim.c gpuTexture.c
SRC_GPULIB += gpulib_if.c
CFLAGS += -I$(PREFIX)include
-LDLIBS += -L$(PREFIX)lib -lGLES_CM
+LDLIBS += -L$(PREFIX)lib
+ifeq "$(PLATFORM)" "caanoo"
+CFLAGS += -DFAKE_WINDOW
+LDLIBS += -lopengles_lite -lstdc++
+else
+LDLIBS += -lGLES_CM
+endif
BIN_STANDLALONE = gpuGLES.so
BIN_GPULIB = gpu_gles.so
diff --git a/plugins/gpu-gles/gpuDraw.c b/plugins/gpu-gles/gpuDraw.c
index d7d6761..ebb3bf0 100644
--- a/plugins/gpu-gles/gpuDraw.c
+++ b/plugins/gpu-gles/gpuDraw.c
@@ -291,15 +291,17 @@ bool TestEGLError(const char* pszLocation)
EGLint iErr = eglGetError();
if (iErr != EGL_SUCCESS)
{
- printf("%s failed (%d).\n", pszLocation, iErr);
+ printf("%s failed (0x%x).\n", pszLocation, iErr);
return FALSE;
}
return TRUE;
}
-static void initEGL(void)
+static int initEGL(void)
{
+ NativeWindowType window = 0;
+
printf ("GL init\n");
EGLint numConfigs;
@@ -336,9 +338,10 @@ static void initEGL(void)
if (!x11Display)
{
printf("GLES Error: Unable to open X display\n");
+ return -1;
}
x11Screen = XDefaultScreen( x11Display );
-
+
// Gets the display parameters so we can pass the same parameters to the window to be created.
sRootWindow = RootWindow(x11Display, x11Screen);
i32Depth = DefaultDepth(x11Display, x11Screen);
@@ -347,7 +350,8 @@ static void initEGL(void)
if (!px11Visual)
{
printf("GLES Error: Unable to acquire visual\n");
- }
+ return -1;
+ }
// Colormap of the specified visual type for the display.
x11Colormap = XCreateColormap( x11Display, sRootWindow, px11Visual->visual, AllocNone );
sWA.colormap = x11Colormap;
@@ -357,7 +361,7 @@ static void initEGL(void)
// Display capabilities list.
ui32Mask = CWBackPixel | CWBorderPixel | CWEventMask | CWColormap;
-
+
// Creates the X11 window
x11Window = XCreateWindow( x11Display, RootWindow(x11Display, x11Screen), 0, 0, iResX, iResY,
0, CopyFromParent, InputOutput, CopyFromParent, ui32Mask, &sWA);
@@ -385,6 +389,7 @@ static void initEGL(void)
XSendEvent(x11Display, DefaultRootWindow(x11Display), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev);
display = eglGetDisplay( (EGLNativeDisplayType)x11Display );
+ window = x11Window;
#else
display = eglGetDisplay( (EGLNativeDisplayType)0 );
#endif
@@ -392,40 +397,48 @@ static void initEGL(void)
if( display == EGL_NO_DISPLAY )
{
printf( "GLES EGL Error: GL No Display\n" );
+ return -1;
}
if( !eglInitialize( display, &majorVersion, &minorVersion ) )
{
printf( "GLES EGL Error: eglInitialize failed\n" );
+ return -1;
}
if( !eglChooseConfig( display, attribList, &config, 1, &numConfigs ) )
{
printf( "GLES EGL Error: eglChooseConfig failed\n" );
+ return -1;
}
context = eglCreateContext( display, config, NULL, NULL );
if( context==0 )
{
printf( "GLES EGL Error: eglCreateContext failed\n" );
+ return -1;
}
-#if defined(USE_X11)
- surface = eglCreateWindowSurface( display, config, (EGLNativeDisplayType)x11Window, NULL );
-#else
- surface = eglCreateWindowSurface( display, config, (EGLNativeDisplayType)0, NULL );
+#ifdef FAKE_WINDOW
+ // broken Caanoo libs won't accept NULL window
+ window = (NativeWindowType)1;
#endif
+ surface = eglCreateWindowSurface( display, config, window, NULL );
+ if (!TestEGLError("eglCreateWindowSurface"))
+ return -1;
+
+ eglMakeCurrent( display, surface, surface, context );
+ if (!TestEGLError("eglMakeCurrent"))
+ return -1;
- eglMakeCurrent( display, surface, surface, context );
- if (!TestEGLError("eglMakeCurrent"))
- printf("error eglMakeCurrent");
- else
- printf("GLES Window Opened\n");
+ printf("GLES init ok\n");
+ return 0;
}
int GLinitialize()
{
- initEGL();
+ if(initEGL()!=0)
+ return -1;
//----------------------------------------------------//
diff --git a/plugins/gpu-gles/gpulib_if.c b/plugins/gpu-gles/gpulib_if.c
index 569fff4..ce32aad 100644
--- a/plugins/gpu-gles/gpulib_if.c
+++ b/plugins/gpu-gles/gpulib_if.c
@@ -626,11 +626,14 @@ void vout_update(void)
}
}
+static struct rearmed_cbs *cbs;
+
long GPUopen(void **dpy)
{
int ret;
- iResX = 800; iResY = 480;
+ iResX = cbs->screen_w;
+ iResY = cbs->screen_h;
rRatioRect.left = rRatioRect.top=0;
rRatioRect.right = iResX;
rRatioRect.bottom = iResY;
@@ -657,8 +660,6 @@ long GPUclose(void)
return 0;
}
-static struct rearmed_cbs *cbs;
-
/* acting as both renderer and vout handler here .. */
void renderer_set_config(const struct rearmed_cbs *cbs_)
{