diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a988545a..a489ba7c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,12 @@ Bottom level categories: ## Unreleased +## wgpu-0.14.2 (2022-11-28) + +### Bug Fixes + +- Fix incorrect offset in `get_mapped_range` by @nical in [#3233](https://github.com/gfx-rs/wgpu/pull/3233) + ## wgpu-0.14.1 (2022-11-02) ### Bug Fixes diff --git a/Cargo.lock b/Cargo.lock index f0e528aab..326775f36 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2200,7 +2200,7 @@ dependencies = [ [[package]] name = "wgpu" -version = "0.14.0" +version = "0.14.2" dependencies = [ "arrayvec 0.7.2", "async-executor", @@ -2218,7 +2218,7 @@ dependencies = [ "nanorand", "noise", "obj", - "parking_lot 0.12.1", + "parking_lot 0.11.2", "png", "pollster", "raw-window-handle 0.5.0", @@ -2236,7 +2236,7 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "0.14.0" +version = "0.14.2" dependencies = [ "arrayvec 0.7.2", "bit-vec", @@ -2246,7 +2246,7 @@ dependencies = [ "fxhash", "log", "naga", - "parking_lot 0.12.1", + "parking_lot 0.11.2", "profiling", "raw-window-handle 0.5.0", "ron", diff --git a/wgpu-core/Cargo.toml b/wgpu-core/Cargo.toml index 73792f798..d84118053 100644 --- a/wgpu-core/Cargo.toml +++ b/wgpu-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wgpu-core" -version = "0.14.0" +version = "0.14.2" authors = ["wgpu developers"] edition = "2021" description = "WebGPU core logic on wgpu-hal" diff --git a/wgpu-core/src/device/mod.rs b/wgpu-core/src/device/mod.rs index a88d99cbc..20e7bf014 100644 --- a/wgpu-core/src/device/mod.rs +++ b/wgpu-core/src/device/mod.rs @@ -5654,7 +5654,10 @@ impl Global { max: range.end, }); } - unsafe { Ok((ptr.as_ptr().offset(offset as isize), range_size)) } + // ptr points to the beginning of the range we mapped in map_async + // rather thant the beginning of the buffer. + let relative_offset = (offset - range.start) as isize; + unsafe { Ok((ptr.as_ptr().offset(relative_offset), range_size)) } } resource::BufferMapState::Idle | resource::BufferMapState::Waiting(_) => { Err(BufferAccessError::NotMapped) diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index 50dc584f1..5e257a7ca 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wgpu" -version = "0.14.0" +version = "0.14.2" authors = ["wgpu developers"] edition = "2021" description = "Rusty WebGPU API wrapper" @@ -89,7 +89,7 @@ vulkan-portability = ["wgc/vulkan-portability"] [target.'cfg(not(target_arch = "wasm32"))'.dependencies.wgc] package = "wgpu-core" path = "../wgpu-core" -version = "0.14" +version = "0.14.2" features = ["raw-window-handle"] [target.'cfg(target_arch = "wasm32")'.dependencies.wgc]