Skip to content

Conversation

@mateusfavarin
Copy link
Collaborator

No description provided.


#include <ctr/math.h>
#include <psn00bsdk/include/inline_c.h>
#include <ctr/nugget/inline_n.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you more sure that this doesn't have bugs in it like psn00bsdk? If it does have bugs, will we have to manually vet gte instructions ourselves?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one doesn't, yea

TEST_COLL_ProjectPointToEdge(v1, v2, point, out);
/* This is a hand written assembly function that breaks the ABI,
and some callers expect the argument registers to be untouched */
__asm__ volatile("move $a0, %0" : : "r"((u32)out));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you ever fully solve this problem? Was it ultimately because of psn00bsdk?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, t1 being trashed during the gte registers was causing this bug

__asm__ volatile("move $k1, %0" : : "r"(addr));

u32 index = 0;
u32 index = UINT32_MAX;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to match our integral types paradigm, should this be named U32_MAX instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a stdint macro, i guess i could define our macros to match yea

Copy link
Contributor

@TheUbMunster TheUbMunster Sep 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, if that's the case then maybe this isn't a big deal to just keep them. Up to you.

TEST_FUNC(COLL_TestLeaf_Quadblock),
};

const char* s_nameTestedFunc = nullptr;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good improvement.

u8 lodShift;
} CollDCache;

#define DCACHE_COLL (*(CollDCache*) 0x1f800108)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there no memory overlap behavior for the scratchpad within a namespace (i.e., we had unions in the OG scratchpad because several namespaces used it), but I thought even within a single namespace (e.g., coll), that there was still memory usage overlap.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't seen any overlap yet

@mateusfavarin mateusfavarin merged commit f77dc43 into main Sep 28, 2025
1 check passed
@mateusfavarin mateusfavarin deleted the coll_fixes branch September 28, 2025 03:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants