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=3842503faa84f049183a0540bcfb2a2074d9e815;hp=597f286b8c72c0b17a13d24dc4aa568c365169ca;hb=0507e4f1e5c28ea0e5214b32ed1f6f571f7b8066;hpb=7eadbf885fc9ebd271fa0d7bce3f27394488b059 diff --git a/plugins/gpu-gles/gpuDraw.c b/plugins/gpu-gles/gpuDraw.c index 597f286b..3842503f 100644 --- a/plugins/gpu-gles/gpuDraw.c +++ b/plugins/gpu-gles/gpuDraw.c @@ -27,17 +27,7 @@ #define _IN_DRAW -#ifdef _WINDOWS -#include "stdafx.h" -#include -#include -#include -#include "externals.h" -#include "gpu.h" -#include "draw.h" -#include "prim.h" -#include "texture.h" -#else + #include "gpuExternals.h" #include "gpuPlugin.h" #include "gpuDraw.h" @@ -48,7 +38,6 @@ #include #include #include -#endif //#include "menu.h" //////////////////////////////////////////////////////////////////////////////////// @@ -102,13 +91,8 @@ //////////////////////////////////////////////////////////////////////////////////// // draw globals -#ifdef _WINDOWS -HDC dcGlobal=NULL; -HWND hWWindow; -#else void glBlendEquationEXT(GLenum mode); void glColorTableEXT(GLenum target, GLenum internalFormat, GLsizei width, GLenum format,GLenum type, const GLvoid *data); -#endif // draw globals; most will be initialized again later (by config or checks) @@ -158,50 +142,6 @@ GLbitfield uiBufferBits=GL_COLOR_BUFFER_BIT; // Set OGL pixel format //////////////////////////////////////////////////////////////////////// -#ifdef _WINDOWS -BOOL bSetupPixelFormat(HDC hDC) -{ - int pixelformat; - static PIXELFORMATDESCRIPTOR pfd = - { - sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd - 1, // version number - PFD_DRAW_TO_WINDOW | // support window - PFD_SUPPORT_OPENGL | // support OpenGL - PFD_DOUBLEBUFFER, // double buffered - PFD_TYPE_RGBA, // RGBA type - 16, // 16-bit color depth (adjusted later) - 0, 0, 0, 0, 0, 0, // color bits ignored - 0, // no alpha buffer - 0, // shift bit ignored - 0, // no accumulation buffer - 0, 0, 0, 0, // accum bits ignored - 0, // z-buffer - 0, - 0, // no auxiliary buffer - PFD_MAIN_PLANE, // main layer - 0, // reserved - 0, 0, 0 // layer masks ignored - }; - - pfd.cColorBits=iColDepth; // set user color depth - pfd.cDepthBits=iZBufferDepth; // set user zbuffer (by psx mask) - - if((pixelformat=ChoosePixelFormat(hDC,&pfd))==0) - { - MessageBox(NULL,"ChoosePixelFormat failed","Error",MB_OK); - return FALSE; - } - - if(SetPixelFormat(hDC,pixelformat, &pfd)==FALSE) - { - MessageBox(NULL,"SetPixelFormat failed","Error",MB_OK); - return FALSE; - } - - return TRUE; -} -#endif //////////////////////////////////////////////////////////////////////// // Get extension infos (f.e. pal textures / packed pixels) @@ -211,16 +151,12 @@ void GetExtInfos(void) { BOOL bPacked=FALSE; // default: no packed pixel support - if(strstr((s8 *)glGetString(GL_EXTENSIONS), // packed pixels available? + if(strstr((char *)glGetString(GL_EXTENSIONS), // packed pixels available? "GL_EXT_packed_pixels")) bPacked=TRUE; // -> ok - #ifdef _WINDOWS - iClampType=GL_CLAMP; -#else iClampType=GL_CLAMP_TO_EDGE; -#endif } //////////////////////////////////////////////////////////////////////// @@ -304,15 +240,9 @@ void CreateScanLines(void) // Initialize OGL //////////////////////////////////////////////////////////////////////// -#ifdef _WINDOWS -HGLRC GLCONTEXT=NULL; -#endif - -#ifdef MAEMO_CHANGES #define MODE_RAW 0 #define MODE_X11 1 #define MODE_SDL 2 -int pandora_driver_mode = MODE_RAW; int use_fsaa = 0; EGLDisplay display; @@ -345,9 +275,7 @@ EGLint attrib_list_fsaa[] = EGLint attrib_list[] = { - EGL_SURFACE_TYPE, EGL_WINDOW_BIT, - EGL_BUFFER_SIZE, 0, - EGL_DEPTH_SIZE, 16, +// EGL_DEPTH_SIZE, 16, EGL_NONE }; @@ -368,7 +296,8 @@ bool TestEGLError(const char* pszLocation) return TRUE; } -void maemoGLinit(){ +static void initEGL(void) +{ printf ("GL init\n"); EGLint numConfigs; @@ -400,15 +329,6 @@ void maemoGLinit(){ } #if defined(USE_X11) - pandora_driver_mode = MODE_X11; // TODO make configurable -#else - pandora_driver_mode = MODE_RAW; // TODO make configurable -#endif - - switch(pandora_driver_mode) - { -#if defined(USE_X11) - case MODE_X11: // Initializes the display and screen x11Display = XOpenDisplay( ":0" ); if (!x11Display) @@ -463,13 +383,9 @@ void maemoGLinit(){ XSendEvent(x11Display, DefaultRootWindow(x11Display), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev); display = eglGetDisplay( (EGLNativeDisplayType)x11Display ); - break; -#endif - case MODE_RAW: - default: +#else display = eglGetDisplay( (EGLNativeDisplayType)0 ); - break; - } +#endif if( display == EGL_NO_DISPLAY ) { @@ -492,18 +408,11 @@ void maemoGLinit(){ printf( "GLES EGL Error: eglCreateContext failed\n" ); } - switch(pandora_driver_mode) - { #if defined(USE_X11) - case MODE_X11: surface = eglCreateWindowSurface( display, config, (EGLNativeDisplayType)x11Window, NULL ); - break; -#endif - case MODE_RAW: - default: +#else surface = eglCreateWindowSurface( display, config, (EGLNativeDisplayType)0, NULL ); - break; - } +#endif eglMakeCurrent( display, surface, surface, context ); if (!TestEGLError("eglMakeCurrent")) @@ -511,24 +420,11 @@ void maemoGLinit(){ else printf("GLES Window Opened\n"); } -#endif int GLinitialize() { - //----------------------------------------------------// -#ifdef _WINDOWS - HGLRC objectRC; - // init - dcGlobal = GetDC(hWWindow); // FIRST: dc/rc stuff - objectRC = wglCreateContext(dcGlobal); - GLCONTEXT=objectRC; - wglMakeCurrent(dcGlobal, objectRC); - // CheckWGLExtensions(dcGlobal); - if(bWindowMode) ReleaseDC(hWWindow,dcGlobal); // win mode: release dc again -#endif -#ifdef MAEMO_CHANGES - maemoGLinit(); -#endif + initEGL(); + //----------------------------------------------------// glViewport(rRatioRect.left, // init viewport by ratio rect @@ -616,25 +512,15 @@ void GLcleanup() { CleanupTextureStore(); // bye textures -#ifdef _WINDOWS - wglMakeCurrent(NULL, NULL); // bye context - if(GLCONTEXT) wglDeleteContext(GLCONTEXT); - if(!bWindowMode && dcGlobal) - ReleaseDC(hWWindow,dcGlobal); -#endif - eglMakeCurrent( display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT ); eglDestroySurface( display, surface ); eglDestroyContext( display, context ); eglTerminate( display ); #if defined(USE_X11) - if (pandora_driver_mode == MODE_X11) - { if (x11Window) XDestroyWindow(x11Display, x11Window); if (x11Colormap) XFreeColormap( x11Display, x11Colormap ); if (x11Display) XCloseDisplay(x11Display); - } #endif } @@ -1335,9 +1221,7 @@ void assignTexture4(void) // render pos / buffers //////////////////////////////////////////////////////////////////////// -#ifndef _WINDOWS #define EqualRect(pr1,pr2) ((pr1)->left==(pr2)->left && (pr1)->top==(pr2)->top && (pr1)->right==(pr2)->right && (pr1)->bottom==(pr2)->bottom) -#endif //////////////////////////////////////////////////////////////////////// // SetDisplaySettings: "simply" calcs the new drawing area and updates