Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[d3d12] Drop resource before free suballocation #5943

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions wgpu-hal/src/dx12/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,9 @@ impl crate::Device for super::Device {
unsafe fn destroy_buffer(&self, mut buffer: super::Buffer) {
// Only happens when it's using the windows_rs feature and there's an allocation
if let Some(alloc) = buffer.allocation.take() {
// Resource should be dropped before free suballocation
drop(buffer);

super::suballocation::free_buffer_allocation(
self,
alloc,
Expand Down Expand Up @@ -494,6 +497,9 @@ impl crate::Device for super::Device {

unsafe fn destroy_texture(&self, mut texture: super::Texture) {
if let Some(alloc) = texture.allocation.take() {
// Resource should be dropped before free suballocation
drop(texture);

super::suballocation::free_texture_allocation(
self,
alloc,
Expand Down
Loading