X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=plugins%2Fgpu-gles%2FgpuDraw.c;h=c49eac5ff6d424ba2bd3dc778cf83be450371b6c;hp=ebb3bf0696fb54d5a37fb21445765c0133a0a88e;hb=HEAD;hpb=bb88ec28db0535102b70a7c18ef095cb904e3c6c diff --git a/plugins/gpu-gles/gpuDraw.c b/plugins/gpu-gles/gpuDraw.c index ebb3bf06..d6670ee2 100644 --- a/plugins/gpu-gles/gpuDraw.c +++ b/plugins/gpu-gles/gpuDraw.c @@ -111,7 +111,7 @@ BOOL bCheckMask=FALSE; int iUseMask=0; int iSetMask=0; unsigned short sSetMask=0; -unsigned long lSetMask=0; +unsigned int lSetMask=0; // drawing/coord vars @@ -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" @@ -291,7 +291,7 @@ bool TestEGLError(const char* pszLocation) EGLint iErr = eglGetError(); if (iErr != EGL_SUCCESS) { - printf("%s failed (0x%x).\n", pszLocation, iErr); + printf("%s failed (0x%x).\n", pszLocation, (int)iErr); return FALSE; } @@ -435,18 +435,29 @@ 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; + } //----------------------------------------------------// + glDepthRangef(0.0f, 1.0f);glError(); + glViewport(rRatioRect.left, // init viewport by ratio rect iResY-(rRatioRect.top+rRatioRect.bottom), rRatioRect.right, rRatioRect.bottom); glError(); - + glScissor(0, 0, iResX, iResY); glError(); // init clipping (fullscreen) glEnable(GL_SCISSOR_TEST); glError(); @@ -455,9 +466,8 @@ int GLinitialize() glLoadIdentity(); glScalef(1.0f/255.99f,1.0f/255.99f,1.0f); // geforce precision hack #endif - glDepthRangef(0.0f, 1.0f);glError(); - glPolygonOffset( -0.2f, -0.2f );glError(); + //glPolygonOffset( -0.2f, -0.2f );glError(); glMatrixMode(GL_PROJECTION); glError(); // init projection with psx resolution glLoadIdentity(); glError(); @@ -531,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; + } } //////////////////////////////////////////////////////////////////////// @@ -559,7 +572,7 @@ void GLcleanup() // real psx polygon coord mapping right... the following // works not to bad with many games, though -__inline BOOL CheckCoord4() +static __inline BOOL CheckCoord4() { if(lx0<0) { @@ -625,7 +638,7 @@ __inline BOOL CheckCoord4() return FALSE; } -__inline BOOL CheckCoord3() +static __inline BOOL CheckCoord3() { if(lx0<0) { @@ -662,7 +675,7 @@ __inline BOOL CheckCoord3() } -__inline BOOL CheckCoord2() +static __inline BOOL CheckCoord2() { if(lx0<0) { @@ -908,14 +921,14 @@ void offsetST(void) ///////////////////////////////////////////////////////// -void offsetScreenUpload(long Position) +void offsetScreenUpload(int Position) { if(bDisplayNotSet) SetOGLDisplaySettings(1); if(Position==-1) { - long lmdx,lmdy; + int lmdx,lmdy; lmdx=xrUploadArea.x0; lmdy=xrUploadArea.y0;