mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-19 05:23:00 +01:00
Fixed assert macros, and improved error handling.
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "../bgfx_utils.h"
|
||||
#include "../packrect.h"
|
||||
|
||||
#include <bx/debug.h>
|
||||
#include <bx/mutex.h>
|
||||
#include <bx/math.h>
|
||||
#include <bx/sort.h>
|
||||
@@ -1026,6 +1027,7 @@ struct DebugDrawEncoderImpl
|
||||
void init(bgfx::Encoder* _encoder)
|
||||
{
|
||||
m_defaultEncoder = _encoder;
|
||||
m_state = State::Count;
|
||||
}
|
||||
|
||||
void shutdown()
|
||||
@@ -1034,7 +1036,7 @@ struct DebugDrawEncoderImpl
|
||||
|
||||
void begin(bgfx::ViewId _viewId, bool _depthTestLess, bgfx::Encoder* _encoder)
|
||||
{
|
||||
BX_ASSERT(State::Count == m_state);
|
||||
BX_ASSERT(State::Count == m_state, "");
|
||||
|
||||
m_viewId = _viewId;
|
||||
m_encoder = _encoder == NULL ? m_defaultEncoder : _encoder;
|
||||
@@ -1079,14 +1081,14 @@ struct DebugDrawEncoderImpl
|
||||
|
||||
void push()
|
||||
{
|
||||
BX_ASSERT(State::Count != m_state);
|
||||
BX_ASSERT(State::Count != m_state, "");
|
||||
++m_stack;
|
||||
m_attrib[m_stack] = m_attrib[m_stack-1];
|
||||
}
|
||||
|
||||
void pop()
|
||||
{
|
||||
BX_ASSERT(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
|
||||
@@ -1099,7 +1101,7 @@ struct DebugDrawEncoderImpl
|
||||
|
||||
void setDepthTestLess(bool _depthTestLess)
|
||||
{
|
||||
BX_ASSERT(State::Count != m_state);
|
||||
BX_ASSERT(State::Count != m_state, "");
|
||||
if (m_depthTestLess != _depthTestLess)
|
||||
{
|
||||
m_depthTestLess = _depthTestLess;
|
||||
@@ -1115,7 +1117,7 @@ struct DebugDrawEncoderImpl
|
||||
|
||||
void setTransform(const void* _mtx, uint16_t _num = 1, bool _flush = true)
|
||||
{
|
||||
BX_ASSERT(State::Count != m_state);
|
||||
BX_ASSERT(State::Count != m_state, "");
|
||||
if (_flush)
|
||||
{
|
||||
flush();
|
||||
@@ -1151,7 +1153,7 @@ struct DebugDrawEncoderImpl
|
||||
void pushTransform(const void* _mtx, uint16_t _num, bool _flush = true)
|
||||
{
|
||||
BX_ASSERT(m_mtxStackCurrent < BX_COUNTOF(m_mtxStack), "Out of matrix stack!");
|
||||
BX_ASSERT(State::Count != m_state);
|
||||
BX_ASSERT(State::Count != m_state, "");
|
||||
if (_flush)
|
||||
{
|
||||
flush();
|
||||
@@ -1181,7 +1183,7 @@ struct DebugDrawEncoderImpl
|
||||
|
||||
void popTransform(bool _flush = true)
|
||||
{
|
||||
BX_ASSERT(State::Count != m_state);
|
||||
BX_ASSERT(State::Count != m_state, "");
|
||||
if (_flush)
|
||||
{
|
||||
flush();
|
||||
@@ -1241,25 +1243,25 @@ struct DebugDrawEncoderImpl
|
||||
|
||||
void setColor(uint32_t _abgr)
|
||||
{
|
||||
BX_ASSERT(State::Count != m_state);
|
||||
BX_ASSERT(State::Count != m_state, "");
|
||||
m_attrib[m_stack].m_abgr = _abgr;
|
||||
}
|
||||
|
||||
void setLod(uint8_t _lod)
|
||||
{
|
||||
BX_ASSERT(State::Count != m_state);
|
||||
BX_ASSERT(State::Count != m_state, "");
|
||||
m_attrib[m_stack].m_lod = _lod;
|
||||
}
|
||||
|
||||
void setWireframe(bool _wireframe)
|
||||
{
|
||||
BX_ASSERT(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_ASSERT(State::Count != m_state);
|
||||
BX_ASSERT(State::Count != m_state, "");
|
||||
|
||||
Attrib& attrib = m_attrib[m_stack];
|
||||
|
||||
@@ -1281,7 +1283,7 @@ struct DebugDrawEncoderImpl
|
||||
|
||||
void moveTo(float _x, float _y, float _z = 0.0f)
|
||||
{
|
||||
BX_ASSERT(State::Count != m_state);
|
||||
BX_ASSERT(State::Count != m_state, "");
|
||||
|
||||
softFlush();
|
||||
|
||||
@@ -1301,7 +1303,7 @@ struct DebugDrawEncoderImpl
|
||||
|
||||
void moveTo(const bx::Vec3& _pos)
|
||||
{
|
||||
BX_ASSERT(State::Count != m_state);
|
||||
BX_ASSERT(State::Count != m_state, "");
|
||||
moveTo(_pos.x, _pos.y, _pos.z);
|
||||
}
|
||||
|
||||
@@ -1312,7 +1314,7 @@ struct DebugDrawEncoderImpl
|
||||
|
||||
void lineTo(float _x, float _y, float _z = 0.0f)
|
||||
{
|
||||
BX_ASSERT(State::Count != m_state);
|
||||
BX_ASSERT(State::Count != m_state, "");
|
||||
if (State::None == m_state)
|
||||
{
|
||||
moveTo(_x, _y, _z);
|
||||
@@ -1365,7 +1367,7 @@ struct DebugDrawEncoderImpl
|
||||
|
||||
void lineTo(const bx::Vec3& _pos)
|
||||
{
|
||||
BX_ASSERT(State::Count != m_state);
|
||||
BX_ASSERT(State::Count != m_state, "");
|
||||
lineTo(_pos.x, _pos.y, _pos.z);
|
||||
}
|
||||
|
||||
@@ -1376,7 +1378,7 @@ struct DebugDrawEncoderImpl
|
||||
|
||||
void close()
|
||||
{
|
||||
BX_ASSERT(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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user