int RSP_ThreadProc(void *param) { RSP_Init(); while(true) { int num = 0; RSP.threadIdle = RSP.threadEvents.empty(); //process all events while(!RSP.threadEvents.empty()) { switch (RSP.threadEvents.front()) { case (RSPMSG_PROCESSDLIST): RSP_ProcessDList(); break; case (RSPMSG_UPDATESCREEN): VI_UpdateScreen(); break; case (RSPMSG_CLOSE): OGL_Stop(); return 0; break; case (RSPMSG_DESTROYTEXTURES): Combiner_Destroy(); TextureCache_Destroy(); break; case (RSPMSG_INITTEXTURES): TextureCache_Init(); Combiner_Init(); gSP.changed = gDP.changed = 0xFFFFFFFF; break; case (RSPMSG_CAPTURESCREEN): OGL_SaveScreenshot(); break; } RSP.threadEvents.pop(); num++; } } return 0; }
bool OGL_Start(void) { float f; OGL_InitStates(); #ifdef USE_SDL /////// paulscode, graphics bug-fixes float depth = gDP.fillColor.z ; glDisable( GL_SCISSOR_TEST ); glDepthMask( GL_TRUE ); // fixes side-bar graphics glitches glClearDepth( 1.0f ); // fixes missing graphics on Qualcomm Adreno glClearColor( 0, 0, 0, 1 ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glFinish(); Android_JNI_SwapWindow(); // paulscode, fix for black-screen bug glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glFinish(); OGL_UpdateDepthUpdate(); glEnable( GL_SCISSOR_TEST ); //////// #endif //check extensions if ((config.texture.maxAnisotropy>0) && !OGL_IsExtSupported("GL_EXT_texture_filter_anistropic")) { LOG(LOG_WARNING, "Anistropic Filtering is not supported.\n"); config.texture.maxAnisotropy = 0; } f = 0; glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &f); if (config.texture.maxAnisotropy > ((int)f)) { LOG(LOG_WARNING, "Clamping max anistropy to %ix.\n", (int)f); config.texture.maxAnisotropy = (int)f; } //Print some info LOG(LOG_VERBOSE, "[gles2n64]: Enable Runfast... \n"); OGL_EnableRunfast(); //We must have a shader bound before binding any textures: ShaderCombiner_Init(); ShaderCombiner_Set(EncodeCombineMode(0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0), -1); ShaderCombiner_Set(EncodeCombineMode(0, 0, 0, SHADE, 0, 0, 0, 1, 0, 0, 0, SHADE, 0, 0, 0, 1), -1); TextureCache_Init(); memset(OGL.triangles.vertices, 0, VERTBUFF_SIZE * sizeof(SPVertex)); memset(OGL.triangles.elements, 0, ELEMBUFF_SIZE * sizeof(GLubyte)); OGL.triangles.num = 0; #ifdef __TRIBUFFER_OPT __indexmap_init(); #endif OGL.renderingToTexture = false; OGL.renderState = RS_NONE; gSP.changed = gDP.changed = 0xFFFFFFFF; VI.displayNum = 0; glGetError(); return TRUE; }