glViewport(rRatioRect.left, // init viewport by ratio rect\r
iResY-(rRatioRect.top+rRatioRect.bottom),\r
rRatioRect.right, \r
- rRatioRect.bottom); \r
+ rRatioRect.bottom); glError();\r
\r
- glScissor(0, 0, iResX, iResY); // init clipping (fullscreen)\r
- glEnable(GL_SCISSOR_TEST); \r
+ glScissor(0, 0, iResX, iResY); glError(); // init clipping (fullscreen)\r
+ glEnable(GL_SCISSOR_TEST); glError();\r
\r
#ifndef OWNSCALE\r
glMatrixMode(GL_TEXTURE); // init psx tex sow and tow if not "ownscale"\r
glScalef(1.0f/255.99f,1.0f/255.99f,1.0f); // geforce precision hack\r
#endif \r
\r
- glMatrixMode(GL_PROJECTION); // init projection with psx resolution\r
- glLoadIdentity();\r
+ glMatrixMode(GL_PROJECTION); glError(); // init projection with psx resolution\r
+ glLoadIdentity(); glError();\r
glOrtho(0,PSXDisplay.DisplayMode.x,\r
- PSXDisplay.DisplayMode.y, 0, -1, 1);\r
+ PSXDisplay.DisplayMode.y, 0, -1, 1); glError();\r
if (bKeepRatio)\r
SetAspectRatio();\r
}\r
// some PAD or SPU plugins would not work anymore)\r
////////////////////////////////////////////////////////////////////////\r
\r
-long CALLBACK GPUopen(int hwndGPU)\r
+long CALLBACK GPUopen(unsigned long *disp, char *cap, char *cfg)\r
{\r
iResX=800;iResY=480;\r
iColDepth=8;\r
\r
InitializeTextureStore(); // init texture mem\r
\r
+ CSTEXTURE = CSVERTEX = CSCOLOR = 0;\r
+\r
// lGPUstatusRet = 0x74000000;\r
\r
// with some emus, we could do the OGL init right here... oh my\r
-// if(bIsFirstFrame) GLinitialize();\r
+ if(bIsFirstFrame) GLinitialize(NULL, NULL);\r
\r
return 0;\r
}\r
void PaintBlackBorders(void)\r
{\r
short s;\r
+ glDisable(GL_SCISSOR_TEST); glError();\r
+ if(bTexEnabled) {glDisable(GL_TEXTURE_2D);bTexEnabled=FALSE;} glError();\r
+ if(bOldSmoothShaded) {glShadeModel(GL_FLAT);bOldSmoothShaded=FALSE;} glError();\r
+ if(bBlendEnable) {glDisable(GL_BLEND);bBlendEnable=FALSE;} glError();\r
+ glDisable(GL_ALPHA_TEST); glError();\r
\r
- glDisable(GL_SCISSOR_TEST);\r
- if(bTexEnabled) {glDisable(GL_TEXTURE_2D);bTexEnabled=FALSE;}\r
- if(bOldSmoothShaded) {glShadeModel(GL_FLAT);bOldSmoothShaded=FALSE;}\r
- if(bBlendEnable) {glDisable(GL_BLEND);bBlendEnable=FALSE;}\r
- glDisable(GL_ALPHA_TEST);\r
+ glEnable(GL_ALPHA_TEST); glError();\r
+ glEnable(GL_SCISSOR_TEST); glError();\r
\r
- glEnable(GL_ALPHA_TEST);\r
- glEnable(GL_SCISSOR_TEST);\r
}\r
\r
////////////////////////////////////////////////////////////////////////\r
\r
if(PSXDisplay.Disabled) // display disabled?\r
{\r
+ //LOGE("PSXDisplay.Disabled");\r
+\r
// moved here\r
- glDisable(GL_SCISSOR_TEST); \r
- glClearColor(0,0,0,128); // -> clear whole backbuffer\r
- glClear(uiBufferBits);\r
- glEnable(GL_SCISSOR_TEST); \r
+ glDisable(GL_SCISSOR_TEST); glError(); \r
+ glClearColor(0,0,0,128); glError(); // -> clear whole backbuffer\r
+ glClear(uiBufferBits); glError();\r
+ glEnable(GL_SCISSOR_TEST); glError(); \r
gl_z=0.0f;\r
bDisplayNotSet = TRUE;\r
}\r
g=((GLclampf)GREEN(lClearOnSwapColor))/255.0f; // -> get col\r
b=((GLclampf)BLUE(lClearOnSwapColor))/255.0f;\r
r=((GLclampf)RED(lClearOnSwapColor))/255.0f;\r
- \r
- glDisable(GL_SCISSOR_TEST); \r
- glClearColor(r,g,b,128); // -> clear \r
- glClear(uiBufferBits);\r
- glEnable(GL_SCISSOR_TEST); \r
+ glDisable(GL_SCISSOR_TEST); glError(); \r
+ glClearColor(r,g,b,128); glError(); // -> clear \r
+ glClear(uiBufferBits); glError();\r
+ glEnable(GL_SCISSOR_TEST); glError(); \r
lClearOnSwap=0; // -> done\r
}\r
else \r
\r
if(iZBufferDepth) // clear zbuffer as well (if activated)\r
{\r
- glDisable(GL_SCISSOR_TEST); \r
- glClear(GL_DEPTH_BUFFER_BIT);\r
- glEnable(GL_SCISSOR_TEST); \r
+ glDisable(GL_SCISSOR_TEST); glError();\r
+ glClear(GL_DEPTH_BUFFER_BIT); glError();\r
+ glEnable(GL_SCISSOR_TEST); glError();\r
}\r
}\r
+\r
gl_z=0.0f;\r
\r
//----------------------------------------------------//\r
glViewport(rRatioRect.left+i1, \r
iResY-(rRatioRect.top+rRatioRect.bottom)+i2,\r
rRatioRect.right+i3, \r
- rRatioRect.bottom+i4); \r
+ rRatioRect.bottom+i4); glError();\r
}\r
\r
//----------------------------------------------------//\r
\r
r.left = (iResX-r.right)/2;\r
r.top = (iResY-r.bottom)/2;\r
-\r
if(r.bottom<rRatioRect.bottom ||\r
r.right <rRatioRect.right)\r
{\r
RECT rC;\r
- glClearColor(0,0,0,128); \r
+ glClearColor(0,0,0,128); glError();\r
\r
if(r.right <rRatioRect.right)\r
{\r
rC.top=0;\r
rC.right=r.left;\r
rC.bottom=iResY;\r
- glScissor(rC.left,rC.top,rC.right,rC.bottom);\r
- glClear(uiBufferBits);\r
+ glScissor(rC.left,rC.top,rC.right,rC.bottom); glError();\r
+ glClear(uiBufferBits); glError();\r
rC.left=iResX-rC.right;\r
- glScissor(rC.left,rC.top,rC.right,rC.bottom);\r
- glClear(uiBufferBits);\r
+ glScissor(rC.left,rC.top,rC.right,rC.bottom); glError();\r
+ \r
+ glClear(uiBufferBits); glError();\r
}\r
\r
if(r.bottom <rRatioRect.bottom)\r
rC.top=0;\r
rC.right=iResX;\r
rC.bottom=r.top;\r
- glScissor(rC.left,rC.top,rC.right,rC.bottom);\r
- glClear(uiBufferBits);\r
+ glScissor(rC.left,rC.top,rC.right,rC.bottom); glError();\r
+\r
+ glClear(uiBufferBits); glError();\r
rC.top=iResY-rC.bottom;\r
- glScissor(rC.left,rC.top,rC.right,rC.bottom);\r
- glClear(uiBufferBits);\r
+ glScissor(rC.left,rC.top,rC.right,rC.bottom); glError();\r
+ glClear(uiBufferBits); glError();\r
}\r
\r
bSetClip=TRUE;\r
glViewport(rRatioRect.left,\r
iResY-(rRatioRect.top+rRatioRect.bottom),\r
rRatioRect.right,\r
- rRatioRect.bottom); // init viewport\r
+ rRatioRect.bottom); glError(); // init viewport\r
}\r
\r
////////////////////////////////////////////////////////////////////////\r
}\r
else // some res change?\r
{\r
- glLoadIdentity();\r
+ glLoadIdentity(); glError();\r
glOrtho(0,PSXDisplay.DisplayModeNew.x, // -> new psx resolution\r
- PSXDisplay.DisplayModeNew.y, 0, -1, 1);\r
+ PSXDisplay.DisplayModeNew.y, 0, -1, 1); glError();\r
if(bKeepRatio) SetAspectRatio();\r
}\r
\r
{\r
unsigned long lCommand=(gdata>>24)&0xff;\r
\r
-if(bIsFirstFrame) GLinitialize(); // real ogl startup (needed by some emus)\r
+if(bIsFirstFrame) GLinitialize(NULL, NULL); // real ogl startup (needed by some emus)\r
\r
ulStatusControl[lCommand]=gdata;\r
\r
\r
if(!pGfxCardScreen)\r
{\r
- glPixelStorei(GL_PACK_ALIGNMENT,1);\r
+ glPixelStorei(GL_PACK_ALIGNMENT,1); glError();\r
pGfxCardScreen=(unsigned char *)malloc(iResX*iResY*4);\r
}\r
\r
\r
//if(!sArea) glReadBuffer(GL_FRONT);\r
\r
- glReadPixels(x,y,dx,dy,GL_RGB,GL_UNSIGNED_BYTE,ps);\r
- \r
+ glReadPixels(x,y,dx,dy,GL_RGB,GL_UNSIGNED_BYTE,ps); glError();\r
//if(!sArea) glReadBuffer(GL_BACK);\r
\r
s=0;\r
\r
if(!pGfxCardScreen)\r
{\r
- glPixelStorei(GL_PACK_ALIGNMENT,1);\r
+ glPixelStorei(GL_PACK_ALIGNMENT,1); glError();\r
pGfxCardScreen=(unsigned char *)malloc(iResX*iResY*4);\r
}\r
\r
\r
// if(bFront) glReadBuffer(GL_FRONT);\r
\r
- glReadPixels(x,y,dx,dy,GL_RGB,GL_UNSIGNED_BYTE,ps);\r
- \r
+ glReadPixels(x,y,dx,dy,GL_RGB,GL_UNSIGNED_BYTE,ps); glError(); glError();\r
// if(bFront) glReadBuffer(GL_BACK);\r
\r
XS=(float)dx/(float)(udx);\r
unsigned char * baseAddrB;\r
short count;unsigned int DMACommandCounter = 0;\r
\r
-if(bIsFirstFrame) GLinitialize();\r
+if(bIsFirstFrame) GLinitialize(NULL, NULL);\r
\r
GPUIsBusy;\r
\r
if(count>0) GPUwriteDataMem(&baseAddrL[dmaMem>>2],count);\r
\r
addr = baseAddrL[addr>>2]&0xffffff;\r
- }\r
-while (addr != 0xffffff);\r
-\r
+ } while (!(addr & 0x800000)); // contrary to some documentation, the end-of-linked-list marker is not actually 0xFF'FFFF\r
+ // any pointer with bit 23 set will do.\r
GPUIsIdle;\r
\r
return 0;\r
\r
if(!pGfxCardScreen)\r
{\r
- glPixelStorei(GL_PACK_ALIGNMENT,1);\r
+ glPixelStorei(GL_PACK_ALIGNMENT,1); glError();\r
pGfxCardScreen=(unsigned char *)malloc(iResX*iResY*4);\r
}\r
\r
\r
// glReadBuffer(GL_FRONT);\r
\r
- glReadPixels(0,0,iResX,iResY,GL_RGB,GL_UNSIGNED_BYTE,ps);\r
+ glReadPixels(0,0,iResX,iResY,GL_RGB,GL_UNSIGNED_BYTE,ps); glError();\r
\r
// glReadBuffer(GL_BACK);\r
\r