Skip to content

Conversation

@Bigfoot71
Copy link
Contributor

@Bigfoot71 Bigfoot71 commented Oct 28, 2025

TL;DR The PR was mainly aimed at fixing the axis-aligned quad detection function, but also contains the fix for DRM and a review for the alignments.


The issue for the axis-aligned quad detection was that it should have relied on transformed screen coordinates. This could even cause crashes in some cases, I spotted it while trying to transform text with rlRotatef

I also made it a bit more readable and documented.


I also fixed the DRM and swGetColorBuffer issue. The function wasn't actually needed even to get the internal buffer dimensions, swBlitFramebuffer should handle everything automatically, and it now does.


Regarding alignas the idea was to align both size and alignment (eg, 4-byte values aligned to 4). This allows, in theory for ARM, to use optimal load/store instructions instead of risking unaligned accesses that take extra cycles or require software emulation in worst case (old CPUs). On x86-64, it doesn't change much, but on ARM and RISC-V it should ensure predictable and optimal performance. Benchmarks are obviously needed to measure the real gain.

That said, the alignas on color was just one of my tests. I got confused with my branches and noticed it only after making my 'typo' fix. I figured, well let's leave it and I'll revisit it in the next PR. Sorry about that, but it reminded me that it's C11!


So, last PR ended up being a bit of a "mixed bag". From now on I'll try to make PRs more focused on specific issues.

Next on my list are handling cull face properly (culling is still happening even when disabled) and adding depth mask, since depth is currently always written.

I'm also working on a 3D example/mini game that runs quite well. It will help isolate real world issues, so expect more fixes coming from that.

@Bigfoot71
Copy link
Contributor Author

Oh, and I forgot, for the alignment question, I added definitions by architecture, not used for the moment, but could be useful if we want to make specific ARM/RISC-V optimizations later

@raysan5 raysan5 merged commit cbff0fa into raysan5:master Oct 28, 2025
16 checks passed
@raysan5
Copy link
Owner

raysan5 commented Oct 28, 2025

@Bigfoot71 thanks for the super-fast review! 👍😄

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.

2 participants