\r
#define _IN_PRIMDRAW\r
\r
-#ifdef _WINDOWS\r
-#include "stdafx.h"\r
-#include "externals.h"\r
-#include "gpu.h"\r
-#include "draw.h"\r
-#include "texture.h"\r
-#else\r
#include "gpuStdafx.h"\r
#include "gpuExternals.h"\r
#include "gpuPlugin.h"\r
#include "gpuTexture.h"\r
#include "gpuPrim.h"\r
\r
-#endif\r
-\r
//////////////////////////////////////////////////////////////////////// \r
// defines\r
////////////////////////////////////////////////////////////////////////\r
// globals\r
////////////////////////////////////////////////////////////////////////\r
\r
-//#ifndef _WINDOWS\r
-//EGLSurface surface;\r
-//EGLDisplay display;\r
-//#endif\r
+EGLSurface surface;\r
+EGLDisplay display;\r
+\r
\r
BOOL bDrawTextured; // current active drawing states\r
BOOL bDrawSmoothShaded;\r
// Some ASM color convertion... Lewpy's special...\r
////////////////////////////////////////////////////////////////////////\r
\r
-#ifdef _WINDOWS\r
-#pragma warning (disable : 4035)\r
-\r
-unsigned long DoubleBGR2RGB (unsigned long BGR)\r
-{\r
-\r
- __asm\r
- {\r
- mov eax, BGR /* this can hold the G value */\r
- mov ebx, eax /* this can hold the R value */\r
- mov edx, eax /* this can hold the B value */\r
- and ebx, 000000ffh /* mask the R value */\r
- shl ebx, 1\r
- test ebx, 00000100h\r
- jz RSKIP\r
- mov ebx, 000000ffh\r
-\r
-RSKIP: \r
- and eax, 0000ff00h /* mask the G value */\r
- shl eax, 1\r
- test eax, 00010000h\r
- jz GSKIP\r
- mov eax, 0000ff00h\r
-\r
-GSKIP: \r
- and edx, 00ff0000h /* mask the B value */\r
- shl edx, 1\r
- test edx, 01000000h\r
- jz BSKIP\r
- mov edx, 00ff0000h\r
- \r
-BSKIP: \r
- or eax, ebx /* add R to G value */\r
- or eax, edx /* add B to RG value */\r
- }\r
- /* Result returned in EAX */\r
-}\r
-\r
-unsigned short BGR24to16 (unsigned long BGR)\r
-{\r
- __asm\r
- {\r
- mov eax, BGR /* this can hold the G value */\r
- mov ebx, eax /* this can hold the R value */\r
- mov edx, eax /* this can hold the B value */\r
- shr ebx, 3 /* move the R value */\r
- and edx, 00f80000h /* mask the B value */\r
- shr edx, 9 /* move the B value */\r
- and eax, 00f800h /* mask the G value */\r
- shr eax, 6 /* move the G value */\r
- and ebx, 0000001fh /* mask the R value */\r
- or eax, ebx /* add R to G value */\r
- or eax, edx /* add B to RG value */\r
- }\r
- /* Result returned in AX */\r
-}\r
-\r
-#pragma warning (default : 4035)\r
-\r
-#else\r
\r
unsigned long DoubleBGR2RGB (unsigned long BGR)\r
{\r
return ((BGR>>3)&0x1f)|((BGR&0xf80000)>>9)|((BGR&0xf800)>>6);\r
}\r
\r
-#endif\r
\r
////////////////////////////////////////////////////////////////////////\r
// OpenGL primitive drawing commands\r
////////////////////////////////////////////////////////////////////////\r
\r
-__inline void PRIMdrawTexturedQuad(OGLVertex* vertex1, OGLVertex* vertex2, \r
+void PRIMdrawTexturedQuad(OGLVertex* vertex1, OGLVertex* vertex2,\r
OGLVertex* vertex3, OGLVertex* vertex4) \r
{\r
\r
if(!DrawSemiTrans) // no semi trans at all?\r
{\r
if(bBlendEnable)\r
- {glDisable(GL_BLEND);bBlendEnable=FALSE;} // -> don't wanna blend\r
+ {glDisable(GL_BLEND);glError();bBlendEnable=FALSE;}// -> don't wanna blend\r
ubGloAlpha=ubGloColAlpha=255; // -> full alpha\r
return; // -> and bye\r
}\r
ubGloAlpha=ubGloColAlpha=TransSets[GlobalTextABR].alpha;\r
\r
if(!bBlendEnable)\r
- {glEnable(GL_BLEND);bBlendEnable=TRUE;} // wanna blend\r
+ {glEnable(GL_BLEND);glError();bBlendEnable=TRUE;} // wanna blend\r
\r
if(TransSets[GlobalTextABR].srcFac!=obm1 || \r
TransSets[GlobalTextABR].dstFac!=obm2)\r
{\r
obm1=TransSets[GlobalTextABR].srcFac;\r
obm2=TransSets[GlobalTextABR].dstFac;\r
- glBlendFunc(obm1,obm2); // set blend func\r
+ glBlendFunc(obm1,obm2); glError(); // set blend func\r
}\r
/*else\r
if(TransSets[GlobalTextABR].dstFac !=GL_ONE_MINUS_SRC_COLOR)\r
*/\r
obm1=TransSets[0].srcFac;\r
obm2=TransSets[0].dstFac;\r
- glBlendFunc(obm1,obm2); // set blend func\r
+ glBlendFunc(obm1,obm2); glError(); // set blend func\r
}\r
\r
void SetScanTexTrans(void) // blending for scan mask texture\r
*/\r
obm1=TransSets[2].srcFac;\r
obm2=TransSets[2].dstFac;\r
- glBlendFunc(obm1,obm2); // set blend func\r
+ glBlendFunc(obm1,obm2); glError(); // set blend func\r
}\r
\r
//////////////////////////////////////////////////////////////////////// \r
}\r
\r
if(!bBlendEnable)\r
- {glEnable(GL_BLEND);bBlendEnable=TRUE;} // wanna blend\r
+ {glEnable(GL_BLEND);glError();bBlendEnable=TRUE;} // wanna blend\r
\r
if(bm1!=obm1 || bm2!=obm2)\r
{\r
- glBlendFunc(bm1,bm2); // set blend func\r
+ glBlendFunc(bm1,bm2); glError(); // set blend func\r
obm1=bm1;obm2=bm2;\r
}\r
}\r
else currTex=SelectSubTextureS(GlobalTextTP,ulClutID);\r
\r
if(gTexName!=currTex)\r
- {gTexName=currTex;glBindTexture(GL_TEXTURE_2D,currTex);}\r
+ {gTexName=currTex;glBindTexture(GL_TEXTURE_2D,currTex); glError();}\r
\r
if(!bTexEnabled) // -> turn texturing on\r
- {bTexEnabled=TRUE;glEnable(GL_TEXTURE_2D);}\r
+ {bTexEnabled=TRUE;glEnable(GL_TEXTURE_2D); glError();}\r
}\r
else // no texture ?\r
if(bTexEnabled) \r
- {bTexEnabled=FALSE;glDisable(GL_TEXTURE_2D);} // -> turn texturing off\r
+ {bTexEnabled=FALSE;glDisable(GL_TEXTURE_2D); glError();} // -> turn texturing off\r
\r
if(bSCol) // also set color ?\r
{\r
{\r
if(bDrawSmoothShaded) glShadeModel(GL_SMOOTH); // -> set actual shading\r
else glShadeModel(GL_FLAT);\r
+ glError();\r
bOldSmoothShaded=bDrawSmoothShaded;\r
}\r
}\r
if(!PSXDisplay.DisplayMode.x) return;\r
if(!PSXDisplay.DisplayMode.y) return;\r
\r
- glDisable(GL_SCISSOR_TEST);\r
- glShadeModel(GL_FLAT);\r
+ glDisable(GL_SCISSOR_TEST); glError();\r
+ glShadeModel(GL_FLAT); glError();\r
bOldSmoothShaded=FALSE;\r
- glDisable(GL_BLEND);\r
+ glDisable(GL_BLEND); glError();\r
bBlendEnable=FALSE;\r
- glDisable(GL_TEXTURE_2D);\r
+ glDisable(GL_TEXTURE_2D); glError();\r
bTexEnabled=FALSE;\r
- glDisable(GL_ALPHA_TEST);\r
+ glDisable(GL_ALPHA_TEST); glError();\r
\r
//glPixelZoom(((float)rRatioRect.right)/((float)PSXDisplay.DisplayMode.x),\r
// -1.0f*(((float)rRatioRect.bottom)/((float)PSXDisplay.DisplayMode.y)));\r
\r
// glPixelZoom(1.0F,1.0F);\r
\r
- glEnable(GL_ALPHA_TEST);\r
- glEnable(GL_SCISSOR_TEST);\r
+ glEnable(GL_ALPHA_TEST); glError();\r
+ glEnable(GL_SCISSOR_TEST); glError();\r
}\r
\r
////////////////////////////////////////////////////////////////////////\r
bCheckMask=TRUE;\r
if(iDepthFunc==0) return;\r
iDepthFunc=0;\r
- glDepthFunc(GL_LESS);\r
+ glDepthFunc(GL_LESS); glError();\r
}\r
else\r
{\r
bCheckMask=FALSE;\r
if(iDepthFunc==1) return;\r
- glDepthFunc(GL_ALWAYS);\r
+ glDepthFunc(GL_ALWAYS); glError();\r
iDepthFunc=1;\r
}\r
}\r
b=((GLclampf)BLUE(gpuData[0]))/255.0f;\r
r=((GLclampf)RED(gpuData[0]))/255.0f;\r
\r
- glDisable(GL_SCISSOR_TEST); \r
- glClearColor(r,g,b,1.0f);\r
- glClear(uiBufferBits); \r
+ glDisable(GL_SCISSOR_TEST); glError();\r
+ glClearColor(r,g,b,1.0f); glError();\r
+ glClear(uiBufferBits); glError();\r
gl_z=0.0f;\r
\r
if(gpuData[0]!=0x02000000 &&\r
}\r
}\r
\r
- glEnable(GL_SCISSOR_TEST); \r
+ glEnable(GL_SCISSOR_TEST); glError();\r
}\r
else\r
{\r
SetRenderMode((unsigned long)0x01000000, FALSE);\r
vertex[0].c.lcol=gpuData[0]|0xff000000;\r
SETCOL(vertex[0]); \r
- glDisable(GL_SCISSOR_TEST); \r
+ glDisable(GL_SCISSOR_TEST); glError();\r
PRIMdrawQuad(&vertex[0], &vertex[1], &vertex[2], &vertex[3]);\r
- glEnable(GL_SCISSOR_TEST); \r
+ glEnable(GL_SCISSOR_TEST); glError();\r
}\r
}\r
\r