diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index 6ae8ca5aef..9262741d7b 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -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 = "8059c03273bd7272688e3dac661e72c4973a2d0b" +rev = "44a41dc9a4eac8ddc37675f0d52486ded27bdbb3" features = ["raw-window-handle"] [dependencies.wgt] package = "wgpu-types" #version = "0.6" git = "https://github.com/gfx-rs/wgpu" -rev = "8059c03273bd7272688e3dac661e72c4973a2d0b" +rev = "44a41dc9a4eac8ddc37675f0d52486ded27bdbb3" [dependencies] arrayvec = "0.5" diff --git a/wgpu/src/backend/direct.rs b/wgpu/src/backend/direct.rs index 13ad529772..b73db414c1 100644 --- a/wgpu/src/backend/direct.rs +++ b/wgpu/src/backend/direct.rs @@ -88,14 +88,12 @@ mod pass_impl { ) } } - fn set_push_constants(&mut self, offset: u32, data: &[u32]) { + fn set_push_constants(&mut self, offset: u32, data: &[u8]) { unsafe { wgpu_compute_pass_set_push_constant( self, offset, - (data.len() * std::mem::size_of::()) - .try_into() - .unwrap(), + data.len().try_into().unwrap(), data.as_ptr(), ) } @@ -165,15 +163,13 @@ mod pass_impl { ) { wgpu_render_pass_set_vertex_buffer(self, slot, buffer.id, offset, size) } - fn set_push_constants(&mut self, stages: wgt::ShaderStage, offset: u32, data: &[u32]) { + fn set_push_constants(&mut self, stages: wgt::ShaderStage, offset: u32, data: &[u8]) { unsafe { wgpu_render_pass_set_push_constants( self, stages, offset, - (data.len() * std::mem::size_of::()) - .try_into() - .unwrap(), + data.len().try_into().unwrap(), data.as_ptr(), ) } @@ -362,15 +358,13 @@ mod pass_impl { wgpu_render_bundle_set_vertex_buffer(self, slot, buffer.id, offset, size) } - fn set_push_constants(&mut self, stages: wgt::ShaderStage, offset: u32, data: &[u32]) { + fn set_push_constants(&mut self, stages: wgt::ShaderStage, offset: u32, data: &[u8]) { unsafe { wgpu_render_bundle_set_push_constants( self, stages, offset, - (data.len() * std::mem::size_of::()) - .try_into() - .unwrap(), + data.len().try_into().unwrap(), data.as_ptr(), ) } @@ -1214,7 +1208,7 @@ impl crate::Context for Context { fn texture_drop(&self, texture: &Self::TextureId) { let global = &self.0; - wgc::gfx_select!(texture.id => global.texture_drop(texture.id)) + wgc::gfx_select!(texture.id => global.texture_drop(texture.id, false)) } fn texture_view_drop(&self, texture_view: &Self::TextureViewId) { let global = &self.0; diff --git a/wgpu/src/backend/web.rs b/wgpu/src/backend/web.rs index b051d0f424..c149c02cac 100644 --- a/wgpu/src/backend/web.rs +++ b/wgpu/src/backend/web.rs @@ -109,7 +109,7 @@ impl crate::ComputePassInner for ComputePass { offsets.len() as u32, ); } - fn set_push_constants(&mut self, _offset: u32, _data: &[u32]) { + fn set_push_constants(&mut self, _offset: u32, _data: &[u8]) { panic!("PUSH_CONSTANTS feature must be enabled to call multi_draw_indexed_indirect") } @@ -184,7 +184,7 @@ impl crate::RenderInner for RenderPass { self.0 .set_vertex_buffer_with_f64_and_f64(slot, &buffer.0, offset as f64, mapped_size); } - fn set_push_constants(&mut self, _stages: wgt::ShaderStage, _offset: u32, _data: &[u32]) { + fn set_push_constants(&mut self, _stages: wgt::ShaderStage, _offset: u32, _data: &[u8]) { panic!("PUSH_CONSTANTS feature must be enabled to call multi_draw_indexed_indirect") } fn draw(&mut self, vertices: Range, instances: Range) { diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 25ced1d2a9..63d2ae3458 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -55,7 +55,7 @@ trait ComputePassInner { bind_group: &Ctx::BindGroupId, offsets: &[DynamicOffset], ); - fn set_push_constants(&mut self, offset: u32, data: &[u32]); + fn set_push_constants(&mut self, offset: u32, data: &[u8]); fn insert_debug_marker(&mut self, label: &str); fn push_debug_group(&mut self, group_label: &str); fn pop_debug_group(&mut self); @@ -88,7 +88,7 @@ trait RenderInner { offset: BufferAddress, size: Option, ); - fn set_push_constants(&mut self, stages: wgt::ShaderStage, offset: u32, data: &[u32]); + fn set_push_constants(&mut self, stages: wgt::ShaderStage, offset: u32, data: &[u8]); fn draw(&mut self, vertices: Range, instances: Range); fn draw_indexed(&mut self, indices: Range, base_vertex: i32, instances: Range); fn draw_indirect(&mut self, indirect_buffer: &Ctx::BufferId, indirect_offset: BufferAddress); @@ -2316,7 +2316,7 @@ impl<'a> RenderPass<'a> { /// /// You would need to upload this in three set_push_constants calls. First for the `Vertex` only range 0..4, second /// for the `Vertex | Fragment` range 4..8, third for the `Fragment` range 8..12. - pub fn set_push_constants(&mut self, stages: wgt::ShaderStage, offset: u32, data: &[u32]) { + pub fn set_push_constants(&mut self, stages: wgt::ShaderStage, offset: u32, data: &[u8]) { self.id.set_push_constants(stages, offset, data); } } @@ -2392,7 +2392,7 @@ impl<'a> ComputePass<'a> { /// Data size must be a multiple of 4 and must be aligned to the 4s, so we take an array of u32. /// For example, with an offset of 4 and an array of `[u32; 3]`, that will write to the range /// of 4..16. - pub fn set_push_constants(&mut self, offset: u32, data: &[u32]) { + pub fn set_push_constants(&mut self, offset: u32, data: &[u8]) { self.id.set_push_constants(offset, data); } } @@ -2561,7 +2561,7 @@ impl<'a> RenderBundleEncoder<'a> { /// /// You would need to upload this in three set_push_constants calls. First for the `Vertex` only range 0..4, second /// for the `Vertex | Fragment` range 4..8, third for the `Fragment` range 8..12. - pub fn set_push_constants(&mut self, stages: wgt::ShaderStage, offset: u32, data: &[u32]) { + pub fn set_push_constants(&mut self, stages: wgt::ShaderStage, offset: u32, data: &[u8]) { self.id.set_push_constants(stages, offset, data); } }