Fixed resource disposing after owning device

このコミットが含まれているのは:
Sergio Pedri committed 2021-07-18 14:21:57 +02:00
1 親 c7f7eac265
コミット df970a5e40
12ファイル変更
+190 -12

検索条件に一致するファイルはありません

+3
ファイルの表示
@@ -80,6 +80,7 @@ namespace ComputeSharp.Resources
this.allocation = device.Allocator->CreateResource(device.Pool, resourceType, allocationMode, (ulong)SizeInBytes);
this.d3D12Resource = new ComPtr<ID3D12Resource>(this.allocation.Get()->GetResource());
device.RegisterAllocatedResource();
device.RentShaderResourceViewDescriptorHandles(out D3D12CpuDescriptorHandle, out D3D12GpuDescriptorHandle);
switch (resourceType)
@@ -172,6 +173,8 @@ namespace ComputeSharp.Resources
this.d3D12Resource.Dispose();
this.allocation.Dispose();
GraphicsDevice.UnregisterAllocatedResource();
if (GraphicsDevice?.IsDisposed == false)
{
GraphicsDevice.ReturnShaderResourceViewDescriptorHandles(D3D12CpuDescriptorHandle, D3D12GpuDescriptorHandle);
+3
ファイルの表示
@@ -107,6 +107,7 @@ namespace ComputeSharp.Resources
out _,
out _);
device.RegisterAllocatedResource();
device.RentShaderResourceViewDescriptorHandles(out D3D12CpuDescriptorHandle, out D3D12GpuDescriptorHandle);
switch (resourceType)
@@ -436,6 +437,8 @@ namespace ComputeSharp.Resources
this.d3D12Resource.Dispose();
this.allocation.Dispose();
GraphicsDevice.UnregisterAllocatedResource();
if (GraphicsDevice?.IsDisposed == false)
{
GraphicsDevice.ReturnShaderResourceViewDescriptorHandles(D3D12CpuDescriptorHandle, D3D12GpuDescriptorHandle);
+3
ファイルの表示
@@ -111,6 +111,7 @@ namespace ComputeSharp.Resources
out _,
out _);
device.RegisterAllocatedResource();
device.RentShaderResourceViewDescriptorHandles(out D3D12CpuDescriptorHandle, out D3D12GpuDescriptorHandle);
switch (resourceType)
@@ -479,6 +480,8 @@ namespace ComputeSharp.Resources
this.d3D12Resource.Dispose();
this.allocation.Dispose();
GraphicsDevice.UnregisterAllocatedResource();
if (GraphicsDevice?.IsDisposed == false)
{
GraphicsDevice.ReturnShaderResourceViewDescriptorHandles(D3D12CpuDescriptorHandle, D3D12GpuDescriptorHandle);
+4
ファイルの表示
@@ -54,6 +54,8 @@ namespace ComputeSharp.Resources
this.allocation = device.Allocator->CreateResource(device.Pool, resourceType, allocationMode, sizeInBytes);
this.d3D12Resource = new ComPtr<ID3D12Resource>(this.allocation.Get()->GetResource());
device.RegisterAllocatedResource();
this.mappedData = (T*)this.d3D12Resource.Get()->Map().Pointer;
this.d3D12Resource.Get()->SetName(this);
@@ -109,6 +111,8 @@ namespace ComputeSharp.Resources
this.d3D12Resource.Dispose();
this.allocation.Dispose();
GraphicsDevice.UnregisterAllocatedResource();
return true;
}
+4
ファイルの表示
@@ -71,6 +71,8 @@ namespace ComputeSharp.Resources
this.allocation = device.Allocator->CreateResource(device.Pool, resourceType, allocationMode, totalSizeInBytes);
this.d3D12Resource = new ComPtr<ID3D12Resource>(this.allocation.Get()->GetResource());
device.RegisterAllocatedResource();
this.mappedData = (T*)this.d3D12Resource.Get()->Map().Pointer;
this.d3D12Resource.Get()->SetName(this);
@@ -119,6 +121,8 @@ namespace ComputeSharp.Resources
this.d3D12Resource.Dispose();
this.allocation.Dispose();
GraphicsDevice.UnregisterAllocatedResource();
return true;
}
+4
ファイルの表示
@@ -74,6 +74,8 @@ namespace ComputeSharp.Resources
this.allocation = device.Allocator->CreateResource(device.Pool, resourceType, allocationMode, totalSizeInBytes);
this.d3D12Resource = new ComPtr<ID3D12Resource>(this.allocation.Get()->GetResource());
device.RegisterAllocatedResource();
this.mappedData = (T*)this.d3D12Resource.Get()->Map().Pointer;
this.d3D12Resource.Get()->SetName(this);
@@ -126,6 +128,8 @@ namespace ComputeSharp.Resources
this.d3D12Resource.Dispose();
this.allocation.Dispose();
GraphicsDevice.UnregisterAllocatedResource();
return true;
}