RRenamed BX_CHECK to BX_ASSERT.

This commit is contained in:
Бранимир Караџић
2020-06-16 10:06:18 -07:00
parent ee78de075c
commit 2cbcb6ea90
42 changed files with 364 additions and 364 deletions

View File

@@ -153,9 +153,9 @@ bgfx::TextureHandle loadTextureWithUpdate(const char* _filePath, uint64_t _flags
if (NULL != imageContainer)
{
BX_CHECK(!imageContainer->m_cubeMap, "Cubemap Texture loading not supported");
BX_CHECK(1 >= imageContainer->m_depth, "3D Texture loading not supported");
BX_CHECK(1 == imageContainer->m_numLayers, "Texture Layer loading not supported");
BX_ASSERT(!imageContainer->m_cubeMap, "Cubemap Texture loading not supported");
BX_ASSERT(1 >= imageContainer->m_depth, "3D Texture loading not supported");
BX_ASSERT(1 == imageContainer->m_numLayers, "Texture Layer loading not supported");
if (!imageContainer->m_cubeMap
&& 1 >= imageContainer->m_depth

View File

@@ -1067,7 +1067,7 @@ struct Model
::setRenderState(_renderState);
// Submit
BX_CHECK(bgfx::kInvalidHandle != m_program, "Error, program is not set.");
BX_ASSERT(bgfx::kInvalidHandle != m_program, "Error, program is not set.");
::submit(_viewId, m_program);
}
}
@@ -1104,7 +1104,7 @@ struct Instance
, m_pos[2]
);
BX_CHECK(NULL != m_model, "Instance model cannot be NULL!");
BX_ASSERT(NULL != m_model, "Instance model cannot be NULL!");
m_model->submit(_viewId, mtx, _renderState);
}
@@ -1140,7 +1140,7 @@ struct ShadowVolumeAllocator
{
void* ret = (void*)m_ptr;
m_ptr += _size;
BX_CHECK(m_ptr - m_mem < (m_firstPage ? SV_PAGE_SIZE : 2 * SV_PAGE_SIZE), "Buffer overflow!");
BX_ASSERT(m_ptr - m_mem < (m_firstPage ? SV_PAGE_SIZE : 2 * SV_PAGE_SIZE), "Buffer overflow!");
return ret;
}

View File

