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=37db05217a8d7e7f2b958f5245b0531b877e5761;hp=980d3ddaa597c6c4f3c9b8f52f1c2d361e6d5571;hb=0507e4f1e5c28ea0e5214b32ed1f6f571f7b8066;hpb=7eadbf885fc9ebd271fa0d7bce3f27394488b059 diff --git a/plugins/gpu-gles/gpuPrim.c b/plugins/gpu-gles/gpuPrim.c index 980d3dda..37db0521 100644 --- a/plugins/gpu-gles/gpuPrim.c +++ b/plugins/gpu-gles/gpuPrim.c @@ -26,13 +26,6 @@ #define _IN_PRIMDRAW -#ifdef _WINDOWS -#include "stdafx.h" -#include "externals.h" -#include "gpu.h" -#include "draw.h" -#include "texture.h" -#else #include "gpuStdafx.h" #include "gpuExternals.h" #include "gpuPlugin.h" @@ -40,8 +33,6 @@ #include "gpuTexture.h" #include "gpuPrim.h" -#endif - //////////////////////////////////////////////////////////////////////// // defines //////////////////////////////////////////////////////////////////////// @@ -53,10 +44,9 @@ // globals //////////////////////////////////////////////////////////////////////// -//#ifndef _WINDOWS -//EGLSurface surface; -//EGLDisplay display; -//#endif +EGLSurface surface; +EGLDisplay display; + BOOL bDrawTextured; // current active drawing states BOOL bDrawSmoothShaded; @@ -146,66 +136,6 @@ void UpdateGlobalTP(unsigned short gdata) // Some ASM color convertion... Lewpy's special... //////////////////////////////////////////////////////////////////////// -#ifdef _WINDOWS -#pragma warning (disable : 4035) - -unsigned long DoubleBGR2RGB (unsigned long BGR) -{ - - __asm - { - mov eax, BGR /* this can hold the G value */ - mov ebx, eax /* this can hold the R value */ - mov edx, eax /* this can hold the B value */ - and ebx, 000000ffh /* mask the R value */ - shl ebx, 1 - test ebx, 00000100h - jz RSKIP - mov ebx, 000000ffh - -RSKIP: - and eax, 0000ff00h /* mask the G value */ - shl eax, 1 - test eax, 00010000h - jz GSKIP - mov eax, 0000ff00h - -GSKIP: - and edx, 00ff0000h /* mask the B value */ - shl edx, 1 - test edx, 01000000h - jz BSKIP - mov edx, 00ff0000h - -BSKIP: - or eax, ebx /* add R to G value */ - or eax, edx /* add B to RG value */ - } - /* Result returned in EAX */ -} - -unsigned short BGR24to16 (unsigned long BGR) -{ - __asm - { - mov eax, BGR /* this can hold the G value */ - mov ebx, eax /* this can hold the R value */ - mov edx, eax /* this can hold the B value */ - shr ebx, 3 /* move the R value */ - and edx, 00f80000h /* mask the B value */ - shr edx, 9 /* move the B value */ - and eax, 00f800h /* mask the G value */ - shr eax, 6 /* move the G value */ - and ebx, 0000001fh /* mask the R value */ - or eax, ebx /* add R to G value */ - or eax, edx /* add B to RG value */ - } - /* Result returned in AX */ -} - -#pragma warning (default : 4035) - -#else unsigned long DoubleBGR2RGB (unsigned long BGR) { @@ -228,13 +158,12 @@ unsigned short BGR24to16 (unsigned long BGR) return ((BGR>>3)&0x1f)|((BGR&0xf80000)>>9)|((BGR&0xf800)>>6); } -#endif //////////////////////////////////////////////////////////////////////// // OpenGL primitive drawing commands //////////////////////////////////////////////////////////////////////// -__inline void PRIMdrawTexturedQuad(OGLVertex* vertex1, OGLVertex* vertex2, +void PRIMdrawTexturedQuad(OGLVertex* vertex1, OGLVertex* vertex2, OGLVertex* vertex3, OGLVertex* vertex4) { @@ -1514,7 +1443,7 @@ void PrepareFullScreenUpload (long Position) //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// -u8 * LoadDirectMovieFast(void); +unsigned char * LoadDirectMovieFast(void); void UploadScreenEx(long Position) { @@ -1745,7 +1674,7 @@ BOOL IsInsideNextScreen(short x, short y, short xoff, short yoff) //Mask1 Set mask bit while drawing. 1 = on //Mask2 Do not draw to mask areas. 1= on -void cmdSTP(u8 * baseAddr) +void cmdSTP(unsigned char * baseAddr) { unsigned long gdata = ((unsigned long*)baseAddr)[0]; @@ -1778,7 +1707,7 @@ void cmdSTP(u8 * baseAddr) // cmd: Set texture page infos //////////////////////////////////////////////////////////////////////// -void cmdTexturePage(u8 * baseAddr) +void cmdTexturePage(unsigned char * baseAddr) { unsigned long gdata = ((unsigned long*)baseAddr)[0]; UpdateGlobalTP((unsigned short)gdata); @@ -1789,7 +1718,7 @@ void cmdTexturePage(u8 * baseAddr) // cmd: turn on/off texture window //////////////////////////////////////////////////////////////////////// -void cmdTextureWindow(u8 *baseAddr) +void cmdTextureWindow(unsigned char *baseAddr) { unsigned long gdata = ((unsigned long*)baseAddr)[0]; @@ -1998,7 +1927,7 @@ void ClampToPSXScreenOffset(short *x0, short *y0, short *x1, short *y1) // cmd: start of drawing area... primitives will be clipped inside //////////////////////////////////////////////////////////////////////// -void cmdDrawAreaStart(u8 * baseAddr) +void cmdDrawAreaStart(unsigned char * baseAddr) { unsigned long gdata = ((unsigned long*)baseAddr)[0]; @@ -2029,7 +1958,7 @@ void cmdDrawAreaStart(u8 * baseAddr) // cmd: end of drawing area... primitives will be clipped inside //////////////////////////////////////////////////////////////////////// -void cmdDrawAreaEnd(u8 * baseAddr) +void cmdDrawAreaEnd(unsigned char * baseAddr) { unsigned long gdata = ((unsigned long*)baseAddr)[0]; @@ -2064,7 +1993,7 @@ void cmdDrawAreaEnd(u8 * baseAddr) // cmd: draw offset... will be added to prim coords //////////////////////////////////////////////////////////////////////// -void cmdDrawOffset(u8 * baseAddr) +void cmdDrawOffset(unsigned char * baseAddr) { unsigned long gdata = ((unsigned long*)baseAddr)[0]; @@ -2095,7 +2024,7 @@ void cmdDrawOffset(u8 * baseAddr) // cmd: load image to vram //////////////////////////////////////////////////////////////////////// -void primLoadImage(u8 * baseAddr) +void primLoadImage(unsigned char * baseAddr) { unsigned short *sgpuData = ((unsigned short *) baseAddr); @@ -2252,7 +2181,7 @@ void CheckWriteUpdate() // cmd: vram -> psx mem //////////////////////////////////////////////////////////////////////// -void primStoreImage(u8 * baseAddr) +void primStoreImage(unsigned char * baseAddr) { unsigned short *sgpuData = ((unsigned short *) baseAddr); @@ -2274,7 +2203,7 @@ void primStoreImage(u8 * baseAddr) // cmd: blkfill - NO primitive! Doesn't care about draw areas... //////////////////////////////////////////////////////////////////////// -void primBlkFill(u8 * baseAddr) +void primBlkFill(unsigned char * baseAddr) { unsigned long *gpuData = ((unsigned long *) baseAddr); short *sgpuData = ((short *) baseAddr); @@ -2471,7 +2400,7 @@ void MoveImageWrapped(short imageX0,short imageY0, //////////////////////////////////////////////////////////////////////// -void primMoveImage(u8 * baseAddr) +void primMoveImage(unsigned char * baseAddr) { short *sgpuData = ((short *) baseAddr); short imageY0,imageX0,imageY1,imageX1,imageSX,imageSY,i,j; @@ -2630,7 +2559,7 @@ void primMoveImage(u8 * baseAddr) // cmd: draw free-size Tile //////////////////////////////////////////////////////////////////////// -void primTileS(u8 * baseAddr) +void primTileS(unsigned char * baseAddr) { unsigned long *gpuData = ((unsigned long*)baseAddr); short *sgpuData = ((short *) baseAddr); @@ -2695,7 +2624,7 @@ void primTileS(u8 * baseAddr) // cmd: draw 1 dot Tile (point) //////////////////////////////////////////////////////////////////////// -void primTile1(u8 * baseAddr) +void primTile1(unsigned char * baseAddr) { unsigned long *gpuData = ((unsigned long*)baseAddr); short *sgpuData = ((short *) baseAddr); @@ -2742,7 +2671,7 @@ void primTile1(u8 * baseAddr) // cmd: draw 8 dot Tile (small rect) //////////////////////////////////////////////////////////////////////// -void primTile8(u8 * baseAddr) +void primTile8(unsigned char * baseAddr) { unsigned long *gpuData = ((unsigned long*)baseAddr); short *sgpuData = ((short *) baseAddr); @@ -2789,7 +2718,7 @@ void primTile8(u8 * baseAddr) // cmd: draw 16 dot Tile (medium rect) //////////////////////////////////////////////////////////////////////// -void primTile16(u8 * baseAddr) +void primTile16(unsigned char * baseAddr) { unsigned long *gpuData = ((unsigned long*)baseAddr); short *sgpuData = ((short *) baseAddr); @@ -2900,7 +2829,7 @@ void DrawMultiFilterSprite(void) // cmd: small sprite (textured rect) //////////////////////////////////////////////////////////////////////// -void primSprt8(u8 * baseAddr) +void primSprt8(unsigned char * baseAddr) { unsigned long *gpuData = ((unsigned long *) baseAddr); short *sgpuData = ((short *) baseAddr); @@ -3021,7 +2950,7 @@ void primSprt8(u8 * baseAddr) // cmd: medium sprite (textured rect) //////////////////////////////////////////////////////////////////////// -void primSprt16(u8 * baseAddr) +void primSprt16(unsigned char * baseAddr) { unsigned long *gpuData = ((unsigned long *) baseAddr); short *sgpuData = ((short *) baseAddr); @@ -3141,7 +3070,7 @@ void primSprt16(u8 * baseAddr) // cmd: free-size sprite (textured rect) //////////////////////////////////////////////////////////////////////// -void primSprtSRest(u8 * baseAddr,unsigned short type) +void primSprtSRest(unsigned char * baseAddr,unsigned short type) { unsigned long *gpuData = ((unsigned long *) baseAddr); short *sgpuData = ((short *) baseAddr); @@ -3312,7 +3241,7 @@ void primSprtSRest(u8 * baseAddr,unsigned short type) } } -void primSprtS(u8 * baseAddr) +void primSprtS(unsigned char * baseAddr) { unsigned long *gpuData = ((unsigned long *) baseAddr); short *sgpuData = ((short *) baseAddr); @@ -3451,7 +3380,7 @@ void primSprtS(u8 * baseAddr) // cmd: flat shaded Poly4 //////////////////////////////////////////////////////////////////////// -void primPolyF4(u8 *baseAddr) +void primPolyF4(unsigned char *baseAddr) { unsigned long *gpuData = ((unsigned long *) baseAddr); short *sgpuData = ((short *) baseAddr); @@ -3496,7 +3425,7 @@ void primPolyF4(u8 *baseAddr) // cmd: smooth shaded Poly4 //////////////////////////////////////////////////////////////////////// -void primPolyG4(u8 * baseAddr); +void primPolyG4(unsigned char * baseAddr); BOOL bDrawOffscreenFrontFF9G4(void) { @@ -3519,9 +3448,9 @@ BOOL bDrawOffscreenFrontFF9G4(void) return TRUE; } -BOOL bCheckFF9G4(u8 * baseAddr) +BOOL bCheckFF9G4(unsigned char * baseAddr) { - static u8 pFF9G4Cache[32]; + static unsigned char pFF9G4Cache[32]; static int iFF9Fix=0; if(baseAddr) @@ -3560,7 +3489,7 @@ BOOL bCheckFF9G4(u8 * baseAddr) //////////////////////////////////////////////////////////////////////// -void primPolyG4(u8 * baseAddr) +void primPolyG4(unsigned char * baseAddr) { unsigned long *gpuData = (unsigned long *)baseAddr; short *sgpuData = ((short *) baseAddr); @@ -3778,7 +3707,7 @@ BOOL DoLineCheck(unsigned long * gpuData) //////////////////////////////////////////////////////////////////////// -void primPolyFT3(u8 * baseAddr) +void primPolyFT3(unsigned char * baseAddr) { unsigned long *gpuData = ((unsigned long *) baseAddr); short *sgpuData = ((short *) baseAddr); @@ -4214,7 +4143,7 @@ void RectTexAlign(void) } -void primPolyFT4(u8 * baseAddr) +void primPolyFT4(unsigned char * baseAddr) { unsigned long *gpuData = ((unsigned long *) baseAddr); short *sgpuData = ((short *) baseAddr); @@ -4302,7 +4231,7 @@ void primPolyFT4(u8 * baseAddr) // cmd: smooth shaded Texture3 //////////////////////////////////////////////////////////////////////// -void primPolyGT3(u8 *baseAddr) +void primPolyGT3(unsigned char *baseAddr) { unsigned long *gpuData = ((unsigned long *) baseAddr); short *sgpuData = ((short *) baseAddr); @@ -4411,7 +4340,7 @@ void primPolyGT3(u8 *baseAddr) // cmd: smooth shaded Poly3 //////////////////////////////////////////////////////////////////////// -void primPolyG3(u8 *baseAddr) +void primPolyG3(unsigned char *baseAddr) { unsigned long *gpuData = ((unsigned long *) baseAddr); short *sgpuData = ((short *) baseAddr); @@ -4456,7 +4385,7 @@ void primPolyG3(u8 *baseAddr) // cmd: smooth shaded Texture4 //////////////////////////////////////////////////////////////////////// -void primPolyGT4(u8 *baseAddr) +void primPolyGT4(unsigned char *baseAddr) { unsigned long *gpuData = ((unsigned long *) baseAddr); short *sgpuData = ((short *) baseAddr); @@ -4576,7 +4505,7 @@ void primPolyGT4(u8 *baseAddr) // cmd: smooth shaded Poly3 //////////////////////////////////////////////////////////////////////// -void primPolyF3(u8 *baseAddr) +void primPolyF3(unsigned char *baseAddr) { unsigned long *gpuData = ((unsigned long *) baseAddr); short *sgpuData = ((short *) baseAddr); @@ -4620,7 +4549,7 @@ void primPolyF3(u8 *baseAddr) // cmd: skipping shaded polylines //////////////////////////////////////////////////////////////////////// -void primLineGSkip(u8 *baseAddr) +void primLineGSkip(unsigned char *baseAddr) { unsigned long *gpuData = ((unsigned long *) baseAddr); short *sgpuData = ((short *) baseAddr); @@ -4645,7 +4574,7 @@ void primLineGSkip(u8 *baseAddr) // cmd: shaded polylines //////////////////////////////////////////////////////////////////////// -void primLineGEx(u8 *baseAddr) +void primLineGEx(unsigned char *baseAddr) { unsigned long *gpuData = ((unsigned long *) baseAddr); int iMax=255; @@ -4709,7 +4638,7 @@ void primLineGEx(u8 *baseAddr) // cmd: shaded polyline2 //////////////////////////////////////////////////////////////////////// -void primLineG2(u8 *baseAddr) +void primLineG2(unsigned char *baseAddr) { unsigned long *gpuData = ((unsigned long *) baseAddr); short *sgpuData = ((short *) baseAddr); @@ -4754,7 +4683,7 @@ void primLineG2(u8 *baseAddr) // cmd: skipping flat polylines //////////////////////////////////////////////////////////////////////// -void primLineFSkip(u8 *baseAddr) +void primLineFSkip(unsigned char *baseAddr) { unsigned long *gpuData = ((unsigned long *) baseAddr); int i=2,iMax=255; @@ -4774,7 +4703,7 @@ void primLineFSkip(u8 *baseAddr) // cmd: drawing flat polylines //////////////////////////////////////////////////////////////////////// -void primLineFEx(u8 *baseAddr) +void primLineFEx(unsigned char *baseAddr) { unsigned long *gpuData = ((unsigned long *) baseAddr); int iMax; @@ -4832,7 +4761,7 @@ void primLineFEx(u8 *baseAddr) // cmd: drawing flat polyline2 //////////////////////////////////////////////////////////////////////// -void primLineF2(u8 *baseAddr) +void primLineF2(unsigned char *baseAddr) { unsigned long *gpuData = ((unsigned long *) baseAddr); short *sgpuData = ((short *) baseAddr); @@ -4873,7 +4802,7 @@ void primLineF2(u8 *baseAddr) // cmd: well, easiest command... not implemented //////////////////////////////////////////////////////////////////////// -void primNI(u8 *bA) +void primNI(unsigned char *bA) { } @@ -4881,7 +4810,7 @@ void primNI(u8 *bA) // cmd func ptr table //////////////////////////////////////////////////////////////////////// -void (*primTableJ[256])(u8 *) = +void (*primTableJ[256])(unsigned char *) = { // 00 primNI,primNI,primBlkFill,primNI,primNI,primNI,primNI,primNI, @@ -4953,7 +4882,7 @@ void (*primTableJ[256])(u8 *) = // cmd func ptr table for skipping //////////////////////////////////////////////////////////////////////// -void (*primTableSkip[256])(u8 *) = +void (*primTableSkip[256])(unsigned char *) = { // 00 primNI,primNI,primBlkFill,primNI,primNI,primNI,primNI,primNI,