mirror of
https://github.com/OpenDriver2/REDRIVER2.git
synced 2024-11-22 10:22:48 +01:00
- [Psy-X] reduce draw calls with subsequent DrawPrim calls
- [Psy-X] store DrawPrim state in split
This commit is contained in:
parent
9d97cefb90
commit
d50eb36a37
@ -763,8 +763,7 @@ void ControlCopDetection(void)
|
|||||||
int dx, dz;
|
int dx, dz;
|
||||||
CAR_DATA *cp;
|
CAR_DATA *cp;
|
||||||
VECTOR vec;
|
VECTOR vec;
|
||||||
int ccx;
|
int ccx, ccz;
|
||||||
int ccz;
|
|
||||||
|
|
||||||
vec.vx = player[0].pos[0];
|
vec.vx = player[0].pos[0];
|
||||||
vec.vy = player[0].pos[1];
|
vec.vy = player[0].pos[1];
|
||||||
|
@ -123,6 +123,7 @@ void FadeGameScreen(int flag)
|
|||||||
DrawPrim(&poly);
|
DrawPrim(&poly);
|
||||||
|
|
||||||
#ifndef PSX
|
#ifndef PSX
|
||||||
|
DrawSync(0);
|
||||||
PsyX_EndScene();
|
PsyX_EndScene();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -344,6 +345,8 @@ void CloseShutters(int speed, int width, int height)
|
|||||||
DrawPrim(&poly[0]);
|
DrawPrim(&poly[0]);
|
||||||
DrawPrim(&poly[1]);
|
DrawPrim(&poly[1]);
|
||||||
|
|
||||||
|
DrawSync(0); // [A] added to avoid rendering bugs
|
||||||
|
|
||||||
#ifndef PSX
|
#ifndef PSX
|
||||||
VSync(0);
|
VSync(0);
|
||||||
PsyX_EndScene();
|
PsyX_EndScene();
|
||||||
|
@ -31,6 +31,7 @@ OT_TAG prim_terminator = { -1, 0 }; // P_TAG with zero length
|
|||||||
DISPENV activeDispEnv;
|
DISPENV activeDispEnv;
|
||||||
DRAWENV activeDrawEnv;
|
DRAWENV activeDrawEnv;
|
||||||
int g_GPUDisabledState = 0;
|
int g_GPUDisabledState = 0;
|
||||||
|
int g_DrawPrimMode = 0;
|
||||||
|
|
||||||
struct GPUDrawSplit
|
struct GPUDrawSplit
|
||||||
{
|
{
|
||||||
@ -42,6 +43,8 @@ struct GPUDrawSplit
|
|||||||
TexFormat texFormat;
|
TexFormat texFormat;
|
||||||
TextureID textureId;
|
TextureID textureId;
|
||||||
|
|
||||||
|
int drawPrimMode;
|
||||||
|
|
||||||
u_short startVertex;
|
u_short startVertex;
|
||||||
u_short numVerts;
|
u_short numVerts;
|
||||||
};
|
};
|
||||||
@ -675,6 +678,7 @@ void AddSplit(bool semiTrans, TextureID textureId)
|
|||||||
if (curSplit.blendMode == blendMode &&
|
if (curSplit.blendMode == blendMode &&
|
||||||
curSplit.texFormat == texFormat &&
|
curSplit.texFormat == texFormat &&
|
||||||
curSplit.textureId == textureId &&
|
curSplit.textureId == textureId &&
|
||||||
|
curSplit.drawPrimMode == g_DrawPrimMode &&
|
||||||
curSplit.drawenv.clip.x == activeDrawEnv.clip.x &&
|
curSplit.drawenv.clip.x == activeDrawEnv.clip.x &&
|
||||||
curSplit.drawenv.clip.y == activeDrawEnv.clip.y &&
|
curSplit.drawenv.clip.y == activeDrawEnv.clip.y &&
|
||||||
curSplit.drawenv.clip.w == activeDrawEnv.clip.w &&
|
curSplit.drawenv.clip.w == activeDrawEnv.clip.w &&
|
||||||
@ -691,6 +695,7 @@ void AddSplit(bool semiTrans, TextureID textureId)
|
|||||||
split.blendMode = blendMode;
|
split.blendMode = blendMode;
|
||||||
split.texFormat = texFormat;
|
split.texFormat = texFormat;
|
||||||
split.textureId = textureId;
|
split.textureId = textureId;
|
||||||
|
split.drawPrimMode = g_DrawPrimMode;
|
||||||
split.drawenv = activeDrawEnv;
|
split.drawenv = activeDrawEnv;
|
||||||
split.dispenv = activeDispEnv;
|
split.dispenv = activeDispEnv;
|
||||||
|
|
||||||
@ -700,6 +705,8 @@ void AddSplit(bool semiTrans, TextureID textureId)
|
|||||||
|
|
||||||
void DrawSplit(const GPUDrawSplit& split)
|
void DrawSplit(const GPUDrawSplit& split)
|
||||||
{
|
{
|
||||||
|
GR_SetStencilMode(split.drawPrimMode); // draw with mask 0x16
|
||||||
|
|
||||||
GR_SetTexture(split.textureId, split.texFormat);
|
GR_SetTexture(split.textureId, split.texFormat);
|
||||||
|
|
||||||
GR_SetupClipMode(&split.drawenv.clip, split.drawenv.dfe);
|
GR_SetupClipMode(&split.drawenv.clip, split.drawenv.dfe);
|
||||||
@ -764,6 +771,9 @@ void ParsePrimitivesToSplits(u_long* p, int singlePrimitive)
|
|||||||
if (!p)
|
if (!p)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// setup single primitive flag (needed for AddSplits)
|
||||||
|
g_DrawPrimMode = singlePrimitive;
|
||||||
|
|
||||||
if (singlePrimitive)
|
if (singlePrimitive)
|
||||||
{
|
{
|
||||||
#if defined(USE_PGXP) && defined(USE_EXTENDED_PRIM_POINTERS)
|
#if defined(USE_PGXP) && defined(USE_EXTENDED_PRIM_POINTERS)
|
||||||
|
@ -43,10 +43,10 @@ int DrawSync(int mode)
|
|||||||
GR_UpdateVRAM();
|
GR_UpdateVRAM();
|
||||||
GR_ReadFramebufferDataToVRAM();
|
GR_ReadFramebufferDataToVRAM();
|
||||||
|
|
||||||
if (g_splitIndex > 0) // don't do flips if nothing to draw.
|
if (g_splitIndex > 0)// && g_GPUDisabledState == 0) // don't do flips if nothing to draw.
|
||||||
{
|
{
|
||||||
DrawAllSplits();
|
DrawAllSplits();
|
||||||
PsyX_EndScene();
|
//PsyX_EndScene();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drawsync_callback != NULL)
|
if (drawsync_callback != NULL)
|
||||||
@ -418,10 +418,7 @@ void DrawOTag(u_long* p)
|
|||||||
|
|
||||||
ParsePrimitivesToSplits(p, 0);
|
ParsePrimitivesToSplits(p, 0);
|
||||||
|
|
||||||
GR_SetStencilMode(0);
|
|
||||||
DrawAllSplits();
|
DrawAllSplits();
|
||||||
|
|
||||||
|
|
||||||
} while (g_emulatorPaused);
|
} while (g_emulatorPaused);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -449,10 +446,6 @@ void DrawPrim(void* p)
|
|||||||
ClearImage(&activeDrawEnv.clip, activeDrawEnv.r0, activeDrawEnv.g0, activeDrawEnv.b0);
|
ClearImage(&activeDrawEnv.clip, activeDrawEnv.r0, activeDrawEnv.g0, activeDrawEnv.b0);
|
||||||
|
|
||||||
ParsePrimitivesToSplits((u_long*)p, 1);
|
ParsePrimitivesToSplits((u_long*)p, 1);
|
||||||
|
|
||||||
// draw with mask 0x16
|
|
||||||
GR_SetStencilMode(1);
|
|
||||||
DrawAllSplits();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetSprt16(SPRT_16* p)
|
void SetSprt16(SPRT_16* p)
|
||||||
|
Loading…
Reference in New Issue
Block a user