mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-29 09:34:09 +01:00
Properly honor mapped_at_creation in Device::create_buffer
The returned `Buffer` should immediately be mappable. Fixes #351
This commit is contained in:
1 parent
d06470ea1e
commit
42de0b2769
1 file changed
+5
-1
+5
-1
@@ -1108,10 +1108,14 @@ impl Device {
|
||||
|
||||
/// Creates a new buffer.
|
||||
pub fn create_buffer(&self, desc: &BufferDescriptor) -> Buffer {
|
||||
let mut map_context = MapContext::new(desc.size);
|
||||
if desc.mapped_at_creation {
|
||||
map_context.initial_range = 0..desc.size;
|
||||
}
|
||||
Buffer {
|
||||
context: Arc::clone(&self.context),
|
||||
id: Context::device_create_buffer(&*self.context, &self.id, desc),
|
||||
map_context: Mutex::new(MapContext::new(desc.size)),
|
||||
map_context: Mutex::new(map_context),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user