X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=plugins%2Fgpu-gles%2FgpuPrim.c;h=218ff66d30e1360f2ff107d500c266a0ac9ff86b;hp=2f200ebfc11de745ce1723c3a194116d7a98ffd2;hb=HEAD;hpb=edee4a7fc46dd881c2a45d14ce569fbfd8336516 diff --git a/plugins/gpu-gles/gpuPrim.c b/plugins/gpu-gles/gpuPrim.c index 2f200ebf..ed16e4a9 100644 --- a/plugins/gpu-gles/gpuPrim.c +++ b/plugins/gpu-gles/gpuPrim.c @@ -44,9 +44,6 @@ // globals //////////////////////////////////////////////////////////////////////// -EGLSurface surface; -EGLDisplay display; - BOOL bDrawTextured; // current active drawing states BOOL bDrawSmoothShaded; @@ -80,15 +77,15 @@ BOOL bUsingMovie=FALSE; // movie active flag PSXRect_t xrMovieArea; // rect for movie upload short sSprite_ux2; // needed for sprire adjust short sSprite_vy2; // -unsigned long ulOLDCOL=0; // active color -unsigned long ulClutID; // clut +unsigned int ulOLDCOL=0; // active color +unsigned int ulClutID; // clut -unsigned long dwCfgFixes; // game fixes -unsigned long dwActFixes=0; -unsigned long dwEmuFixes=0; +unsigned int dwCfgFixes; // game fixes +unsigned int dwActFixes=0; +unsigned int dwEmuFixes=0; BOOL bUseFixes; -long drawX,drawY,drawW,drawH; // offscreen drawing checkers +int drawX,drawY,drawW,drawH; // offscreen drawing checkers short sxmin,sxmax,symin,symax; unsigned int CSVERTEX=0,CSCOLOR=0,CSTEXTURE=0; @@ -150,9 +147,9 @@ void UpdateGlobalTP(unsigned short gdata) //////////////////////////////////////////////////////////////////////// -unsigned long DoubleBGR2RGB (unsigned long BGR) +unsigned int DoubleBGR2RGB (unsigned int BGR) { - unsigned long ebx,eax,edx; + unsigned int ebx,eax,edx; ebx=(BGR&0x000000ff)<<1; if(ebx&0x00000100) ebx=0x000000ff; @@ -166,7 +163,7 @@ unsigned long DoubleBGR2RGB (unsigned long BGR) return (ebx|eax|edx); } -unsigned short BGR24to16 (unsigned long BGR) +unsigned short BGR24to16 (unsigned int BGR) { return ((BGR>>3)&0x1f)|((BGR&0xf80000)>>9)|((BGR&0xf800)>>6); } @@ -950,7 +947,7 @@ void SetZMask3NT(void) //////////////////////////////////////////////////////////////////////// - void SetRenderState(unsigned long DrawAttributes) + void SetRenderState(unsigned int DrawAttributes) { bDrawNonShaded = (SHADETEXBIT(DrawAttributes)) ? TRUE : FALSE; DrawSemiTrans = (SEMITRANSBIT(DrawAttributes)) ? TRUE : FALSE; @@ -958,7 +955,7 @@ void SetZMask3NT(void) //////////////////////////////////////////////////////////////////////// - void SetRenderColor(unsigned long DrawAttributes) + void SetRenderColor(unsigned int DrawAttributes) { if(bDrawNonShaded) {g_m1=g_m2=g_m3=128;} else @@ -971,7 +968,7 @@ void SetZMask3NT(void) //////////////////////////////////////////////////////////////////////// -void SetRenderMode(unsigned long DrawAttributes,BOOL bSCol) +void SetRenderMode(unsigned int DrawAttributes,BOOL bSCol) { if((bUseMultiPass) && (bDrawTextured) && !(bDrawNonShaded)) {bDrawMultiPass = TRUE; SetSemiTransMulti(0);} @@ -1027,7 +1024,7 @@ void SetRenderMode(unsigned long DrawAttributes,BOOL bSCol) // Set Opaque multipass color //////////////////////////////////////////////////////////////////////// -void SetOpaqueColor(unsigned long DrawAttributes) +void SetOpaqueColor(unsigned int DrawAttributes) { if(bDrawNonShaded) return; // no shading? bye @@ -1402,7 +1399,7 @@ BOOL CheckAgainstFrontScreen(short imageX0,short imageY0,short imageX1,short ima //////////////////////////////////////////////////////////////////////// -void PrepareFullScreenUpload (long Position) +void PrepareFullScreenUpload (int Position) { if (Position==-1) // rgb24 { @@ -1484,7 +1481,7 @@ void PrepareFullScreenUpload (long Position) unsigned char * LoadDirectMovieFast(void); -void UploadScreenEx(long Position) +void UploadScreenEx(int Position) { short ya,yb,xa,xb,x, y, YStep, XStep, U, UStep,ux[4],vy[4]; @@ -1568,7 +1565,7 @@ void UploadScreenEx(long Position) //////////////////////////////////////////////////////////////////////// -void UploadScreen(long Position) +void UploadScreen(int Position) { short x, y, YStep, XStep, U, s, UStep,ux[4],vy[4]; short xa,xb,ya,yb; @@ -1649,8 +1646,8 @@ void UploadScreen(long Position) gl_vy[2] = gl_vy[3] = s; gl_ux[0] = gl_ux[3] = gl_vy[0] = gl_vy[1] = 0; - SetRenderState((unsigned long)0x01000000); - SetRenderMode((unsigned long)0x01000000, FALSE); // upload texture data + SetRenderState((unsigned int)0x01000000); + SetRenderMode((unsigned int)0x01000000, FALSE); // upload texture data offsetScreenUpload(Position); assignTextureVRAMWrite(); @@ -1715,7 +1712,7 @@ BOOL IsInsideNextScreen(short x, short y, short xoff, short yoff) void cmdSTP(unsigned char * baseAddr) { - unsigned long gdata = ((unsigned long*)baseAddr)[0]; + unsigned int gdata = ((unsigned int*)baseAddr)[0]; STATUSREG&=~0x1800; // clear the necessary bits STATUSREG|=((gdata & 0x03) << 11); // set the current bits @@ -1748,7 +1745,7 @@ void cmdSTP(unsigned char * baseAddr) void cmdTexturePage(unsigned char * baseAddr) { - unsigned long gdata = ((unsigned long*)baseAddr)[0]; + unsigned int gdata = ((unsigned int*)baseAddr)[0]; UpdateGlobalTP((unsigned short)gdata); GlobalTextREST = (gdata&0x00ffffff)>>9; } @@ -1759,9 +1756,9 @@ void cmdTexturePage(unsigned char * baseAddr) void cmdTextureWindow(unsigned char *baseAddr) { - unsigned long gdata = ((unsigned long*)baseAddr)[0]; + unsigned int gdata = ((unsigned int*)baseAddr)[0]; - unsigned long YAlign,XAlign; + unsigned int YAlign,XAlign; ulGPUInfoVals[INFO_TW]=gdata&0xFFFFF; @@ -1795,8 +1792,8 @@ void cmdTextureWindow(unsigned char *baseAddr) // Re-calculate the bit field, because we can't trust what is passed in the data - YAlign = (unsigned long)(32 - (TWin.Position.y1 >> 3)); - XAlign = (unsigned long)(32 - (TWin.Position.x1 >> 3)); + YAlign = (unsigned int)(32 - (TWin.Position.y1 >> 3)); + XAlign = (unsigned int)(32 - (TWin.Position.x1 >> 3)); // Absolute position of the start of the texture window @@ -1968,7 +1965,7 @@ void ClampToPSXScreenOffset(short *x0, short *y0, short *x1, short *y1) void cmdDrawAreaStart(unsigned char * baseAddr) { - unsigned long gdata = ((unsigned long*)baseAddr)[0]; + unsigned int gdata = ((unsigned int*)baseAddr)[0]; drawX = gdata & 0x3ff; // for soft drawing if(drawX>=1024) drawX=1023; @@ -1999,7 +1996,7 @@ void cmdDrawAreaStart(unsigned char * baseAddr) void cmdDrawAreaEnd(unsigned char * baseAddr) { - unsigned long gdata = ((unsigned long*)baseAddr)[0]; + unsigned int gdata = ((unsigned int*)baseAddr)[0]; drawW = gdata & 0x3ff; // for soft drawing if(drawW>=1024) drawW=1023; @@ -2034,7 +2031,7 @@ void cmdDrawAreaEnd(unsigned char * baseAddr) void cmdDrawOffset(unsigned char * baseAddr) { - unsigned long gdata = ((unsigned long*)baseAddr)[0]; + unsigned int gdata = ((unsigned int*)baseAddr)[0]; PreviousPSXDisplay.DrawOffset.x = PSXDisplay.DrawOffset.x = (short)(gdata & 0x7ff); @@ -2244,7 +2241,7 @@ void primStoreImage(unsigned char * baseAddr) void primBlkFill(unsigned char * baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); iDrawnSomething=1; @@ -2295,8 +2292,8 @@ void primBlkFill(unsigned char * baseAddr) { bDrawTextured = FALSE; bDrawSmoothShaded = FALSE; - SetRenderState((unsigned long)0x01000000); - SetRenderMode((unsigned long)0x01000000, FALSE); + SetRenderState((unsigned int)0x01000000); + SetRenderMode((unsigned int)0x01000000, FALSE); vertex[0].c.lcol=0xff000000; SETCOL(vertex[0]); if(ly0>pd->DisplayPosition.y) @@ -2323,8 +2320,8 @@ void primBlkFill(unsigned char * baseAddr) { bDrawTextured = FALSE; bDrawSmoothShaded = FALSE; - SetRenderState((unsigned long)0x01000000); - SetRenderMode((unsigned long)0x01000000, FALSE); + SetRenderState((unsigned int)0x01000000); + SetRenderMode((unsigned int)0x01000000, FALSE); vertex[0].c.lcol=gpuData[0]|0xff000000; SETCOL(vertex[0]); //glDisable(GL_SCISSOR_TEST); glError(); @@ -2494,12 +2491,12 @@ void primMoveImage(unsigned char * baseAddr) } else { - unsigned long *SRCPtr, *DSTPtr; + unsigned int *SRCPtr, *DSTPtr; unsigned short LineOffset; int dx=imageSX>>1; - SRCPtr = (unsigned long *)(psxVuw + (1024*imageY0) + imageX0); - DSTPtr = (unsigned long *)(psxVuw + (1024*imageY1) + imageX1); + SRCPtr = (unsigned int *)(psxVuw + (1024*imageY0) + imageX0); + DSTPtr = (unsigned int *)(psxVuw + (1024*imageY1) + imageX1); LineOffset = 512 - dx; @@ -2600,7 +2597,7 @@ void primMoveImage(unsigned char * baseAddr) void primTileS(unsigned char * baseAddr) { - unsigned long *gpuData = ((unsigned long*)baseAddr); + unsigned int *gpuData = ((unsigned int*)baseAddr); short *sgpuData = ((short *) baseAddr); sprtX = sgpuData[2]; @@ -2665,7 +2662,7 @@ void primTileS(unsigned char * baseAddr) void primTile1(unsigned char * baseAddr) { - unsigned long *gpuData = ((unsigned long*)baseAddr); + unsigned int *gpuData = ((unsigned int*)baseAddr); short *sgpuData = ((short *) baseAddr); sprtX = sgpuData[2]; @@ -2712,7 +2709,7 @@ void primTile1(unsigned char * baseAddr) void primTile8(unsigned char * baseAddr) { - unsigned long *gpuData = ((unsigned long*)baseAddr); + unsigned int *gpuData = ((unsigned int*)baseAddr); short *sgpuData = ((short *) baseAddr); sprtX = sgpuData[2]; @@ -2759,7 +2756,7 @@ void primTile8(unsigned char * baseAddr) void primTile16(unsigned char * baseAddr) { - unsigned long *gpuData = ((unsigned long*)baseAddr); + unsigned int *gpuData = ((unsigned int*)baseAddr); short *sgpuData = ((short *) baseAddr); sprtX = sgpuData[2]; @@ -2806,7 +2803,7 @@ void primTile16(unsigned char * baseAddr) /*void DrawMultiBlur(void) { - long lABR,lDST;float fx,fy; + int lABR,lDST;float fx,fy; lABR=GlobalTextABR; lDST=DrawSemiTrans; @@ -2839,7 +2836,7 @@ void primTile16(unsigned char * baseAddr) void DrawMultiFilterSprite(void) { - long lABR,lDST; + int lABR,lDST; if(bUseMultiPass || DrawSemiTrans || ubOpaqueDraw) { @@ -2870,7 +2867,7 @@ void DrawMultiFilterSprite(void) void primSprt8(unsigned char * baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); short s; @@ -2991,7 +2988,7 @@ void primSprt8(unsigned char * baseAddr) void primSprt16(unsigned char * baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); short s; @@ -3111,7 +3108,7 @@ void primSprt16(unsigned char * baseAddr) void primSprtSRest(unsigned char * baseAddr,unsigned short type) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); short s;unsigned short sTypeRest=0; @@ -3282,7 +3279,7 @@ void primSprtSRest(unsigned char * baseAddr,unsigned short type) void primSprtS(unsigned char * baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); short s;unsigned short sTypeRest=0; @@ -3421,7 +3418,7 @@ void primSprtS(unsigned char * baseAddr) void primPolyF4(unsigned char *baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); lx0 = sgpuData[2]; @@ -3516,7 +3513,7 @@ BOOL bCheckFF9G4(unsigned char * baseAddr) if(iFF9Fix==2) { - long labr=GlobalTextABR; + int labr=GlobalTextABR; GlobalTextABR=1; primPolyG4(pFF9G4Cache); GlobalTextABR=labr; @@ -3530,7 +3527,7 @@ BOOL bCheckFF9G4(unsigned char * baseAddr) void primPolyG4(unsigned char * baseAddr) { - unsigned long *gpuData = (unsigned long *)baseAddr; + unsigned int *gpuData = (unsigned int *)baseAddr; short *sgpuData = ((short *) baseAddr); lx0 = sgpuData[2]; @@ -3581,7 +3578,7 @@ void primPolyG4(unsigned char * baseAddr) // cmd: flat shaded Texture3 //////////////////////////////////////////////////////////////////////// -BOOL DoLineCheck(unsigned long * gpuData) +BOOL DoLineCheck(unsigned int * gpuData) { BOOL bQuad=FALSE;short dx,dy; @@ -3748,7 +3745,7 @@ BOOL DoLineCheck(unsigned long * gpuData) void primPolyFT3(unsigned char * baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); lx0 = sgpuData[2]; @@ -4184,7 +4181,7 @@ void RectTexAlign(void) void primPolyFT4(unsigned char * baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); lx0 = sgpuData[2]; @@ -4272,7 +4269,7 @@ void primPolyFT4(unsigned char * baseAddr) void primPolyGT3(unsigned char *baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); lx0 = sgpuData[2]; @@ -4381,7 +4378,7 @@ void primPolyGT3(unsigned char *baseAddr) void primPolyG3(unsigned char *baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); lx0 = sgpuData[2]; @@ -4426,7 +4423,7 @@ void primPolyG3(unsigned char *baseAddr) void primPolyGT4(unsigned char *baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); lx0 = sgpuData[2]; @@ -4546,7 +4543,7 @@ void primPolyGT4(unsigned char *baseAddr) void primPolyF3(unsigned char *baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); lx0 = sgpuData[2]; @@ -4590,7 +4587,7 @@ void primPolyF3(unsigned char *baseAddr) void primLineGSkip(unsigned char *baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); int iMax=255; int i=2; @@ -4615,7 +4612,7 @@ void primLineGSkip(unsigned char *baseAddr) void primLineGEx(unsigned char *baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); int iMax=255; short cx0,cx1,cy0,cy1;int i;BOOL bDraw=TRUE; @@ -4679,7 +4676,7 @@ void primLineGEx(unsigned char *baseAddr) void primLineG2(unsigned char *baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); lx0 = sgpuData[2]; @@ -4724,7 +4721,7 @@ void primLineG2(unsigned char *baseAddr) void primLineFSkip(unsigned char *baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); int i=2,iMax=255; ly1 = (short)((gpuData[1]>>16) & 0xffff); @@ -4744,7 +4741,7 @@ void primLineFSkip(unsigned char *baseAddr) void primLineFEx(unsigned char *baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); int iMax; short cx0,cx1,cy0,cy1;int i; @@ -4802,7 +4799,7 @@ void primLineFEx(unsigned char *baseAddr) void primLineF2(unsigned char *baseAddr) { - unsigned long *gpuData = ((unsigned long *) baseAddr); + unsigned int *gpuData = ((unsigned int *) baseAddr); short *sgpuData = ((short *) baseAddr); lx0 = sgpuData[2];