add an ADC flag hack for instancing

This commit is contained in:
aap 2022-05-20 00:12:46 +02:00
parent 25e735048f
commit 8271c23a9e
1 changed files with 16 additions and 6 deletions

View File

@ -21,6 +21,8 @@
namespace rw { namespace rw {
namespace ps2 { namespace ps2 {
bool adcHack = false;
#define ALIGNPTR(p,a) ((uint8*)(((uintptr)(p)+a-1) & ~(uintptr)(a-1))) #define ALIGNPTR(p,a) ((uint8*)(((uintptr)(p)+a-1) & ~(uintptr)(a-1)))
static void* static void*
@ -706,13 +708,21 @@ MatPipeline::instance(Geometry *g, InstanceData *inst, Mesh *m)
for(uint i = 0; i < nelem(this->attribs); i++) for(uint i = 0; i < nelem(this->attribs); i++)
if((a = this->attribs[i]) && (a->attrib & AT_RW) == 0){ if((a = this->attribs[i]) && (a->attrib & AT_RW) == 0){
if(rw::version >= 0x35000) uint32 mask;
*p++ = VIF_NOP; if(adcHack && a == &attribXYZ){
else *p++ = VIF_STMASK;
*p++ = VIF_MARK | markcnt++; *p++ = 1 << 6; // write w field with VIF1_R3
*p++ = VIF_STMOD; mask = 0x10000000;
}else{
if(rw::version >= 0x35000)
*p++ = VIF_NOP;
else
*p++ = VIF_MARK | markcnt++;
*p++ = VIF_STMOD;
mask = 0x00000000;
}
*p++ = VIF_STCYCL1 | this->inputStride; *p++ = VIF_STCYCL1 | this->inputStride;
*p++ = (a->attrib&0xFF004000) *p++ = (a->attrib&0xFF004000) | mask
| 0x8000 | nverts << 16 | i; // UNPACK | 0x8000 | nverts << 16 | i; // UNPACK
if(a == &attribXYZ) if(a == &attribXYZ)