From ae1c8f4f710d163fb7691162644ba5301dd48ffa Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Thu, 8 Aug 2019 18:19:48 -0700 Subject: Improved incorrect buffer parameters error reporting --- Graphics/GraphicsEngine/include/BufferBase.h | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'Graphics/GraphicsEngine') 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(BuffViewObjAllocator) ), m_pDefaultSRV(nullptr, STDDeleter(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; -- cgit v1.2.3