Skip to content

Commit

Permalink
add an ADC flag hack for instancing
Browse files Browse the repository at this point in the history
  • Loading branch information
aap committed May 19, 2022
1 parent 25e7350 commit 8271c23
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/ps2/ps2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
namespace rw {
namespace ps2 {

bool adcHack = false;

#define ALIGNPTR(p,a) ((uint8*)(((uintptr)(p)+a-1) & ~(uintptr)(a-1)))

static void*
Expand Down Expand Up @@ -706,13 +708,21 @@ MatPipeline::instance(Geometry *g, InstanceData *inst, Mesh *m)

for(uint i = 0; i < nelem(this->attribs); i++)
if((a = this->attribs[i]) && (a->attrib & AT_RW) == 0){
if(rw::version >= 0x35000)
*p++ = VIF_NOP;
else
*p++ = VIF_MARK | markcnt++;
*p++ = VIF_STMOD;
uint32 mask;
if(adcHack && a == &attribXYZ){
*p++ = VIF_STMASK;
*p++ = 1 << 6; // write w field with VIF1_R3
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++ = (a->attrib&0xFF004000)
*p++ = (a->attrib&0xFF004000) | mask
| 0x8000 | nverts << 16 | i; // UNPACK

if(a == &attribXYZ)
Expand Down

0 comments on commit 8271c23

Please sign in to comment.