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

@@ -355,7 +355,11 @@ void GPUContextDX11::BindCB(int32 slot, GPUConstantBuffer* cb)
void GPUContextDX11::BindSR(int32 slot, GPUResourceView* view)
{
#if !BUILD_RELEASE
ASSERT(slot >= 0 && slot < GPU_MAX_SR_BINDED);
if (view && ((IShaderResourceDX11*)view->GetNativePtr())->SRV() == nullptr)
LogInvalidResourceUsage(slot, view, InvalidBindPoint::SRV);
#endif
auto handle = view ? ((IShaderResourceDX11*)view->GetNativePtr())->SRV() : nullptr;
if (_srHandles[slot] != handle)
{
@@ -369,7 +373,11 @@ void GPUContextDX11::BindSR(int32 slot, GPUResourceView* view)
void GPUContextDX11::BindUA(int32 slot, GPUResourceView* view)
{
#if !BUILD_RELEASE
ASSERT(slot >= 0 && slot < GPU_MAX_UA_BINDED);
if (view && ((IShaderResourceDX11*)view->GetNativePtr())->UAV() == nullptr)
LogInvalidResourceUsage(slot, view, InvalidBindPoint::UAV);
#endif
auto handle = view ? ((IShaderResourceDX11*)view->GetNativePtr())->UAV() : nullptr;
if (_uaHandles[slot] != handle)
{