mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
Record that the buffer is mapped when its size is zero. (#2877)
* Record that the buffer is mapped when its size is zero. * Avoid internally trying to map a zero-sized buffer if mapped_at_creation is true. * Add an entry in the changelog.
This commit is contained in:
parent
8cff4a03e5
commit
9a8229af7b
@ -50,6 +50,7 @@ Bottom level categories:
|
|||||||
- Fix bind group / pipeline deduplication not taking into account RenderBundle execution resetting these values by @shoebe [#2867](https://github.com/gfx-rs/wgpu/pull/2867)
|
- Fix bind group / pipeline deduplication not taking into account RenderBundle execution resetting these values by @shoebe [#2867](https://github.com/gfx-rs/wgpu/pull/2867)
|
||||||
- Fix panics that occur when using `as_hal` functions when the hal generic type does not match the hub being looked up in by @i509VCB [#2871](https://github.com/gfx-rs/wgpu/pull/2871)
|
- Fix panics that occur when using `as_hal` functions when the hal generic type does not match the hub being looked up in by @i509VCB [#2871](https://github.com/gfx-rs/wgpu/pull/2871)
|
||||||
- Add some validation in map_async by @nical in [#2876](https://github.com/gfx-rs/wgpu/pull/2876)
|
- Add some validation in map_async by @nical in [#2876](https://github.com/gfx-rs/wgpu/pull/2876)
|
||||||
|
- Fix bugs when mapping/unmapping zero-sized buffers and ranges by @nical in [#2877](https://github.com/gfx-rs/wgpu/pull/2877)
|
||||||
|
|
||||||
#### DX12
|
#### DX12
|
||||||
- `DownlevelCapabilities::default()` now returns the `ANISOTROPIC_FILTERING` flag set to true so DX12 lists `ANISOTROPIC_FILTERING` as true again by @cwfitzgerald in [#2851](https://github.com/gfx-rs/wgpu/pull/2851)
|
- `DownlevelCapabilities::default()` now returns the `ANISOTROPIC_FILTERING` flag set to true so DX12 lists `ANISOTROPIC_FILTERING` as true again by @cwfitzgerald in [#2851](https://github.com/gfx-rs/wgpu/pull/2851)
|
||||||
|
@ -896,6 +896,11 @@ impl<A: HalApi> LifetimeTracker<A> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
buffer.map_state = resource::BufferMapState::Active {
|
||||||
|
ptr: std::ptr::NonNull::dangling(),
|
||||||
|
range: mapping.range,
|
||||||
|
host: mapping.op.host,
|
||||||
|
};
|
||||||
resource::BufferMapAsyncStatus::Success
|
resource::BufferMapAsyncStatus::Success
|
||||||
};
|
};
|
||||||
pending_callbacks.push((mapping.op, status));
|
pending_callbacks.push((mapping.op, status));
|
||||||
|
@ -3247,15 +3247,20 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
} else if desc.usage.contains(wgt::BufferUsages::MAP_WRITE) {
|
} else if desc.usage.contains(wgt::BufferUsages::MAP_WRITE) {
|
||||||
// buffer is mappable, so we are just doing that at start
|
// buffer is mappable, so we are just doing that at start
|
||||||
let map_size = buffer.size;
|
let map_size = buffer.size;
|
||||||
let ptr = match map_buffer(&device.raw, &mut buffer, 0, map_size, HostMap::Write) {
|
let ptr = if map_size == 0 {
|
||||||
|
std::ptr::NonNull::dangling()
|
||||||
|
} else {
|
||||||
|
match map_buffer(&device.raw, &mut buffer, 0, map_size, HostMap::Write) {
|
||||||
Ok(ptr) => ptr,
|
Ok(ptr) => ptr,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
let raw = buffer.raw.unwrap();
|
let raw = buffer.raw.unwrap();
|
||||||
device
|
device.lock_life(&mut token).schedule_resource_destruction(
|
||||||
.lock_life(&mut token)
|
queue::TempResource::Buffer(raw),
|
||||||
.schedule_resource_destruction(queue::TempResource::Buffer(raw), !0);
|
!0,
|
||||||
|
);
|
||||||
break e.into();
|
break e.into();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
buffer.map_state = resource::BufferMapState::Active {
|
buffer.map_state = resource::BufferMapState::Active {
|
||||||
ptr,
|
ptr,
|
||||||
|
Loading…
Reference in New Issue
Block a user