mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-26 00:33:51 +00:00
use .error_ident()
for resource_log!
in Drop impls
This commit is contained in:
parent
5f78485f30
commit
c4e067b394
@ -483,7 +483,7 @@ impl<A: HalApi> Drop for BindGroupLayout<A> {
|
|||||||
self.device.bgl_pool.remove(&self.entries);
|
self.device.bgl_pool.remove(&self.entries);
|
||||||
}
|
}
|
||||||
if let Some(raw) = self.raw.take() {
|
if let Some(raw) = self.raw.take() {
|
||||||
resource_log!("Destroy raw BindGroupLayout {:?}", self.info.label());
|
resource_log!("Destroy raw {}", self.error_ident());
|
||||||
unsafe {
|
unsafe {
|
||||||
use hal::Device;
|
use hal::Device;
|
||||||
self.device.raw().destroy_bind_group_layout(raw);
|
self.device.raw().destroy_bind_group_layout(raw);
|
||||||
@ -625,8 +625,7 @@ pub struct PipelineLayout<A: HalApi> {
|
|||||||
impl<A: HalApi> Drop for PipelineLayout<A> {
|
impl<A: HalApi> Drop for PipelineLayout<A> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if let Some(raw) = self.raw.take() {
|
if let Some(raw) = self.raw.take() {
|
||||||
resource_log!("Destroy raw PipelineLayout {:?}", self.info.label());
|
resource_log!("Destroy raw {}", self.error_ident());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
use hal::Device;
|
use hal::Device;
|
||||||
self.device.raw().destroy_pipeline_layout(raw);
|
self.device.raw().destroy_pipeline_layout(raw);
|
||||||
@ -861,8 +860,7 @@ pub struct BindGroup<A: HalApi> {
|
|||||||
impl<A: HalApi> Drop for BindGroup<A> {
|
impl<A: HalApi> Drop for BindGroup<A> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if let Some(raw) = self.raw.take() {
|
if let Some(raw) = self.raw.take() {
|
||||||
resource_log!("Destroy raw BindGroup {:?}", self.info.label());
|
resource_log!("Destroy raw {}", self.error_ident());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
use hal::Device;
|
use hal::Device;
|
||||||
self.device.raw().destroy_bind_group(raw);
|
self.device.raw().destroy_bind_group(raw);
|
||||||
|
@ -876,7 +876,7 @@ pub struct RenderBundle<A: HalApi> {
|
|||||||
|
|
||||||
impl<A: HalApi> Drop for RenderBundle<A> {
|
impl<A: HalApi> Drop for RenderBundle<A> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
resource_log!("Destroy raw RenderBundle {:?}", self.info.label());
|
resource_log!("Drop {}", self.error_ident());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,10 +320,10 @@ pub struct CommandBuffer<A: HalApi> {
|
|||||||
|
|
||||||
impl<A: HalApi> Drop for CommandBuffer<A> {
|
impl<A: HalApi> Drop for CommandBuffer<A> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
|
resource_log!("Drop {}", self.error_ident());
|
||||||
if self.data.lock().is_none() {
|
if self.data.lock().is_none() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
resource_log!("resource::CommandBuffer::drop {:?}", self.info.label());
|
|
||||||
let mut baked = self.extract_baked_commands();
|
let mut baked = self.extract_baked_commands();
|
||||||
unsafe {
|
unsafe {
|
||||||
baked.encoder.reset_all(baked.list.into_iter());
|
baked.encoder.reset_all(baked.list.into_iter());
|
||||||
|
@ -64,6 +64,7 @@ impl<A: HalApi> ParentDevice<A> for Queue<A> {
|
|||||||
|
|
||||||
impl<A: HalApi> Drop for Queue<A> {
|
impl<A: HalApi> Drop for Queue<A> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
|
resource_log!("Drop {}", self.error_ident());
|
||||||
let queue = self.raw.take().unwrap();
|
let queue = self.raw.take().unwrap();
|
||||||
self.device.as_ref().unwrap().release_queue(queue);
|
self.device.as_ref().unwrap().release_queue(queue);
|
||||||
}
|
}
|
||||||
|
@ -161,6 +161,7 @@ impl<A: HalApi> std::fmt::Debug for Device<A> {
|
|||||||
|
|
||||||
impl<A: HalApi> Drop for Device<A> {
|
impl<A: HalApi> Drop for Device<A> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
|
resource_log!("Drop {}", self.error_ident());
|
||||||
let raw = self.raw.take().unwrap();
|
let raw = self.raw.take().unwrap();
|
||||||
let pending_writes = self.pending_writes.lock().take().unwrap();
|
let pending_writes = self.pending_writes.lock().take().unwrap();
|
||||||
pending_writes.dispose(&raw);
|
pending_writes.dispose(&raw);
|
||||||
@ -169,7 +170,6 @@ impl<A: HalApi> Drop for Device<A> {
|
|||||||
raw.destroy_buffer(self.zero_buffer.take().unwrap());
|
raw.destroy_buffer(self.zero_buffer.take().unwrap());
|
||||||
raw.destroy_fence(self.fence.write().take().unwrap());
|
raw.destroy_fence(self.fence.write().take().unwrap());
|
||||||
let queue = self.queue_to_drop.take().unwrap();
|
let queue = self.queue_to_drop.take().unwrap();
|
||||||
resource_log!("Destroy raw Device {:?} and its Queue", self.info.label());
|
|
||||||
raw.exit(queue);
|
raw.exit(queue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,8 +56,7 @@ pub struct ShaderModule<A: HalApi> {
|
|||||||
impl<A: HalApi> Drop for ShaderModule<A> {
|
impl<A: HalApi> Drop for ShaderModule<A> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if let Some(raw) = self.raw.take() {
|
if let Some(raw) = self.raw.take() {
|
||||||
resource_log!("Destroy raw ShaderModule {:?}", self.info.label());
|
resource_log!("Destroy raw {}", self.error_ident());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
use hal::Device;
|
use hal::Device;
|
||||||
self.device.raw().destroy_shader_module(raw);
|
self.device.raw().destroy_shader_module(raw);
|
||||||
@ -225,8 +224,7 @@ pub struct ComputePipeline<A: HalApi> {
|
|||||||
impl<A: HalApi> Drop for ComputePipeline<A> {
|
impl<A: HalApi> Drop for ComputePipeline<A> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if let Some(raw) = self.raw.take() {
|
if let Some(raw) = self.raw.take() {
|
||||||
resource_log!("Destroy raw ComputePipeline {:?}", self.info.label());
|
resource_log!("Destroy raw {}", self.error_ident());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
use hal::Device;
|
use hal::Device;
|
||||||
self.device.raw().destroy_compute_pipeline(raw);
|
self.device.raw().destroy_compute_pipeline(raw);
|
||||||
@ -294,8 +292,7 @@ pub struct PipelineCache<A: HalApi> {
|
|||||||
impl<A: HalApi> Drop for PipelineCache<A> {
|
impl<A: HalApi> Drop for PipelineCache<A> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if let Some(raw) = self.raw.take() {
|
if let Some(raw) = self.raw.take() {
|
||||||
resource_log!("Destroy raw PipelineCache {:?}", self.info.label());
|
resource_log!("Destroy raw {}", self.error_ident());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
use hal::Device;
|
use hal::Device;
|
||||||
self.device.raw().destroy_pipeline_cache(raw);
|
self.device.raw().destroy_pipeline_cache(raw);
|
||||||
@ -554,8 +551,7 @@ pub struct RenderPipeline<A: HalApi> {
|
|||||||
impl<A: HalApi> Drop for RenderPipeline<A> {
|
impl<A: HalApi> Drop for RenderPipeline<A> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if let Some(raw) = self.raw.take() {
|
if let Some(raw) = self.raw.take() {
|
||||||
resource_log!("Destroy raw RenderPipeline {:?}", self.info.label());
|
resource_log!("Destroy raw {}", self.error_ident());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
use hal::Device;
|
use hal::Device;
|
||||||
self.device.raw().destroy_render_pipeline(raw);
|
self.device.raw().destroy_render_pipeline(raw);
|
||||||
|
@ -472,8 +472,7 @@ pub struct Buffer<A: HalApi> {
|
|||||||
impl<A: HalApi> Drop for Buffer<A> {
|
impl<A: HalApi> Drop for Buffer<A> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if let Some(raw) = self.raw.take() {
|
if let Some(raw) = self.raw.take() {
|
||||||
resource_log!("Destroy raw Buffer (dropped) {:?}", self.info.label());
|
resource_log!("Destroy raw {}", self.error_ident());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
use hal::Device;
|
use hal::Device;
|
||||||
self.device.raw().destroy_buffer(raw);
|
self.device.raw().destroy_buffer(raw);
|
||||||
@ -893,7 +892,7 @@ pub struct StagingBuffer<A: HalApi> {
|
|||||||
impl<A: HalApi> Drop for StagingBuffer<A> {
|
impl<A: HalApi> Drop for StagingBuffer<A> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if let Some(raw) = self.raw.lock().take() {
|
if let Some(raw) = self.raw.lock().take() {
|
||||||
resource_log!("Destroy raw StagingBuffer {:?}", self.info.label());
|
resource_log!("Destroy raw {}", self.error_ident());
|
||||||
unsafe {
|
unsafe {
|
||||||
use hal::Device;
|
use hal::Device;
|
||||||
self.device.raw().destroy_buffer(raw);
|
self.device.raw().destroy_buffer(raw);
|
||||||
@ -997,7 +996,6 @@ impl<A: HalApi> Texture<A> {
|
|||||||
|
|
||||||
impl<A: HalApi> Drop for Texture<A> {
|
impl<A: HalApi> Drop for Texture<A> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
resource_log!("Destroy raw Texture {:?}", self.info.label());
|
|
||||||
use hal::Device;
|
use hal::Device;
|
||||||
let mut clear_mode = self.clear_mode.write();
|
let mut clear_mode = self.clear_mode.write();
|
||||||
let clear_mode = &mut *clear_mode;
|
let clear_mode = &mut *clear_mode;
|
||||||
@ -1027,6 +1025,7 @@ impl<A: HalApi> Drop for Texture<A> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if let Some(TextureInner::Native { raw }) = self.inner.take() {
|
if let Some(TextureInner::Native { raw }) = self.inner.take() {
|
||||||
|
resource_log!("Destroy raw {}", self.error_ident());
|
||||||
unsafe {
|
unsafe {
|
||||||
self.device.raw().destroy_texture(raw);
|
self.device.raw().destroy_texture(raw);
|
||||||
}
|
}
|
||||||
@ -1542,8 +1541,7 @@ pub struct TextureView<A: HalApi> {
|
|||||||
impl<A: HalApi> Drop for TextureView<A> {
|
impl<A: HalApi> Drop for TextureView<A> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if let Some(raw) = self.raw.take() {
|
if let Some(raw) = self.raw.take() {
|
||||||
resource_log!("Destroy raw TextureView {:?}", self.info.label());
|
resource_log!("Destroy raw {}", self.error_ident());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
use hal::Device;
|
use hal::Device;
|
||||||
self.device.raw().destroy_texture_view(raw);
|
self.device.raw().destroy_texture_view(raw);
|
||||||
@ -1682,8 +1680,8 @@ pub struct Sampler<A: HalApi> {
|
|||||||
|
|
||||||
impl<A: HalApi> Drop for Sampler<A> {
|
impl<A: HalApi> Drop for Sampler<A> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
resource_log!("Destroy raw Sampler {:?}", self.info.label());
|
|
||||||
if let Some(raw) = self.raw.take() {
|
if let Some(raw) = self.raw.take() {
|
||||||
|
resource_log!("Destroy raw {}", self.error_ident());
|
||||||
unsafe {
|
unsafe {
|
||||||
use hal::Device;
|
use hal::Device;
|
||||||
self.device.raw().destroy_sampler(raw);
|
self.device.raw().destroy_sampler(raw);
|
||||||
@ -1787,8 +1785,8 @@ pub struct QuerySet<A: HalApi> {
|
|||||||
|
|
||||||
impl<A: HalApi> Drop for QuerySet<A> {
|
impl<A: HalApi> Drop for QuerySet<A> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
resource_log!("Destroy raw QuerySet {:?}", self.info.label());
|
|
||||||
if let Some(raw) = self.raw.take() {
|
if let Some(raw) = self.raw.take() {
|
||||||
|
resource_log!("Destroy raw {}", self.error_ident());
|
||||||
unsafe {
|
unsafe {
|
||||||
use hal::Device;
|
use hal::Device;
|
||||||
self.device.raw().destroy_query_set(raw);
|
self.device.raw().destroy_query_set(raw);
|
||||||
|
Loading…
Reference in New Issue
Block a user