Pjb dev 3 (#48)

* Undo array allocation changes from #43

Doesn't work

* Expand dmeter heap sizes, give names

* Fix manual operator delete call in resource.cpp

* Disable map rendering for now

Aurora can't handle lines

* Re-enable assert heap on DVD thread

Should be fine?

* Some basic debug groups with the new Aurora API

* Allow Aurora backend to be set via CLI

* Give materials debug groups

* More debug groups

* JKRHeap separation: array edition

Pain
This commit is contained in:
Pieter-Jan Briers
2026-03-11 21:40:21 +01:00
committed by GitHub
parent 9e303b063f
commit 15732e241c
93 changed files with 440 additions and 313 deletions
@@ -25,7 +25,7 @@ void J3DDrawBuffer::initialize() {
}
int J3DDrawBuffer::allocBuffer(u32 size) {
mpBuffer = JKR_NEW_ARGS (0x20) J3DPacket*[size];
mpBuffer = JKR_NEW_ARRAY_ARGS(J3DPacket*, size, 0x20);
if (mpBuffer == NULL)
return kJ3DError_Alloc;
+19 -4
View File
@@ -12,8 +12,8 @@
J3DError J3DDisplayListObj::newDisplayList(u32 maxSize) {
mMaxSize = ALIGN_NEXT(maxSize, 0x20);
mpDisplayList[0] = JKR_NEW_ARGS (0x20) char[mMaxSize];
mpDisplayList[1] = JKR_NEW_ARGS (0x20) char[mMaxSize];
mpDisplayList[0] = JKR_NEW_ARRAY_ARGS(char, mMaxSize, 0x20);
mpDisplayList[1] = JKR_NEW_ARRAY_ARGS(char, mMaxSize, 0x20);
mSize = 0;
if (mpDisplayList[0] == NULL || mpDisplayList[1] == NULL)
@@ -24,7 +24,7 @@ J3DError J3DDisplayListObj::newDisplayList(u32 maxSize) {
J3DError J3DDisplayListObj::newSingleDisplayList(u32 maxSize) {
mMaxSize = ALIGN_NEXT(maxSize, 0x20);
mpDisplayList[0] = JKR_NEW_ARGS (0x20) char[mMaxSize];
mpDisplayList[0] = JKR_NEW_ARRAY_ARGS(char, mMaxSize, 0x20);
mpDisplayList[1] = mpDisplayList[0];
mSize = 0;
@@ -36,7 +36,7 @@ J3DError J3DDisplayListObj::newSingleDisplayList(u32 maxSize) {
int J3DDisplayListObj::single_To_Double() {
if (mpDisplayList[0] == mpDisplayList[1]) {
mpDisplayList[1] = JKR_NEW_ARGS (0x20) char[mMaxSize];
mpDisplayList[1] = JKR_NEW_ARRAY_ARGS(char, mMaxSize, 0x20);
if (mpDisplayList[1] == NULL)
return kJ3DError_Alloc;
@@ -211,6 +211,15 @@ void J3DMatPacket::draw() {
j3dSys.setTexture(mpTexture);
#endif
mpMaterial->load();
#if TARGET_PC
if (mpMaterial->mMaterialName != nullptr) {
char buf[64];
snprintf(buf, sizeof(buf), "Mat: %s", mpMaterial->mMaterialName);
GXPushDebugGroup(buf);
}
#endif
callDL();
J3DShapePacket* packet = getShapePacket();
@@ -229,6 +238,12 @@ void J3DMatPacket::draw() {
}
J3DShape::resetVcdVatCache();
#if TARGET_PC
if (mpMaterial->mMaterialName != nullptr) {
GXPopDebugGroup();
}
#endif
}
J3DShapePacket::J3DShapePacket() {
+1 -1
View File
@@ -87,7 +87,7 @@ void J3DShape::addTexMtxIndexInVcd(GXAttr attr) {
if (attrIdx == -1)
return;
GXVtxDescList* newVtxDesc = JKR_NEW GXVtxDescList[attrCount + 2];
GXVtxDescList* newVtxDesc = JKR_NEW_ARRAY(GXVtxDescList, attrCount + 2);
bool inserted = false;
vtxDesc = getVtxDesc();
@@ -28,7 +28,7 @@ void J3DShapeDraw::addTexMtxIndexInDL(u32 stride, u32 attrOffs, u32 valueBase) {
u32 byteNum = countVertex(stride);
u32 oldSize = mDisplayListSize;
u32 newSize = ALIGN_NEXT(oldSize + byteNum, 0x20);
u8* newDLStart = JKR_NEW_ARGS (0x20) u8[newSize];
u8* newDLStart = JKR_NEW_ARRAY_ARGS(u8, newSize, 0x20);
u8* oldDLStart = (u8*)mDisplayList;
u8* oldDL = oldDLStart;
u8* newDL = newDLStart;
+1 -1
View File
@@ -81,7 +81,7 @@ void J3DTexture::entryNum(u16 num) {
J3D_ASSERT_NONZEROARG(79, num != 0);
mNum = num;
mpRes = JKR_NEW ResTIMG[num];
mpRes = JKR_NEW_ARRAY(ResTIMG, num);
J3D_ASSERT_ALLOCMEM(83, mpRes != NULL);
delete[] mpTexObj;
+6 -6
View File
@@ -76,7 +76,7 @@ void J3DVertexBuffer::setArray() const {
s32 J3DVertexBuffer::copyLocalVtxPosArray(u32 flag) {
if (flag & 1) {
for (int i = 0; i < 2; i++) {
mVtxPosArray[i] = JKR_NEW_ARGS (0x20) char[mVtxData->getVtxNum() * 3 * 4];
mVtxPosArray[i] = JKR_NEW_ARRAY_ARGS(char, mVtxData->getVtxNum() * 3 * 4, 0x20);
if (mVtxPosArray[i] == NULL) {
return kJ3DError_Alloc;
}
@@ -88,7 +88,7 @@ s32 J3DVertexBuffer::copyLocalVtxPosArray(u32 flag) {
mVtxPosArray[0] = mVtxData->getVtxPosArray();
if (mVtxPosArray[1] == NULL) {
mVtxPosArray[1] = JKR_NEW_ARGS (0x20) char[mVtxData->getVtxNum() * 3 * 4];
mVtxPosArray[1] = JKR_NEW_ARRAY_ARGS(char, mVtxData->getVtxNum() * 3 * 4, 0x20);
if (mVtxPosArray[1] == NULL) {
return kJ3DError_Alloc;
}
@@ -104,7 +104,7 @@ s32 J3DVertexBuffer::copyLocalVtxPosArray(u32 flag) {
s32 J3DVertexBuffer::copyLocalVtxNrmArray(u32 flag) {
if (flag & 1) {
for (int i = 0; i < 2; i++) {
mVtxNrmArray[i] = JKR_NEW_ARGS (0x20) char[mVtxData->getNrmNum() * 3 * 4];
mVtxNrmArray[i] = JKR_NEW_ARRAY_ARGS(char, mVtxData->getNrmNum() * 3 * 4, 0x20);
if (mVtxNrmArray[i] == NULL) {
return kJ3DError_Alloc;
}
@@ -116,7 +116,7 @@ s32 J3DVertexBuffer::copyLocalVtxNrmArray(u32 flag) {
mVtxNrmArray[0] = mVtxData->getVtxNrmArray();
if (mVtxNrmArray[1] == NULL) {
mVtxNrmArray[1] = JKR_NEW_ARGS (0x20) char[mVtxData->getNrmNum() * 3 * 4];
mVtxNrmArray[1] = JKR_NEW_ARRAY_ARGS(char, mVtxData->getNrmNum() * 3 * 4, 0x20);
if (mVtxNrmArray[1] == NULL) {
return kJ3DError_Alloc;
}
@@ -186,7 +186,7 @@ s32 J3DVertexBuffer::allocTransformedVtxPosArray() {
for (int i = 0; i < 2; i++) {
if (i == 0 || mTransformedVtxPosArray[i] == NULL) {
mTransformedVtxPosArray[i] = JKR_NEW_ARGS (0x20) char[mVtxData->getVtxNum() * 3 * 4];
mTransformedVtxPosArray[i] = JKR_NEW_ARRAY_ARGS(char, mVtxData->getVtxNum() * 3 * 4, 0x20);
if (mTransformedVtxPosArray[i] == NULL)
return kJ3DError_Alloc;
}
@@ -201,7 +201,7 @@ s32 J3DVertexBuffer::allocTransformedVtxNrmArray() {
for (int i = 0; i < 2; i++) {
if (i == 0 || mTransformedVtxNrmArray[i] == NULL) {
mTransformedVtxNrmArray[i] = JKR_NEW_ARGS (0x20) char[mVtxData->getNrmNum() * 3 * 4];
mTransformedVtxNrmArray[i] = JKR_NEW_ARRAY_ARGS(char, mVtxData->getNrmNum() * 3 * 4, 0x20);
if (mTransformedVtxNrmArray[i] == NULL)
return kJ3DError_Alloc;
}