Add an iterator over XFB rows#25
Merged
ProfElements merged 3 commits intorust-wii:mainfrom Dec 15, 2024
Merged
Conversation
acbc539 to
2ba40c5
Compare
ProfElements
requested changes
Dec 22, 2023
Collaborator
ProfElements
left a comment
There was a problem hiding this comment.
Besides one small issue it all looks awesome!
Now that the `exposed_provenance` and `strict_provenance` features have been stabilized, we can migrate to its definitive functions. This change is undefined behaviour though, but `as *mut u32` was similarly UB, so we just trade one UB for another… `core::ptr`’s documentation says: > Situations where a valid pointer must be created from just an address, > such as baremetal code accessing a memory-mapped interface at a fixed > address, are an open question on how to support. These situations will > still be allowed, but we might require some kind of “I know what I’m > doing” annotation to explain the situation to the compiler. It’s also > possible they need no special attention at all, because they’re > generally accessing memory outside the scope of “the abstract machine”, > or already using “I know what I’m doing” annotations like “volatile”.
luma_core/src/vi.rs
Outdated
| impl<'a> Iterator for XfbIterMut<'a> { | ||
| type Item = &'a mut [u16]; | ||
|
|
||
| fn next(&mut self) -> Option<&'a mut [u16]> { |
Collaborator
There was a problem hiding this comment.
would self.xfb.data.chunks_mut(self.xfb.stride_in_u16()).next() work here?
Collaborator
Author
There was a problem hiding this comment.
I’ve ended up replacing the whole XfbIterMut struct with ChunksMut, which already does the exact same and more.
Collaborator
|
I think there is a better way to implement |
This emits slices of u16, and allows users to not use unsafe for drawing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This emits slices of
u16, and allows users to not use unsafe for drawing.This is based on #21, since it wouldn’t build on current nightly otherwise.