mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 17:40:39 +00:00
Don't debug clear buffers, and NULL records. Refs #471
* Since we don't clear out stale descriptors that reference deleted objects, we have to make sure that ids and records for deleted objects are always valid (until they're allocated and filled with something sensible).
This commit is contained in:
@@ -236,10 +236,18 @@ public:
|
||||
// ID and if the resource isn't ever referenced elsewhere, it will just be
|
||||
// a non-live ID to be ignored.
|
||||
|
||||
if(IsDispatchableRes(GetWrapped(obj)))
|
||||
((WrappedVkDispRes *)GetWrapped(obj))->id = ResourceId();
|
||||
if(IsDispatchable(obj))
|
||||
{
|
||||
WrappedVkDispRes *res = (WrappedVkDispRes *)GetWrapped(obj);
|
||||
res->id = ResourceId();
|
||||
res->record = NULL;
|
||||
}
|
||||
else
|
||||
((WrappedVkNonDispRes *)GetWrapped(obj))->id = ResourceId();
|
||||
{
|
||||
WrappedVkNonDispRes *res = (WrappedVkNonDispRes *)GetWrapped(obj);
|
||||
res->id = ResourceId();
|
||||
res->record = NULL;
|
||||
}
|
||||
}
|
||||
delete GetWrapped(obj);
|
||||
}
|
||||
|
||||
@@ -329,7 +329,7 @@ struct WrappedVkBuffer : WrappedVkNonDispRes
|
||||
typedef VkBuffer InnerType;
|
||||
static const int AllocPoolCount = 128 * 1024;
|
||||
static const int AllocPoolMaxByteSize = 3 * 1024 * 1024;
|
||||
ALLOCATE_WITH_WRAPPED_POOL(WrappedVkBuffer, AllocPoolCount, AllocPoolMaxByteSize);
|
||||
ALLOCATE_WITH_WRAPPED_POOL(WrappedVkBuffer, AllocPoolCount, AllocPoolMaxByteSize, false);
|
||||
enum
|
||||
{
|
||||
TypeEnum = eResBuffer,
|
||||
@@ -578,6 +578,10 @@ struct UnwrapHelper
|
||||
struct UnwrapHelper<vulkantype> \
|
||||
{ \
|
||||
typedef WrappedVkDispRes ParentType; \
|
||||
enum \
|
||||
{ \
|
||||
DispatchableType = 1 \
|
||||
}; \
|
||||
typedef CONCAT(Wrapped, vulkantype) Outer; \
|
||||
static TypedRealHandle ToTypedHandle(vulkantype real) \
|
||||
{ \
|
||||
@@ -594,6 +598,10 @@ struct UnwrapHelper
|
||||
struct UnwrapHelper<vulkantype> \
|
||||
{ \
|
||||
typedef WrappedVkNonDispRes ParentType; \
|
||||
enum \
|
||||
{ \
|
||||
DispatchableType = 0 \
|
||||
}; \
|
||||
typedef CONCAT(Wrapped, vulkantype) Outer; \
|
||||
static TypedRealHandle ToTypedHandle(vulkantype real) \
|
||||
{ \
|
||||
@@ -682,6 +690,12 @@ void SetDispatchTableOverMagicNumber(VkDevice parent, RealType obj)
|
||||
wrapped->loaderTable = GetWrapped(parent)->loaderTable;
|
||||
}
|
||||
|
||||
template <typename RealType>
|
||||
bool IsDispatchable(RealType obj)
|
||||
{
|
||||
return (UnwrapHelper<RealType>::DispatchableType) == 1;
|
||||
}
|
||||
|
||||
template <typename RealType>
|
||||
WrappedVulkan *CoreDisp(RealType obj)
|
||||
{
|
||||
|
||||
@@ -866,15 +866,22 @@ void WrappedVulkan::vkUpdateDescriptorSets(VkDevice device, uint32_t writeCount,
|
||||
if(bind.texelBufferView != VK_NULL_HANDLE)
|
||||
{
|
||||
record->RemoveBindFrameRef(GetResID(bind.texelBufferView));
|
||||
if(GetRecord(bind.texelBufferView)->baseResource != ResourceId())
|
||||
record->RemoveBindFrameRef(GetRecord(bind.texelBufferView)->baseResource);
|
||||
|
||||
VkResourceRecord *viewRecord = GetRecord(bind.texelBufferView);
|
||||
if(viewRecord && viewRecord->baseResource != ResourceId())
|
||||
record->RemoveBindFrameRef(viewRecord->baseResource);
|
||||
}
|
||||
if(bind.imageInfo.imageView != VK_NULL_HANDLE)
|
||||
{
|
||||
record->RemoveBindFrameRef(GetResID(bind.imageInfo.imageView));
|
||||
record->RemoveBindFrameRef(GetRecord(bind.imageInfo.imageView)->baseResource);
|
||||
if(GetRecord(bind.imageInfo.imageView)->baseResourceMem != ResourceId())
|
||||
record->RemoveBindFrameRef(GetRecord(bind.imageInfo.imageView)->baseResourceMem);
|
||||
|
||||
VkResourceRecord *viewRecord = GetRecord(bind.imageInfo.imageView);
|
||||
if(viewRecord)
|
||||
{
|
||||
record->RemoveBindFrameRef(viewRecord->baseResource);
|
||||
if(viewRecord->baseResourceMem != ResourceId())
|
||||
record->RemoveBindFrameRef(viewRecord->baseResourceMem);
|
||||
}
|
||||
}
|
||||
if(bind.imageInfo.sampler != VK_NULL_HANDLE)
|
||||
{
|
||||
@@ -883,8 +890,10 @@ void WrappedVulkan::vkUpdateDescriptorSets(VkDevice device, uint32_t writeCount,
|
||||
if(bind.bufferInfo.buffer != VK_NULL_HANDLE)
|
||||
{
|
||||
record->RemoveBindFrameRef(GetResID(bind.bufferInfo.buffer));
|
||||
if(GetRecord(bind.bufferInfo.buffer)->baseResource != ResourceId())
|
||||
record->RemoveBindFrameRef(GetRecord(bind.bufferInfo.buffer)->baseResource);
|
||||
|
||||
VkResourceRecord *bufRecord = GetRecord(bind.bufferInfo.buffer);
|
||||
if(bufRecord && bufRecord->baseResource != ResourceId())
|
||||
record->RemoveBindFrameRef(bufRecord->baseResource);
|
||||
}
|
||||
|
||||
// NULL everything out now so that we don't accidentally reference an object
|
||||
|
||||
Reference in New Issue
Block a user