From 628a25ef30f3584a3d3e58a203961c9e24850d66 Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Wed, 30 Nov 2022 22:43:55 +0100 Subject: [PATCH] The fix from #3233 on top of the v0.14 branch (#3241) --- CHANGELOG.md | 6 ++++++ Cargo.lock | 8 ++++---- wgpu-core/Cargo.toml | 2 +- wgpu-core/src/device/mod.rs | 5 ++++- wgpu/Cargo.toml | 4 ++-- 5 files changed, 17 insertions(+), 8 deletions(-) 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]