Add warnings on incorrect GPUBuffer or GPUTexture usage when binding to GPUContext (in non-release builds)

This commit is contained in:
Wojtek Figat
2025-01-30 22:03:21 +01:00
parent 44fae3838e
commit 04dde7a3f2
18 changed files with 121 additions and 31 deletions

View File

@@ -1001,7 +1001,11 @@ void GPUContextVulkan::BindCB(int32 slot, GPUConstantBuffer* cb)
void GPUContextVulkan::BindSR(int32 slot, GPUResourceView* view)
{
#if !BUILD_RELEASE
ASSERT(slot >= 0 && slot < GPU_MAX_SR_BINDED);
if (view && ((DescriptorOwnerResourceVulkan*)view->GetNativePtr())->HasSRV() == false)
LogInvalidResourceUsage(slot, view, InvalidBindPoint::SRV);
#endif
const auto handle = view ? (DescriptorOwnerResourceVulkan*)view->GetNativePtr() : nullptr;
if (_srHandles[slot] != handle)
{
@@ -1013,7 +1017,11 @@ void GPUContextVulkan::BindSR(int32 slot, GPUResourceView* view)
void GPUContextVulkan::BindUA(int32 slot, GPUResourceView* view)
{
#if !BUILD_RELEASE
ASSERT(slot >= 0 && slot < GPU_MAX_UA_BINDED);
if (view && ((DescriptorOwnerResourceVulkan*)view->GetNativePtr())->HasUAV() == false)
LogInvalidResourceUsage(slot, view, InvalidBindPoint::UAV);
#endif
const auto handle = view ? (DescriptorOwnerResourceVulkan*)view->GetNativePtr() : nullptr;
if (_uaHandles[slot] != handle)
{