mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
[rs] Merge #589
589: Update to latest wgpu with Naga validation r=cwfitzgerald a=kvark Depends on https://github.com/gfx-rs/wgpu/pull/962 Includes latest Naga validation stuff. ~~Warning: subject to https://github.com/gfx-rs/naga/issues/228~~ Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
This commit is contained in:
@@ -26,14 +26,14 @@ vulkan-portability = ["wgc/gfx-backend-vulkan", "gfx-backend-vulkan"]
|
||||
package = "wgpu-core"
|
||||
#version = "0.6"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "43adcbcf683bf1f581b89dabf653827337478c9a"
|
||||
rev = "8059c03273bd7272688e3dac661e72c4973a2d0b"
|
||||
features = ["raw-window-handle"]
|
||||
|
||||
[dependencies.wgt]
|
||||
package = "wgpu-types"
|
||||
#version = "0.6"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "43adcbcf683bf1f581b89dabf653827337478c9a"
|
||||
rev = "8059c03273bd7272688e3dac661e72c4973a2d0b"
|
||||
|
||||
[dependencies]
|
||||
arrayvec = "0.5"
|
||||
|
||||
@@ -1536,10 +1536,10 @@ where
|
||||
match device_error {
|
||||
wgc::device::DeviceError::OutOfMemory => {
|
||||
error_sink.handle_error(crate::Error::OutOfMemoryError {
|
||||
source: Box::new(err)
|
||||
source: Box::new(err),
|
||||
});
|
||||
return fallback();
|
||||
},
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ impl Context {
|
||||
// Emulate buffer mapping with the old API. This is a temporary
|
||||
// polyfill until the new buffer mapping API is available on gecko.
|
||||
let mut mapped_desc =
|
||||
web_sys::GpuBufferDescriptor::new(desc.size as f64, desc.usage.bits());
|
||||
web_sys::GpuBufferDescriptor::new(desc.size as f64, desc.usage.bits());
|
||||
if let Some(label) = desc.label {
|
||||
mapped_desc.label(label);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,11 @@ impl DeviceExt for crate::Device {
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
let buffer = crate::Buffer {
|
||||
context: Arc::clone(&self.context),
|
||||
id: crate::backend::Context::create_buffer_init_polyfill(&self.id, &wgt_descriptor, descriptor.contents),
|
||||
id: crate::backend::Context::create_buffer_init_polyfill(
|
||||
&self.id,
|
||||
&wgt_descriptor,
|
||||
descriptor.contents,
|
||||
),
|
||||
map_context: parking_lot::Mutex::new(map_context),
|
||||
usage: descriptor.usage,
|
||||
};
|
||||
@@ -90,14 +94,17 @@ impl DeviceExt for crate::Device {
|
||||
map_context: parking_lot::Mutex::new(map_context),
|
||||
usage: descriptor.usage,
|
||||
};
|
||||
|
||||
let range =
|
||||
crate::Context::buffer_get_mapped_range_mut(&*self.context, &buffer.id, 0..padded_size);
|
||||
|
||||
let range = crate::Context::buffer_get_mapped_range_mut(
|
||||
&*self.context,
|
||||
&buffer.id,
|
||||
0..padded_size,
|
||||
);
|
||||
range[0..unpadded_size as usize].copy_from_slice(descriptor.contents);
|
||||
for i in unpadded_size..padded_size {
|
||||
range[i as usize] = 0;
|
||||
}
|
||||
|
||||
|
||||
buffer.unmap();
|
||||
buffer
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user