simplify TA parsing

This commit is contained in:
Flyinghead 2022-04-13 20:36:52 +02:00
parent a710674cd4
commit a9e261d280
6 changed files with 18 additions and 30 deletions

View File

@ -14,8 +14,7 @@ void ta_vtx_SoftReset();
void DYNACALL ta_vtx_data32(const SQBuffer *data); void DYNACALL ta_vtx_data32(const SQBuffer *data);
void ta_vtx_data(const SQBuffer *data, u32 size); void ta_vtx_data(const SQBuffer *data, u32 size);
bool ta_parse_vdrc(TA_context *ctx); bool ta_parse(TA_context *ctx);
bool ta_parse_naomi2(TA_context* ctx);
class TaTypeLut class TaTypeLut
{ {

View File

@ -1275,7 +1275,7 @@ static void fix_texture_bleeding(const List<PolyParam> *list)
} }
} }
bool ta_parse_vdrc(TA_context* ctx) static bool ta_parse_vdrc(TA_context* ctx)
{ {
ctx->rend_inuse.lock(); ctx->rend_inuse.lock();
bool rv=false; bool rv=false;
@ -1377,7 +1377,7 @@ bool ta_parse_vdrc(TA_context* ctx)
return rv && !overrun; return rv && !overrun;
} }
bool ta_parse_naomi2(TA_context* ctx) static bool ta_parse_naomi2(TA_context* ctx)
{ {
ctx->rend_inuse.lock(); ctx->rend_inuse.lock();
@ -1440,6 +1440,14 @@ bool ta_parse_naomi2(TA_context* ctx)
return !overrun; return !overrun;
} }
bool ta_parse(TA_context *ctx)
{
if (settings.platform.isNaomi2())
return ta_parse_naomi2(ctx);
else
return ta_parse_vdrc(ctx);
}
static PolyParam *n2CurrentPP; static PolyParam *n2CurrentPP;
static ModifierVolumeParam *n2CurrentMVP; static ModifierVolumeParam *n2CurrentMVP;

View File

@ -310,19 +310,12 @@ bool DX11Renderer::Process(TA_context* ctx)
if (ctx->rend.isRenderFramebuffer) if (ctx->rend.isRenderFramebuffer)
{ {
readDCFramebuffer(); readDCFramebuffer();
return true;
} }
else else
{ {
bool success; return ta_parse(ctx);
if (settings.platform.isNaomi2())
success = ta_parse_naomi2(ctx);
else
success = ta_parse_vdrc(ctx);
if (!success)
return false;
} }
return true;
} }
// //

View File

@ -286,14 +286,12 @@ bool D3DRenderer::Process(TA_context* ctx)
if (ctx->rend.isRenderFramebuffer) if (ctx->rend.isRenderFramebuffer)
{ {
readDCFramebuffer(); readDCFramebuffer();
return true;
} }
else else
{ {
if (!ta_parse_vdrc(ctx)) return ta_parse(ctx);
return false;
} }
return true;
} }
inline void D3DRenderer::setTexMode(D3DSAMPLERSTATETYPE state, u32 clamp, u32 mirror) inline void D3DRenderer::setTexMode(D3DSAMPLERSTATETYPE state, u32 clamp, u32 mirror)

View File

@ -1123,6 +1123,7 @@ bool OpenGLRenderer::Process(TA_context* ctx)
if (ctx->rend.isRenderFramebuffer) if (ctx->rend.isRenderFramebuffer)
{ {
RenderFramebuffer(); RenderFramebuffer();
return true;
} }
else else
{ {
@ -1136,17 +1137,8 @@ bool OpenGLRenderer::Process(TA_context* ctx)
UpdatePaletteTexture(getPaletteTextureSlot()); UpdatePaletteTexture(getPaletteTextureSlot());
palette_updated = false; palette_updated = false;
} }
return ta_parse(ctx);
bool success;
if (settings.platform.isNaomi2())
success = ta_parse_naomi2(ctx);
else
success = ta_parse_vdrc(ctx);
if (!success)
return false;
} }
return true;
} }
static void upload_vertex_indices() static void upload_vertex_indices()

View File

@ -140,10 +140,8 @@ public:
bool result; bool result;
if (ctx->rend.isRenderFramebuffer) if (ctx->rend.isRenderFramebuffer)
result = RenderFramebuffer(ctx); result = RenderFramebuffer(ctx);
else if (settings.platform.isNaomi2())
result = ta_parse_naomi2(ctx);
else else
result = ta_parse_vdrc(ctx); result = ta_parse(ctx);
if (result) if (result)
{ {