@@ -2326,7 +2326,7 @@ public:
// Compute split distances.
const uint8_t maxNumSplits = 4;
BX_CHECK(maxNumSplits >= settings.m_numSplits, "Error! Max num splits.");
BX_ASSERT(maxNumSplits >= settings.m_numSplits, "Error! Max num splits.");
float splitSlices[maxNumSplits*2];
splitFrustum(splitSlices

View File

@@ -161,7 +161,7 @@ void VectorDisplay::endFrame()
// advance step
m_currentDrawStep = (m_currentDrawStep + 1) % m_numberDecaySteps;
BX_CHECK(m_points.size() < MAX_NUMBER_VERTICES, "");
BX_ASSERT(m_points.size() < MAX_NUMBER_VERTICES, "");
bgfx::update(
m_vertexBuffers[m_currentDrawStep]
@@ -315,7 +315,7 @@ void VectorDisplay::endFrame()
void VectorDisplay::beginDraw(float _x, float _y)
{
BX_CHECK(0 == m_pendingPoints.size(), "Begin draw on already filled buffer!");
BX_ASSERT(0 == m_pendingPoints.size(), "Begin draw on already filled buffer!");
PendingPoint point;
point.x = _x * m_drawScale + m_drawOffsetX;

View File

@@ -117,7 +117,7 @@ static bgfx::ShaderHandle loadShader(bx::FileReaderI* _reader, const char* _name
case bgfx::RendererType::WebGPU: shaderPath = "shaders/spirv/"; break;
case bgfx::RendererType::Count:
BX_CHECK(false, "You should not be here!");
BX_ASSERT(false, "You should not be here!");
break;
}

View File

@@ -85,8 +85,8 @@ RectanglePacker::RectanglePacker(uint32_t _width, uint32_t _height)
void RectanglePacker::init(uint32_t _width, uint32_t _height)
{
BX_CHECK(_width > 2, "_width must be > 2");
BX_CHECK(_height > 2, "_height must be > 2");
BX_ASSERT(_width > 2, "_width must be > 2");
BX_ASSERT(_height > 2, "_height must be > 2");
m_width = _width;
m_height = _height;
m_usedSpace = 0;
@@ -256,8 +256,8 @@ Atlas::Atlas(uint16_t _textureSize, uint16_t _maxRegionsCount)
, m_regionCount(0)
, m_maxRegionCount(_maxRegionsCount)
{
BX_CHECK(_textureSize >= 64 && _textureSize <= 4096, "Invalid _textureSize %d.", _textureSize);
BX_CHECK(_maxRegionsCount >= 64 && _maxRegionsCount <= 32000, "Invalid _maxRegionsCount %d.", _maxRegionsCount);
BX_ASSERT(_textureSize >= 64 && _textureSize <= 4096, "Invalid _textureSize %d.", _textureSize);
BX_ASSERT(_maxRegionsCount >= 64 && _maxRegionsCount <= 32000, "Invalid _maxRegionsCount %d.", _maxRegionsCount);
init();
@@ -285,7 +285,7 @@ Atlas::Atlas(uint16_t _textureSize, const uint8_t* _textureBuffer, uint16_t _reg
, m_regionCount(_regionCount)
, m_maxRegionCount(_regionCount < _maxRegionsCount ? _regionCount : _maxRegionsCount)
{
BX_CHECK(_regionCount <= 64 && _maxRegionsCount <= 4096, "_regionCount %d, _maxRegionsCount %d", _regionCount, _maxRegionsCount);
BX_ASSERT(_regionCount <= 64 && _maxRegionsCount <= 4096, "_regionCount %d, _maxRegionsCount %d", _regionCount, _maxRegionsCount);
init();

View File

@@ -1050,7 +1050,7 @@ struct DebugDrawEncoderImpl
void begin(bgfx::ViewId _viewId, bool _depthTestLess, bgfx::Encoder* _encoder)
{
BX_CHECK(State::Count == m_state);
BX_ASSERT(State::Count == m_state);
m_viewId = _viewId;
m_encoder = _encoder == NULL ? m_defaultEncoder : _encoder;
@@ -1084,7 +1084,7 @@ struct DebugDrawEncoderImpl
void end()
{
BX_CHECK(0 == m_stack, "Invalid stack %d.", m_stack);
BX_ASSERT(0 == m_stack, "Invalid stack %d.", m_stack);
flushQuad();
flush();
@@ -1095,14 +1095,14 @@ struct DebugDrawEncoderImpl
void push()
{
BX_CHECK(State::Count != m_state);
BX_ASSERT(State::Count != m_state);
++m_stack;
m_attrib[m_stack] = m_attrib[m_stack-1];
}
void pop()
{
BX_CHECK(State::Count != m_state);
BX_ASSERT(State::Count != m_state);
const Attrib& curr = m_attrib[m_stack];
const Attrib& prev = m_attrib[m_stack-1];
if (curr.m_stipple != prev.m_stipple
@@ -1115,7 +1115,7 @@ struct DebugDrawEncoderImpl
void setDepthTestLess(bool _depthTestLess)
{
BX_CHECK(State::Count != m_state);
BX_ASSERT(State::Count != m_state);
if (m_depthTestLess != _depthTestLess)
{
m_depthTestLess = _depthTestLess;
@@ -1131,7 +1131,7 @@ struct DebugDrawEncoderImpl
void setTransform(const void* _mtx, uint16_t _num = 1, bool _flush = true)
{
BX_CHECK(State::Count != m_state);
BX_ASSERT(State::Count != m_state);
if (_flush)
{
flush();
@@ -1166,8 +1166,8 @@ struct DebugDrawEncoderImpl
void pushTransform(const void* _mtx, uint16_t _num, bool _flush = true)
{
BX_CHECK(m_mtxStackCurrent < BX_COUNTOF(m_mtxStack), "Out of matrix stack!");
BX_CHECK(State::Count != m_state);
BX_ASSERT(m_mtxStackCurrent < BX_COUNTOF(m_mtxStack), "Out of matrix stack!");
BX_ASSERT(State::Count != m_state);
if (_flush)
{
flush();
@@ -1197,7 +1197,7 @@ struct DebugDrawEncoderImpl
void popTransform(bool _flush = true)
{
BX_CHECK(State::Count != m_state);
BX_ASSERT(State::Count != m_state);
if (_flush)
{
flush();
@@ -1257,25 +1257,25 @@ struct DebugDrawEncoderImpl
void setColor(uint32_t _abgr)
{
BX_CHECK(State::Count != m_state);
BX_ASSERT(State::Count != m_state);
m_attrib[m_stack].m_abgr = _abgr;
}
void setLod(uint8_t _lod)
{
BX_CHECK(State::Count != m_state);
BX_ASSERT(State::Count != m_state);
m_attrib[m_stack].m_lod = _lod;
}
void setWireframe(bool _wireframe)
{
BX_CHECK(State::Count != m_state);
BX_ASSERT(State::Count != m_state);
m_attrib[m_stack].m_wireframe = _wireframe;
}
void setStipple(bool _stipple, float _scale = 1.0f, float _offset = 0.0f)
{
BX_CHECK(State::Count != m_state);
BX_ASSERT(State::Count != m_state);
Attrib& attrib = m_attrib[m_stack];
@@ -1297,7 +1297,7 @@ struct DebugDrawEncoderImpl
void moveTo(float _x, float _y, float _z = 0.0f)
{
BX_CHECK(State::Count != m_state);
BX_ASSERT(State::Count != m_state);
softFlush();
@@ -1317,7 +1317,7 @@ struct DebugDrawEncoderImpl
void moveTo(const bx::Vec3& _pos)
{
BX_CHECK(State::Count != m_state);
BX_ASSERT(State::Count != m_state);
moveTo(_pos.x, _pos.y, _pos.z);
}
@@ -1328,7 +1328,7 @@ struct DebugDrawEncoderImpl
void lineTo(float _x, float _y, float _z = 0.0f)
{
BX_CHECK(State::Count != m_state);
BX_ASSERT(State::Count != m_state);
if (State::None == m_state)
{
moveTo(_x, _y, _z);
@@ -1381,7 +1381,7 @@ struct DebugDrawEncoderImpl
void lineTo(const bx::Vec3& _pos)
{
BX_CHECK(State::Count != m_state);
BX_ASSERT(State::Count != m_state);
lineTo(_pos.x, _pos.y, _pos.z);
}
@@ -1392,7 +1392,7 @@ struct DebugDrawEncoderImpl
void close()
{
BX_CHECK(State::Count != m_state);
BX_ASSERT(State::Count != m_state);
DebugVertex& vertex = m_cache[m_vertexPos];
lineTo(vertex.m_x, vertex.m_y, vertex.m_z);

View File

@@ -30,7 +30,7 @@ struct CmdContext
void add(const char* _name, ConsoleFn _fn, void* _userData)
{
uint32_t cmd = bx::hash<bx::HashMurmur2A>(_name, (uint32_t)bx::strLen(_name) );
BX_CHECK(m_lookup.end() == m_lookup.find(cmd), "Command \"%s\" already exist.", _name);
BX_ASSERT(m_lookup.end() == m_lookup.find(cmd), "Command \"%s\" already exist.", _name);
Func fn = { _fn, _userData };
m_lookup.insert(stl::make_pair(cmd, fn) );
}

View File

@@ -189,7 +189,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
const char* getName(Key::Enum _key)
{
BX_CHECK(_key < Key::Count, "Invalid key %d.", _key);
BX_ASSERT(_key < Key::Count, "Invalid key %d.", _key);
return s_keyName[_key];
}

View File

@@ -108,7 +108,7 @@ namespace entry
virtual bool open(const bx::FilePath& _filePath, bx::Error* _err) override
{
BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
BX_ASSERT(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
if (NULL != m_file)
{
@@ -139,15 +139,15 @@ namespace entry
virtual int64_t seek(int64_t _offset, bx::Whence::Enum _whence) override
{
BX_CHECK(NULL != m_file, "Reader/Writer file is not open.");
BX_ASSERT(NULL != m_file, "Reader/Writer file is not open.");
return AAsset_seek64(m_file, _offset, _whence);
}
virtual int32_t read(void* _data, int32_t _size, bx::Error* _err) override
{
BX_CHECK(NULL != m_file, "Reader/Writer file is not open.");
BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
BX_ASSERT(NULL != m_file, "Reader/Writer file is not open.");
BX_ASSERT(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
int32_t size = (int32_t)AAsset_read(m_file, _data, _size);
if (size != _size)
@@ -555,7 +555,7 @@ namespace entry
BX_UNUSED(_thread);
int32_t result = chdir("/sdcard/bgfx/examples/runtime");
BX_CHECK(0 == result, "Failed to chdir to dir. android.permission.WRITE_EXTERNAL_STORAGE?", errno);
BX_ASSERT(0 == result, "Failed to chdir to dir. android.permission.WRITE_EXTERNAL_STORAGE?", errno);
MainThreadEntry* self = (MainThreadEntry*)_userData;
result = main(self->m_argc, self->m_argv);

View File

@@ -94,17 +94,17 @@ namespace entry
// will take the first canvas element found on the web page.
#define HTML5_TARGET_CANVAS_SELECTOR "#canvas"
BX_CHECK(emscripten_set_mousedown_callback(HTML5_TARGET_CANVAS_SELECTOR, this, true, mouseCb) == EMSCRIPTEN_RESULT_SUCCESS, "emscripten_set_mousedown_callback() failed!");
BX_CHECK(emscripten_set_mouseup_callback(HTML5_TARGET_CANVAS_SELECTOR, this, true, mouseCb) == EMSCRIPTEN_RESULT_SUCCESS, "emscripten_set_mouseup_callback() failed!");
BX_CHECK(emscripten_set_mousemove_callback(HTML5_TARGET_CANVAS_SELECTOR, this, true, mouseCb) == EMSCRIPTEN_RESULT_SUCCESS, "emscripten_set_mousemove_callback() failed!");
BX_ASSERT(emscripten_set_mousedown_callback(HTML5_TARGET_CANVAS_SELECTOR, this, true, mouseCb) == EMSCRIPTEN_RESULT_SUCCESS, "emscripten_set_mousedown_callback() failed!");
BX_ASSERT(emscripten_set_mouseup_callback(HTML5_TARGET_CANVAS_SELECTOR, this, true, mouseCb) == EMSCRIPTEN_RESULT_SUCCESS, "emscripten_set_mouseup_callback() failed!");
BX_ASSERT(emscripten_set_mousemove_callback(HTML5_TARGET_CANVAS_SELECTOR, this, true, mouseCb) == EMSCRIPTEN_RESULT_SUCCESS, "emscripten_set_mousemove_callback() failed!");
BX_CHECK(emscripten_set_wheel_callback(HTML5_TARGET_CANVAS_SELECTOR, this, true, wheelCb) == EMSCRIPTEN_RESULT_SUCCESS, "emscripten_set_wheel_callback() failed!");
BX_ASSERT(emscripten_set_wheel_callback(HTML5_TARGET_CANVAS_SELECTOR, this, true, wheelCb) == EMSCRIPTEN_RESULT_SUCCESS, "emscripten_set_wheel_callback() failed!");
BX_CHECK(emscripten_set_keypress_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, this, true, keyCb) == EMSCRIPTEN_RESULT_SUCCESS, "emscripten_set_keypress_callback() failed!");
BX_CHECK(emscripten_set_keydown_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, this, true, keyCb) == EMSCRIPTEN_RESULT_SUCCESS, "emscripten_set_keydown_callback() failed!");
BX_CHECK(emscripten_set_keyup_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, this, true, keyCb) == EMSCRIPTEN_RESULT_SUCCESS, "emscripten_set_keyup_callback() failed!");
BX_ASSERT(emscripten_set_keypress_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, this, true, keyCb) == EMSCRIPTEN_RESULT_SUCCESS, "emscripten_set_keypress_callback() failed!");
BX_ASSERT(emscripten_set_keydown_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, this, true, keyCb) == EMSCRIPTEN_RESULT_SUCCESS, "emscripten_set_keydown_callback() failed!");
BX_ASSERT(emscripten_set_keyup_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, this, true, keyCb) == EMSCRIPTEN_RESULT_SUCCESS, "emscripten_set_keyup_callback() failed!");
BX_CHECK(emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, this, true, resizeCb) == EMSCRIPTEN_RESULT_SUCCESS, "emscripten_set_resize_callback() failed!");
BX_ASSERT(emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, this, true, resizeCb) == EMSCRIPTEN_RESULT_SUCCESS, "emscripten_set_resize_callback() failed!");
EmscriptenFullscreenStrategy fullscreenStrategy = {};
fullscreenStrategy.scaleMode = EMSCRIPTEN_FULLSCREEN_SCALE_DEFAULT;
@@ -115,9 +115,9 @@ namespace entry
emscripten_request_fullscreen_strategy(HTML5_TARGET_CANVAS_SELECTOR, false, &fullscreenStrategy);
BX_CHECK(emscripten_set_focus_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, this, true, focusCb) == EMSCRIPTEN_RESULT_SUCCESS, "emscripten_set_focus_callback() failed!");
BX_CHECK(emscripten_set_focusin_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, this, true, focusCb) == EMSCRIPTEN_RESULT_SUCCESS, "emscripten_set_focusin_callback() failed!");
BX_CHECK(emscripten_set_focusout_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, this, true, focusCb) == EMSCRIPTEN_RESULT_SUCCESS, "emscripten_set_focusout_callback() failed!");
BX_ASSERT(emscripten_set_focus_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, this, true, focusCb) == EMSCRIPTEN_RESULT_SUCCESS, "emscripten_set_focus_callback() failed!");
BX_ASSERT(emscripten_set_focusin_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, this, true, focusCb) == EMSCRIPTEN_RESULT_SUCCESS, "emscripten_set_focusin_callback() failed!");
BX_ASSERT(emscripten_set_focusout_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, this, true, focusCb) == EMSCRIPTEN_RESULT_SUCCESS, "emscripten_set_focusout_callback() failed!");
bgfx::PlatformData pd;
bx::memSet(&pd, 0, sizeof(pd) );

View File

@@ -157,7 +157,7 @@ namespace entry
static void initTranslateKey(uint16_t _sdl, Key::Enum _key)
{
BX_CHECK(_sdl < BX_COUNTOF(s_translateKey), "Out of bounds %d.", _sdl);
BX_ASSERT(_sdl < BX_COUNTOF(s_translateKey), "Out of bounds %d.", _sdl);
s_translateKey[_sdl&0xff] = (uint8_t)_key;
}

View File

@@ -208,7 +208,7 @@ namespace entry
static void initTranslateKey(uint16_t _xk, Key::Enum _key)
{
_xk += 256;
BX_CHECK(_xk < BX_COUNTOF(s_translateKey), "Out of bounds %d.", _xk);
BX_ASSERT(_xk < BX_COUNTOF(s_translateKey), "Out of bounds %d.", _xk);
s_translateKey[_xk&0x1ff] = (uint8_t)_key;
}

View File

@@ -63,9 +63,9 @@ TrueTypeFont::~TrueTypeFont()
bool TrueTypeFont::init(const uint8_t* _buffer, uint32_t _bufferSize, int32_t _fontIndex, uint32_t _pixelHeight)
{
BX_CHECK(m_font == NULL, "TrueTypeFont already initialized");
BX_CHECK( (_bufferSize > 256 && _bufferSize < 100000000), "TrueType buffer size is suspicious");
BX_CHECK( (_pixelHeight > 4 && _pixelHeight < 128), "TrueType buffer size is suspicious");
BX_ASSERT(m_font == NULL, "TrueTypeFont already initialized");
BX_ASSERT( (_bufferSize > 256 && _bufferSize < 100000000), "TrueType buffer size is suspicious");
BX_ASSERT( (_pixelHeight > 4 && _pixelHeight < 128), "TrueType buffer size is suspicious");
BX_UNUSED(_bufferSize);
int offset = stbtt_GetFontOffsetForIndex(_buffer, _fontIndex);
@@ -79,7 +79,7 @@ bool TrueTypeFont::init(const uint8_t* _buffer, uint32_t _bufferSize, int32_t _f
FontInfo TrueTypeFont::getFontInfo()
{
BX_CHECK(m_font != NULL, "TrueTypeFont not initialized");
BX_ASSERT(m_font != NULL, "TrueTypeFont not initialized");
int ascent;
int descent;
@@ -105,7 +105,7 @@ FontInfo TrueTypeFont::getFontInfo()
bool TrueTypeFont::bakeGlyphAlpha(CodePoint _codePoint, GlyphInfo& _glyphInfo, uint8_t* _outBuffer)
{
BX_CHECK(m_font != NULL, "TrueTypeFont not initialized");
BX_ASSERT(m_font != NULL, "TrueTypeFont not initialized");
int xx;
int yy;
@@ -140,7 +140,7 @@ bool TrueTypeFont::bakeGlyphAlpha(CodePoint _codePoint, GlyphInfo& _glyphInfo, u
bool TrueTypeFont::bakeGlyphDistance(CodePoint _codePoint, GlyphInfo& _glyphInfo, uint8_t* _outBuffer)
{
BX_CHECK(m_font != NULL, "TrueTypeFont not initialized");
BX_ASSERT(m_font != NULL, "TrueTypeFont not initialized");
int32_t xx;
int32_t yy;
@@ -177,7 +177,7 @@ bool TrueTypeFont::bakeGlyphDistance(CodePoint _codePoint, GlyphInfo& _glyphInfo
uint32_t nw = ww + dw * 2;
uint32_t nh = hh + dh * 2;
BX_CHECK(nw * nh < 128 * 128, "Buffer overflow (size %d)", nw * nh);
BX_ASSERT(nw * nh < 128 * 128, "Buffer overflow (size %d)", nw * nh);
uint32_t buffSize = nw * nh * sizeof(uint8_t);
@@ -258,10 +258,10 @@ void FontManager::init()
FontManager::~FontManager()
{
BX_CHECK(m_fontHandles.getNumHandles() == 0, "All the fonts must be destroyed before destroying the manager");
BX_ASSERT(m_fontHandles.getNumHandles() == 0, "All the fonts must be destroyed before destroying the manager");
delete [] m_cachedFonts;
BX_CHECK(m_filesHandles.getNumHandles() == 0, "All the font files must be destroyed before destroying the manager");
BX_ASSERT(m_filesHandles.getNumHandles() == 0, "All the font files must be destroyed before destroying the manager");
delete [] m_cachedFiles;
delete [] m_buffer;
@@ -275,7 +275,7 @@ FontManager::~FontManager()
TrueTypeHandle FontManager::createTtf(const uint8_t* _buffer, uint32_t _size)
{
uint16_t id = m_filesHandles.alloc();
BX_CHECK(id != bx::kInvalidHandle, "Invalid handle used");
BX_ASSERT(id != bx::kInvalidHandle, "Invalid handle used");
m_cachedFiles[id].buffer = new uint8_t[_size];
m_cachedFiles[id].bufferSize = _size;
bx::memCopy(m_cachedFiles[id].buffer, _buffer, _size);
@@ -286,7 +286,7 @@ TrueTypeHandle FontManager::createTtf(const uint8_t* _buffer, uint32_t _size)
void FontManager::destroyTtf(TrueTypeHandle _handle)
{
BX_CHECK(bgfx::isValid(_handle), "Invalid handle used");
BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
delete m_cachedFiles[_handle.idx].buffer;
m_cachedFiles[_handle.idx].bufferSize = 0;
m_cachedFiles[_handle.idx].buffer = NULL;
@@ -295,7 +295,7 @@ void FontManager::destroyTtf(TrueTypeHandle _handle)
FontHandle FontManager::createFontByPixelSize(TrueTypeHandle _ttfHandle, uint32_t _typefaceIndex, uint32_t _pixelSize, uint32_t _fontType)
{
BX_CHECK(bgfx::isValid(_ttfHandle), "Invalid handle used");
BX_ASSERT(bgfx::isValid(_ttfHandle), "Invalid handle used");
TrueTypeFont* ttf = new TrueTypeFont();
if (!ttf->init(m_cachedFiles[_ttfHandle.idx].buffer, m_cachedFiles[_ttfHandle.idx].bufferSize, _typefaceIndex, _pixelSize) )
@@ -306,7 +306,7 @@ FontHandle FontManager::createFontByPixelSize(TrueTypeHandle _ttfHandle, uint32_
}
uint16_t fontIdx = m_fontHandles.alloc();
BX_CHECK(fontIdx != bx::kInvalidHandle, "Invalid handle used");
BX_ASSERT(fontIdx != bx::kInvalidHandle, "Invalid handle used");
CachedFont& font = m_cachedFonts[fontIdx];
font.trueTypeFont = ttf;
@@ -322,7 +322,7 @@ FontHandle FontManager::createFontByPixelSize(TrueTypeHandle _ttfHandle, uint32_
FontHandle FontManager::createScaledFontToPixelSize(FontHandle _baseFontHandle, uint32_t _pixelSize)
{
BX_CHECK(bgfx::isValid(_baseFontHandle), "Invalid handle used");
BX_ASSERT(bgfx::isValid(_baseFontHandle), "Invalid handle used");
CachedFont& baseFont = m_cachedFonts[_baseFontHandle.idx];
FontInfo& fontInfo = baseFont.fontInfo;
@@ -337,7 +337,7 @@ FontHandle FontManager::createScaledFontToPixelSize(FontHandle _baseFontHandle,
newFontInfo.underlinePosition = (newFontInfo.underlinePosition * newFontInfo.scale);
uint16_t fontIdx = m_fontHandles.alloc();
BX_CHECK(fontIdx != bx::kInvalidHandle, "Invalid handle used");
BX_ASSERT(fontIdx != bx::kInvalidHandle, "Invalid handle used");
CachedFont& font = m_cachedFonts[fontIdx];
font.cachedGlyphs.clear();
@@ -351,7 +351,7 @@ FontHandle FontManager::createScaledFontToPixelSize(FontHandle _baseFontHandle,
void FontManager::destroyFont(FontHandle _handle)
{
BX_CHECK(bgfx::isValid(_handle), "Invalid handle used");
BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
CachedFont& font = m_cachedFonts[_handle.idx];
@@ -367,7 +367,7 @@ void FontManager::destroyFont(FontHandle _handle)
bool FontManager::preloadGlyph(FontHandle _handle, const wchar_t* _string)
{
BX_CHECK(bgfx::isValid(_handle), "Invalid handle used");
BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
CachedFont& font = m_cachedFonts[_handle.idx];
if (NULL == font.trueTypeFont)
@@ -389,7 +389,7 @@ bool FontManager::preloadGlyph(FontHandle _handle, const wchar_t* _string)
bool FontManager::preloadGlyph(FontHandle _handle, CodePoint _codePoint)
{
BX_CHECK(bgfx::isValid(_handle), "Invalid handle used");
BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
CachedFont& font = m_cachedFonts[_handle.idx];
FontInfo& fontInfo = font.fontInfo;
@@ -418,7 +418,7 @@ bool FontManager::preloadGlyph(FontHandle _handle, CodePoint _codePoint)
break;
default:
BX_CHECK(false, "TextureType not supported yet");
BX_ASSERT(false, "TextureType not supported yet");
}
if (!addBitmap(glyphInfo, m_buffer) )
@@ -459,7 +459,7 @@ bool FontManager::preloadGlyph(FontHandle _handle, CodePoint _codePoint)
const FontInfo& FontManager::getFontInfo(FontHandle _handle) const
{
BX_CHECK(bgfx::isValid(_handle), "Invalid handle used");
BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
return m_cachedFonts[_handle.idx].fontInfo;
}
@@ -478,7 +478,7 @@ const GlyphInfo* FontManager::getGlyphInfo(FontHandle _handle, CodePoint _codePo
it = cachedGlyphs.find(_codePoint);
}
BX_CHECK(it != cachedGlyphs.end(), "Failed to preload glyph.");
BX_ASSERT(it != cachedGlyphs.end(), "Failed to preload glyph.");
return &it->second;
}

View File

@@ -253,7 +253,7 @@ void TextBuffer::appendText(FontHandle _fontHandle, const char* _string, const c
{
_end = _string + bx::strLen(_string);
}
BX_CHECK(_end >= _string);
BX_ASSERT(_end >= _string);
for (; *_string && _string < _end ; ++_string)
{
@@ -263,7 +263,7 @@ void TextBuffer::appendText(FontHandle _fontHandle, const char* _string, const c
}
}
BX_CHECK(state == UTF8_ACCEPT, "The string is not well-formed");
BX_ASSERT(state == UTF8_ACCEPT, "The string is not well-formed");
}
void TextBuffer::appendText(FontHandle _fontHandle, const wchar_t* _string, const wchar_t* _end)
@@ -281,7 +281,7 @@ void TextBuffer::appendText(FontHandle _fontHandle, const wchar_t* _string, cons
{
_end = _string + wcslen(_string);
}
BX_CHECK(_end >= _string);
BX_ASSERT(_end >= _string);
for (const wchar_t* _current = _string; _current < _end; ++_current)
{
@@ -610,7 +610,7 @@ TextBufferManager::TextBufferManager(FontManager* _fontManager)
TextBufferManager::~TextBufferManager()
{
BX_CHECK(m_textBufferHandles.getNumHandles() == 0, "All the text buffers must be destroyed before destroying the manager");
BX_ASSERT(m_textBufferHandles.getNumHandles() == 0, "All the text buffers must be destroyed before destroying the manager");
delete [] m_textBuffers;
bgfx::destroy(s_texColor);
@@ -637,7 +637,7 @@ TextBufferHandle TextBufferManager::createTextBuffer(uint32_t _type, BufferType:
void TextBufferManager::destroyTextBuffer(TextBufferHandle _handle)
{
BX_CHECK(bgfx::isValid(_handle), "Invalid handle used");
BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
m_textBufferHandles.free(_handle.idx);
@@ -680,7 +680,7 @@ void TextBufferManager::destroyTextBuffer(TextBufferHandle _handle)
void TextBufferManager::submitTextBuffer(TextBufferHandle _handle, bgfx::ViewId _id, int32_t _depth)
{
BX_CHECK(bgfx::isValid(_handle), "Invalid handle used");
BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
@@ -816,84 +816,84 @@ void TextBufferManager::submitTextBuffer(TextBufferHandle _handle, bgfx::ViewId
void TextBufferManager::setStyle(TextBufferHandle _handle, uint32_t _flags)
{
BX_CHECK(bgfx::isValid(_handle), "Invalid handle used");
BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->setStyle(_flags);
}
void TextBufferManager::setTextColor(TextBufferHandle _handle, uint32_t _rgba)
{
BX_CHECK(bgfx::isValid(_handle), "Invalid handle used");
BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->setTextColor(_rgba);
}
void TextBufferManager::setBackgroundColor(TextBufferHandle _handle, uint32_t _rgba)
{
BX_CHECK(bgfx::isValid(_handle), "Invalid handle used");
BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->setBackgroundColor(_rgba);
}
void TextBufferManager::setOverlineColor(TextBufferHandle _handle, uint32_t _rgba)
{
BX_CHECK(bgfx::isValid(_handle), "Invalid handle used");
BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->setOverlineColor(_rgba);
}
void TextBufferManager::setUnderlineColor(TextBufferHandle _handle, uint32_t _rgba)
{
BX_CHECK(bgfx::isValid(_handle), "Invalid handle used");
BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->setUnderlineColor(_rgba);
}
void TextBufferManager::setStrikeThroughColor(TextBufferHandle _handle, uint32_t _rgba)
{
BX_CHECK(bgfx::isValid(_handle), "Invalid handle used");
BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->setStrikeThroughColor(_rgba);
}
void TextBufferManager::setPenPosition(TextBufferHandle _handle, float _x, float _y)
{
BX_CHECK(bgfx::isValid(_handle), "Invalid handle used");
BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->setPenPosition(_x, _y);
}
void TextBufferManager::appendText(TextBufferHandle _handle, FontHandle _fontHandle, const char* _string, const char* _end)
{
BX_CHECK(bgfx::isValid(_handle), "Invalid handle used");
BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->appendText(_fontHandle, _string, _end);
}
void TextBufferManager::appendText(TextBufferHandle _handle, FontHandle _fontHandle, const wchar_t* _string, const wchar_t* _end)
{
BX_CHECK(bgfx::isValid(_handle), "Invalid handle used");
BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->appendText(_fontHandle, _string, _end);
}
void TextBufferManager::appendAtlasFace(TextBufferHandle _handle, uint16_t _faceIndex)
{
BX_CHECK(bgfx::isValid(_handle), "Invalid handle used");
BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->appendAtlasFace(_faceIndex);
}
void TextBufferManager::clearTextBuffer(TextBufferHandle _handle)
{
BX_CHECK(bgfx::isValid(_handle), "Invalid handle used");
BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
bc.textBuffer->clearTextBuffer();
}
TextRectangle TextBufferManager::getRectangle(TextBufferHandle _handle) const
{
BX_CHECK(bgfx::isValid(_handle), "Invalid handle used");
BX_ASSERT(bgfx::isValid(_handle), "Invalid handle used");
BufferCache& bc = m_textBuffers[_handle.idx];
return bc.textBuffer->getRectangle();
}

View File

@@ -59,12 +59,12 @@ void TextMetrics::appendText(FontHandle _fontHandle, const char* _string)
}
else
{
BX_CHECK(false, "Glyph not found");
BX_ASSERT(false, "Glyph not found");
}
}
}
BX_CHECK(state == UTF8_ACCEPT, "The string is not well-formed");
BX_ASSERT(state == UTF8_ACCEPT, "The string is not well-formed");
}
TextLineMetrics::TextLineMetrics(const FontInfo& _fontInfo)
@@ -88,7 +88,7 @@ uint32_t TextLineMetrics::getLineCount(const bx::StringView& _str) const
}
}
BX_CHECK(state == UTF8_ACCEPT, "The string is not well-formed");
BX_ASSERT(state == UTF8_ACCEPT, "The string is not well-formed");
return lineCount;
}
@@ -118,7 +118,7 @@ void TextLineMetrics::getSubText(const bx::StringView& _str, uint32_t _firstLine
}
}
BX_CHECK(state == UTF8_ACCEPT, "The string is not well-formed");
BX_ASSERT(state == UTF8_ACCEPT, "The string is not well-formed");
_begin = ptr;
while (ptr != _str.getTerm()
@@ -138,6 +138,6 @@ void TextLineMetrics::getSubText(const bx::StringView& _str, uint32_t _firstLine
}
}
BX_CHECK(state == UTF8_ACCEPT, "The string is not well-formed");
BX_ASSERT(state == UTF8_ACCEPT, "The string is not well-formed");
_end = ptr;
}

View File

@@ -626,7 +626,7 @@ namespace ps
void updateEmitter(EmitterHandle _handle, const EmitterUniforms* _uniforms)
{
BX_CHECK(m_emitterAlloc.isValid(_handle.idx)
BX_ASSERT(m_emitterAlloc.isValid(_handle.idx)
, "destroyEmitter handle %d is not valid."
, _handle.idx
);
@@ -645,7 +645,7 @@ namespace ps
void getAabb(EmitterHandle _handle, Aabb& _outAabb)
{
BX_CHECK(m_emitterAlloc.isValid(_handle.idx)
BX_ASSERT(m_emitterAlloc.isValid(_handle.idx)
, "getAabb handle %d is not valid."
, _handle.idx
);
@@ -654,7 +654,7 @@ namespace ps
void destroyEmitter(EmitterHandle _handle)
{
BX_CHECK(m_emitterAlloc.isValid(_handle.idx)
BX_ASSERT(m_emitterAlloc.isValid(_handle.idx)
, "destroyEmitter handle %d is not valid."
, _handle.idx
);