diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2019-08-09 01:19:48 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2019-08-09 01:19:48 +0000 |
| commit | ae1c8f4f710d163fb7691162644ba5301dd48ffa (patch) | |
| tree | 1cd1898031960ef1e9c4f3a2e6eb828855acbe5d /Graphics/GraphicsEngine | |
| parent | Fixed out-of-memory issue when resizing D3D11 swap chain (diff) | |
| download | DiligentCore-ae1c8f4f710d163fb7691162644ba5301dd48ffa.tar.gz DiligentCore-ae1c8f4f710d163fb7691162644ba5301dd48ffa.zip | |
Improved incorrect buffer parameters error reporting
Diffstat (limited to 'Graphics/GraphicsEngine')
| -rw-r--r-- | Graphics/GraphicsEngine/include/BufferBase.h | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/Graphics/GraphicsEngine/include/BufferBase.h b/Graphics/GraphicsEngine/include/BufferBase.h index b39b452b..b3c4434a 100644 --- a/Graphics/GraphicsEngine/include/BufferBase.h +++ b/Graphics/GraphicsEngine/include/BufferBase.h @@ -73,13 +73,8 @@ public: m_pDefaultUAV(nullptr, STDDeleter<BufferViewImplType, TBuffViewObjAllocator>(BuffViewObjAllocator) ), m_pDefaultSRV(nullptr, STDDeleter<BufferViewImplType, TBuffViewObjAllocator>(BuffViewObjAllocator) ) { -#ifdef DEVELOPMENT -# define VERIFY_BUFFER(Expr, ...) if (!(Expr)) LOG_ERROR("Buffer '", this->m_Desc.Name ? this->m_Desc.Name : "", "': ", ##__VA_ARGS__) -#else -# define VERIFY_BUFFER(...)do{}while(false) -#endif +# define VERIFY_BUFFER(Expr, ...) if (!(Expr)) LOG_ERROR_AND_THROW("Buffer '", this->m_Desc.Name ? this->m_Desc.Name : "", "': ", ##__VA_ARGS__) -#ifdef DEVELOPMENT Uint32 AllowedBindFlags = BIND_VERTEX_BUFFER | BIND_INDEX_BUFFER | BIND_UNIFORM_BUFFER | BIND_SHADER_RESOURCE | BIND_STREAM_OUTPUT | BIND_UNORDERED_ACCESS | @@ -90,15 +85,14 @@ public: "BIND_INDIRECT_DRAW_ARGS (256)"; VERIFY_BUFFER( (BuffDesc.BindFlags & ~AllowedBindFlags) == 0, "Incorrect bind flags specified (", BuffDesc.BindFlags & ~AllowedBindFlags, "). Only the following flags are allowed:\n", strAllowedBindFlags ); -#endif if( (this->m_Desc.BindFlags & BIND_UNORDERED_ACCESS) || (this->m_Desc.BindFlags & BIND_SHADER_RESOURCE) ) { - VERIFY_BUFFER( this->m_Desc.Mode > BUFFER_MODE_UNDEFINED && this->m_Desc.Mode < BUFFER_MODE_NUM_MODES, "Buffer mode (", this->m_Desc.Mode, ") is not correct" ); + VERIFY_BUFFER( this->m_Desc.Mode > BUFFER_MODE_UNDEFINED && this->m_Desc.Mode < BUFFER_MODE_NUM_MODES, GetBufferModeString(this->m_Desc.Mode), " is not a valid mode for a buffer created with BIND_SHADER_RESOURCE or BIND_UNORDERED_ACCESS flags" ); if (this->m_Desc.Mode == BUFFER_MODE_STRUCTURED || this->m_Desc.Mode == BUFFER_MODE_FORMATTED) { - VERIFY_BUFFER( this->m_Desc.ElementByteStride != 0, "Element stride cannot be zero for structured and formatted buffers" ); + VERIFY_BUFFER( this->m_Desc.ElementByteStride != 0, "Element stride must not be zero for structured and formatted buffers" ); } else if (this->m_Desc.Mode == BUFFER_MODE_RAW) { @@ -106,6 +100,8 @@ public: } } +# undef VERIFY_BUFFER + Uint64 DeviceQueuesMask = pDevice->GetCommandQueueMask(); DEV_CHECK_ERR( (this->m_Desc.CommandQueueMask & DeviceQueuesMask) != 0, "No bits in the command queue mask (0x", std::hex, this->m_Desc.CommandQueueMask, ") correspond to one of ", pDevice->GetCommandQueueCount(), " available device command queues"); this->m_Desc.CommandQueueMask &= DeviceQueuesMask; |
