-
Notifications
You must be signed in to change notification settings - Fork 1.2k
refactor(gles): extract Buffer::{raw,data} into new enum BufferBacking
#8453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
refactor(gles): extract Buffer::{raw,data} into new enum BufferBacking
#8453
Conversation
e9f273f to
96fb99a
Compare
| let buffer = match &bar.buffer.backing { | ||
| &BufferBacking::Gl { raw } | &BufferBacking::GlCachedOnHost { raw, .. } => raw, | ||
| BufferBacking::Host { .. } => unreachable!(), | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| let buffer = match &bar.buffer.backing { | |
| &BufferBacking::Gl { raw } | &BufferBacking::GlCachedOnHost { raw, .. } => raw, | |
| BufferBacking::Host { .. } => unreachable!(), | |
| }; | |
| let buffer = match bar.buffer.backing { | |
| BufferBacking::Gl { raw } | &BufferBacking::GlCachedOnHost { raw, .. } => raw, | |
| BufferBacking::Host { .. } => unreachable!(), | |
| }; |
This feels like a weird reference-dereference? If it needs a ref, could we use ref raw
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also in general I don't like taking references in match expressions, preferring to explictly using ref/ref mut. This is a slightly less conservative version of the clippy lint against match ergonomics.
| /// Storage backing a [`Buffer`]'s operations, possibly implemented with a host-side vector of | ||
| /// bytes. | ||
| /// | ||
| /// The [`Self::OnlyRaw`] variant is preferred, when supported. However, various workarounds for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of date docs
| /// The [`Self::OnlyRaw`] variant is preferred, when supported. However, various workarounds for | |
| /// The [`Self::Gl`] variant is preferred, when supported. However, various workarounds for |
| // #[derive(Clone, Debug)] | ||
| // enum MapState { | ||
| // Mapped { | ||
| // offset: Arc<MaybeMutex<wgt::BufferAddress>>, | ||
| // }, | ||
| // Unmapped, | ||
| // } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented code.
No description provided.