Created
August 13, 2022 21:29
-
-
Save valbaca/c57a2117f7dafca67d6078c34addf417 to your computer and use it in GitHub Desktop.
This file contains 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
diff --git a/src/main.rs b/src/main.rs | |
index 61a0589..9cf361e 100644 | |
--- a/src/main.rs | |
+++ b/src/main.rs | |
@@ -40,12 +40,8 @@ impl<'a> Buffer<'a> { | |
pub fn from_data<T: Copy>(device: &'a Device, _data: &[T]) -> Self { | |
let mut staging_buffer = Buffer::new(device); | |
- { | |
- let staging_buffer_memory = staging_buffer.memory_mut(); | |
- staging_buffer_memory.map(); | |
- staging_buffer_memory.unmap(); | |
- } | |
- | |
+ staging_buffer.map_unmap(); | |
+ | |
let buffer = Self::new(device); | |
staging_buffer.copy_to_buffer(&buffer); | |
@@ -60,6 +56,11 @@ impl<'a> Buffer<'a> { | |
&mut self.memory | |
} | |
+ pub fn map_unmap(&mut self) { | |
+ self.memory.map(); | |
+ self.memory.unmap(); | |
+ } | |
+ | |
fn copy_to_buffer(&self, _dst_buffer: &Buffer) { | |
// | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment