This commit is contained in:
Shinovon 2026-05-03 07:30:29 +05:00
parent d2fbcccd01
commit e938d48607
2 changed files with 4 additions and 37 deletions

View file

@ -26,50 +26,15 @@ void
drawInst_simple(InstanceDataHeader *header, InstanceData *inst)
{
draw++;
flushCache();
glDrawElements(header->primType, inst->numIndex,
GL_UNSIGNED_SHORT, ((uint8*) header->indexBuffer) + inst->offset);
}
// Emulate PS2 GS alpha test FB_ONLY case: failed alpha writes to frame- but not to depth buffer
void
drawInst_GSemu(InstanceDataHeader *header, InstanceData *inst)
{
uint32 hasAlpha;
int alphafunc, alpharef, gsalpharef;
int zwrite;
hasAlpha = getAlphaBlend();
if(hasAlpha){
zwrite = rw::GetRenderState(rw::ZWRITEENABLE);
alphafunc = rw::GetRenderState(rw::ALPHATESTFUNC);
if(zwrite){
alpharef = rw::GetRenderState(rw::ALPHATESTREF);
gsalpharef = rw::GetRenderState(rw::GSALPHATESTREF);
SetRenderState(rw::ALPHATESTFUNC, rw::ALPHAGREATEREQUAL);
SetRenderState(rw::ALPHATESTREF, gsalpharef);
drawInst_simple(header, inst);
SetRenderState(rw::ALPHATESTFUNC, rw::ALPHALESS);
SetRenderState(rw::ZWRITEENABLE, 0);
drawInst_simple(header, inst);
SetRenderState(rw::ZWRITEENABLE, 1);
SetRenderState(rw::ALPHATESTFUNC, alphafunc);
SetRenderState(rw::ALPHATESTREF, alpharef);
}else{
SetRenderState(rw::ALPHATESTFUNC, rw::ALPHAALWAYS);
drawInst_simple(header, inst);
SetRenderState(rw::ALPHATESTFUNC, alphafunc);
}
}else
drawInst_simple(header, inst);
}
void
drawInst(InstanceDataHeader *header, InstanceData *inst)
{
// if(rw::GetRenderState(rw::GSALPHATEST))
// drawInst_GSemu(header, inst);
// else
drawInst_simple(header, inst);
drawInst_simple(header, inst);
}