mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 09:08:22 -05:00
Fixed some false positive clang analysis warnings.
This commit is contained in:
parent
237ee5b9e5
commit
41fae47351
2 changed files with 33 additions and 19 deletions
43
src/bgfx.cpp
43
src/bgfx.cpp
|
@ -578,6 +578,10 @@ namespace bgfx
|
|||
fragMem[ii] = makeRef(mem[ii].data, uint32_t(mem[ii].size) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BGFX_FATAL(false, Fatal::UnableToInitialize, "Unknown renderer type %d", g_caps.rendererType);
|
||||
}
|
||||
|
||||
for (uint32_t ii = 0, num = g_caps.maxFBAttachments; ii < num; ++ii)
|
||||
{
|
||||
|
@ -1419,6 +1423,25 @@ again:
|
|||
|
||||
bool end = false;
|
||||
|
||||
if (NULL == m_renderCtx)
|
||||
{
|
||||
uint8_t command;
|
||||
_cmdbuf.read(command);
|
||||
|
||||
BX_CHECK(CommandBuffer::RendererInit == command
|
||||
, "RendererInit must be the first command in command buffer before initialization."
|
||||
);
|
||||
BX_CHECK(!m_rendererInitialized, "This shouldn't happen! Bad synchronization?");
|
||||
|
||||
RendererType::Enum type;
|
||||
_cmdbuf.read(type);
|
||||
|
||||
m_renderCtx = rendererCreate(type);
|
||||
m_rendererInitialized = true;
|
||||
}
|
||||
|
||||
BX_CHECK(NULL != m_renderCtx, "Should not be NULL at this point.");
|
||||
|
||||
do
|
||||
{
|
||||
uint8_t command;
|
||||
|
@ -1426,18 +1449,6 @@ again:
|
|||
|
||||
switch (command)
|
||||
{
|
||||
case CommandBuffer::RendererInit:
|
||||
{
|
||||
BX_CHECK(!m_rendererInitialized, "This shouldn't happen! Bad synchronization?");
|
||||
|
||||
RendererType::Enum type;
|
||||
_cmdbuf.read(type);
|
||||
|
||||
m_renderCtx = rendererCreate(type);
|
||||
m_rendererInitialized = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case CommandBuffer::RendererShutdownBegin:
|
||||
{
|
||||
BX_CHECK(m_rendererInitialized, "This shouldn't happen! Bad synchronization?");
|
||||
|
@ -1452,6 +1463,10 @@ again:
|
|||
m_renderCtx = NULL;
|
||||
m_exit = true;
|
||||
}
|
||||
// fallthrough
|
||||
|
||||
case CommandBuffer::End:
|
||||
end = true;
|
||||
break;
|
||||
|
||||
case CommandBuffer::CreateIndexBuffer:
|
||||
|
@ -1834,10 +1849,6 @@ again:
|
|||
}
|
||||
break;
|
||||
|
||||
case CommandBuffer::End:
|
||||
end = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
BX_CHECK(false, "Invalid command: %d", command);
|
||||
break;
|
||||
|
|
|
@ -6,11 +6,13 @@
|
|||
#ifndef BGFX_P_H_HEADER_GUARD
|
||||
#define BGFX_P_H_HEADER_GUARD
|
||||
|
||||
#include <bx/platform.h>
|
||||
|
||||
#ifndef BGFX_CONFIG_DEBUG
|
||||
# define BGFX_CONFIG_DEBUG 0
|
||||
#endif // BGFX_CONFIG_DEBUG
|
||||
|
||||
#if BGFX_CONFIG_DEBUG || defined(__clang_analyzer__)
|
||||
#if BGFX_CONFIG_DEBUG || BX_COMPILER_CLANG_ANALYZER
|
||||
# define BX_TRACE _BX_TRACE
|
||||
# define BX_WARN _BX_WARN
|
||||
# define BX_CHECK _BX_CHECK
|
||||
|
@ -29,11 +31,11 @@
|
|||
|
||||
namespace bgfx
|
||||
{
|
||||
#if defined(__clang_analyzer__)
|
||||
#if BX_COMPILER_CLANG_ANALYZER
|
||||
void __attribute__((analyzer_noreturn)) fatal(Fatal::Enum _code, const char* _format, ...);
|
||||
#else
|
||||
void fatal(Fatal::Enum _code, const char* _format, ...);
|
||||
#endif // defined(__clang_analyzer__)
|
||||
#endif // BX_COMPILER_CLANG_ANALYZER
|
||||
|
||||
void dbgPrintf(const char* _format, ...);
|
||||
}
|
||||
|
@ -1766,6 +1768,7 @@ namespace bgfx
|
|||
, m_instBufferCount(0)
|
||||
, m_frames(0)
|
||||
, m_debug(BGFX_DEBUG_NONE)
|
||||
, m_renderCtx(NULL)
|
||||
, m_rendererInitialized(false)
|
||||
, m_exit(false)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue