rust3ds / ctru-rs

Rust wrapper for libctru
https://rust3ds.github.io/ctru-rs/
Other
117 stars 17 forks source link

Add LINEAR allocator module #81

Closed Meziu closed 1 year ago

Meziu commented 1 year ago

LINEAR memory is one of the fundamental features of the 3DS architecture when using GPU and DSP (audio) processes. While we could make all allocations ourselves inside of the wrappers for such services, we would be taking away from the user the capability of this RAM sector, as well as slowing down the whole process (we'd have to copy each "asset" from normal heap to linear before being able to actually use it).

I don't like having to add yet another unstable feature, but it's the best way to have instant support for all std structs, like native Boxes on the LINEAR memory.

This PR will become extremely useful in the writing of citro3d-rs and the ndsp wrapper module that I'm already working on.

Edit: For example, it would simplify (and make safe) this call: https://github.com/rust3ds/citro3d-rs/blob/6ba85149d84aa3bcc879ec16ef79079dc411643f/citro3d/examples/triangle.rs#L140