@@ -1 +1 @@ | |||||
Subproject commit 42d43c24a7eb3eab58483f9ead5bc6b5fbf57473 | |||||
Subproject commit d22746ebaf889679f9fd5f5aecb8882ff614ee73 |
@@ -11,7 +11,9 @@ | |||||
// | // | ||||
#include <lol/engine-internal.h> | #include <lol/engine-internal.h> | ||||
#include <../legacy/lol/base/assert.h> | |||||
#include <lol/msg> | |||||
#include <cassert> | |||||
#if HAVE_EMSCRIPTEN_H | #if HAVE_EMSCRIPTEN_H | ||||
# include <emscripten.h> | # include <emscripten.h> | ||||
@@ -55,7 +57,8 @@ class null_app | |||||
public: | public: | ||||
null_app(char const *, ivec2, float) | null_app(char const *, ivec2, float) | ||||
{ | { | ||||
ASSERT(false, "no display library (SDL, EGL…) available"); | |||||
msg::error("no display library (SDL, EGL…) available"); | |||||
assert(false); | |||||
} | } | ||||
virtual ~null_app() {} | virtual ~null_app() {} | ||||
@@ -11,7 +11,7 @@ | |||||
// | // | ||||
#include <lol/engine-internal.h> | #include <lol/engine-internal.h> | ||||
#include <../legacy/lol/base/assert.h> | |||||
#include <lol/msg> | |||||
#if HAVE_CXXABI_H | #if HAVE_CXXABI_H | ||||
# include <cxxabi.h> | # include <cxxabi.h> | ||||
@@ -33,10 +33,10 @@ namespace debug | |||||
void dump_stack() | void dump_stack() | ||||
{ | { | ||||
#if __EMSCRIPTEN__ | #if __EMSCRIPTEN__ | ||||
/* This would require demangling but we don't care yet. */ | |||||
// This would require demangling but we don't care yet. | |||||
msg::debug("%s\n", emscripten_run_script_string("(new Error).stack")); | msg::debug("%s\n", emscripten_run_script_string("(new Error).stack")); | ||||
#elif HAVE_CXA_DEMANGLE && HAVE_BACKTRACE_SYMBOLS | #elif HAVE_CXA_DEMANGLE && HAVE_BACKTRACE_SYMBOLS | ||||
/* Get current stack frames */ | |||||
// Get current stack frames | |||||
void *stack_ptrs[50]; | void *stack_ptrs[50]; | ||||
size_t size = backtrace(stack_ptrs, 50); | size_t size = backtrace(stack_ptrs, 50); | ||||
char **callstack = backtrace_symbols(stack_ptrs, size); | char **callstack = backtrace_symbols(stack_ptrs, size); | ||||
@@ -44,8 +44,8 @@ void dump_stack() | |||||
if (size > 1) | if (size > 1) | ||||
msg::debug("%d functions in stack trace:\n", (int)size - 1); | msg::debug("%d functions in stack trace:\n", (int)size - 1); | ||||
/* Parse stack frames, skipping the first element (because | |||||
* that’s ourselves) and print information. */ | |||||
// Parse stack frames, skipping the first element (because | |||||
// that’s ourselves) and print information. | |||||
for (size_t i = 1; i < size; ++i) | for (size_t i = 1; i < size; ++i) | ||||
{ | { | ||||
char *name = 0, *offset = 0, *address = 0; | char *name = 0, *offset = 0, *address = 0; | ||||
@@ -87,7 +87,7 @@ void dump_stack() | |||||
#endif | #endif | ||||
} | } | ||||
} /* namespace debug */ | |||||
} // namespace debug | |||||
} /* namespace lol */ | |||||
} // namespace lol | |||||
@@ -18,6 +18,7 @@ | |||||
#include <lol/engine.h> | #include <lol/engine.h> | ||||
#include <lol/lua.h> | #include <lol/lua.h> | ||||
#include <cassert> | |||||
#include <cstdio> | #include <cstdio> | ||||
#include <string> | #include <string> | ||||
#include <map> | #include <map> | ||||
@@ -86,7 +87,7 @@ EasyMeshLuaObject::~EasyMeshLuaObject() | |||||
} | } | ||||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||
EasyMeshLuaObject* EasyMeshLuaObject::New(lua_State *, int) | |||||
EasyMeshLuaObject* EasyMeshLuaObject::New(lua_State *l, int) | |||||
{ | { | ||||
LuaStack s = LuaStack::Begin(l); | LuaStack s = LuaStack::Begin(l); | ||||
std::string str = s.Get<std::string>(""); | std::string str = s.Get<std::string>(""); | ||||
@@ -295,7 +296,7 @@ void EasyMesh::ExecuteCmdStack(bool ExecAllStack) | |||||
DO_EXEC_CMD(AppendSimpleQuad, (AppendSimpleQuad, vec2, vec2, float, bool)) | DO_EXEC_CMD(AppendSimpleQuad, (AppendSimpleQuad, vec2, vec2, float, bool)) | ||||
DO_EXEC_CMD(AppendCog, (AppendCog, int, float, float, float, float, float, float, float, float, bool)) | DO_EXEC_CMD(AppendCog, (AppendCog, int, float, float, float, float, float, float, float, float, bool)) | ||||
default: | default: | ||||
ASSERT(0, "Unknown command pseudo bytecode"); | |||||
assert(false); | |||||
} | } | ||||
} | } | ||||
BD()->Disable(MeshBuildOperation::CommandExecution); | BD()->Disable(MeshBuildOperation::CommandExecution); | ||||
@@ -13,7 +13,9 @@ | |||||
// | // | ||||
#include <lol/engine-internal.h> | #include <lol/engine-internal.h> | ||||
#include <../legacy/lol/base/assert.h> | |||||
#include <lol/msg> | |||||
#include <cassert> | |||||
namespace lol | namespace lol | ||||
{ | { | ||||
@@ -260,7 +262,11 @@ void GpuEasyMeshData::AddGpuData(std::shared_ptr<GpuShaderData> gpudata, std::sh | |||||
BUILD_VFLAG(has_color, VertexUsage::Color, vflags); | BUILD_VFLAG(has_color, VertexUsage::Color, vflags); | ||||
BUILD_VFLAG(has_texcoord, VertexUsage::TexCoord, vflags); | BUILD_VFLAG(has_texcoord, VertexUsage::TexCoord, vflags); | ||||
BUILD_VFLAG_OR(has_texcoord, VertexUsage::TexCoordExt, vflags); | BUILD_VFLAG_OR(has_texcoord, VertexUsage::TexCoordExt, vflags); | ||||
ASSERT(!vflags, "no Vertex Usage setup for 0x%04x", vflags); | |||||
if (vflags) | |||||
{ | |||||
msg::error("no Vertex Usage setup for 0x%04x", vflags); | |||||
assert(!vflags); | |||||
} | |||||
if (has_position) gpudata->AddAttribute(VertexUsage::Position, 0); | if (has_position) gpudata->AddAttribute(VertexUsage::Position, 0); | ||||
if (has_normal) gpudata->AddAttribute(VertexUsage::Normal, 0); | if (has_normal) gpudata->AddAttribute(VertexUsage::Normal, 0); | ||||
@@ -324,7 +330,11 @@ void GpuEasyMeshData::SetupVertexData(uint16_t vflags, std::shared_ptr<EasyMesh> | |||||
BUILD_VFLAG_COUNT(has_color, VertexUsage::Color, saveflags, flagnb); | BUILD_VFLAG_COUNT(has_color, VertexUsage::Color, saveflags, flagnb); | ||||
BUILD_VFLAG_COUNT(has_texcoord, VertexUsage::TexCoord, saveflags, flagnb); | BUILD_VFLAG_COUNT(has_texcoord, VertexUsage::TexCoord, saveflags, flagnb); | ||||
BUILD_VFLAG_COUNT(has_texcoordExt,VertexUsage::TexCoordExt, saveflags, flagnb); | BUILD_VFLAG_COUNT(has_texcoordExt,VertexUsage::TexCoordExt, saveflags, flagnb); | ||||
ASSERT(!saveflags, "no Vertex Declaration setup for 0x%04x", vflags); | |||||
if (saveflags) | |||||
{ | |||||
msg::error("no Vertex Declaration setup for 0x%04x", vflags); | |||||
assert(!saveflags); | |||||
} | |||||
if (flagnb == 5 && has_position && has_normal && has_color && has_texcoord && has_texcoordExt) | if (flagnb == 5 && has_position && has_normal && has_color && has_texcoord && has_texcoordExt) | ||||
{ | { | ||||
@@ -444,7 +454,10 @@ void GpuEasyMeshData::SetupVertexData(uint16_t vflags, std::shared_ptr<EasyMesh> | |||||
COPY_VBO; | COPY_VBO; | ||||
} | } | ||||
else | else | ||||
ASSERT(0, "no known Vertex Declaration combination for 0x%04x", vflags); | |||||
{ | |||||
msg::error("no known Vertex Declaration combination for 0x%04x", vflags); | |||||
assert(false); | |||||
} | |||||
m_vdata.push(vflags, new_vdecl, new_vbo); | m_vdata.push(vflags, new_vdecl, new_vbo); | ||||
} | } | ||||
@@ -452,8 +465,8 @@ void GpuEasyMeshData::SetupVertexData(uint16_t vflags, std::shared_ptr<EasyMesh> | |||||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||
void GpuEasyMeshData::RenderMeshData(mat4 const &model, int render_mode) | void GpuEasyMeshData::RenderMeshData(mat4 const &model, int render_mode) | ||||
{ | { | ||||
ASSERT(0 <= render_mode && render_mode < m_gpudata.count(), "render mode is not in the defined range"); | |||||
ASSERT(m_gpudata[render_mode], "gpu datas for this render mode don't exist"); | |||||
assert(0 <= render_mode && render_mode < m_gpudata.count()); | |||||
assert(m_gpudata[render_mode]); | |||||
GpuShaderData& gpu_sd = *(m_gpudata[render_mode]); | GpuShaderData& gpu_sd = *(m_gpudata[render_mode]); | ||||
int vdecl_idx = 0; | int vdecl_idx = 0; | ||||
@@ -478,7 +491,11 @@ void GpuEasyMeshData::RenderMeshData(mat4 const &model, int render_mode) | |||||
BUILD_VFLAG(has_color, VertexUsage::Color, vflags); | BUILD_VFLAG(has_color, VertexUsage::Color, vflags); | ||||
BUILD_VFLAG(has_texcoord, VertexUsage::TexCoord, vflags); | BUILD_VFLAG(has_texcoord, VertexUsage::TexCoord, vflags); | ||||
BUILD_VFLAG_OR(has_texcoord,VertexUsage::TexCoordExt, vflags); | BUILD_VFLAG_OR(has_texcoord,VertexUsage::TexCoordExt, vflags); | ||||
ASSERT(!vflags, "no Vertex Stream setup for 0x%04x", vflags); | |||||
if (vflags) | |||||
{ | |||||
msg::error("no Vertex Stream setup for 0x%04x", vflags); | |||||
assert(!vflags); | |||||
} | |||||
int idx = 0; | int idx = 0; | ||||
ShaderAttrib Attribs[4] = { lol::ShaderAttrib(), lol::ShaderAttrib(), lol::ShaderAttrib(), lol::ShaderAttrib() }; | ShaderAttrib Attribs[4] = { lol::ShaderAttrib(), lol::ShaderAttrib(), lol::ShaderAttrib(), lol::ShaderAttrib() }; | ||||
@@ -12,8 +12,8 @@ | |||||
#include <lol/engine-internal.h> | #include <lol/engine-internal.h> | ||||
#include <lol/msg> | #include <lol/msg> | ||||
#include <../legacy/lol/base/assert.h> | |||||
#include <cassert> // assert | |||||
#include <unordered_set> // std::unordered_set | #include <unordered_set> // std::unordered_set | ||||
#include <cstdlib> | #include <cstdlib> | ||||
#include <functional> | #include <functional> | ||||
@@ -46,10 +46,9 @@ public: | |||||
~ticker_data() | ~ticker_data() | ||||
{ | { | ||||
ASSERT(DEPRECATED_nentities == 0, | |||||
"still %d entities in ticker\n", DEPRECATED_nentities); | |||||
ASSERT(DEPRECATED_m_autolist.size() == 0, | |||||
"still %d autoreleased entities\n", int(DEPRECATED_m_autolist.size())); | |||||
assert(DEPRECATED_nentities == 0); | |||||
assert(DEPRECATED_m_autolist.size() == 0); | |||||
msg::debug("%d frames required to quit\n", m_frame - m_quitframe); | msg::debug("%d frames required to quit\n", m_frame - m_quitframe); | ||||
if (thread::has_threads()) | if (thread::has_threads()) | ||||
@@ -58,7 +57,7 @@ public: | |||||
disktick.push(0); | disktick.push(0); | ||||
gamethread.release(); | gamethread.release(); | ||||
diskthread.release(); | diskthread.release(); | ||||
ASSERT(drawtick.size() == 0); | |||||
assert(drawtick.size() == 0); | |||||
} | } | ||||
} | } | ||||
@@ -139,10 +138,8 @@ void Ticker::Register(entity *entity) | |||||
void Ticker::Ref(entity *entity) | void Ticker::Ref(entity *entity) | ||||
{ | { | ||||
ASSERT(entity, "dereferencing nullptr entity\n"); | |||||
ASSERT(!entity->has_flags(entity::flags::destroying), | |||||
"referencing entity scheduled for destruction %s\n", | |||||
entity->GetName().c_str()); | |||||
assert(entity); | |||||
assert(!entity->has_flags(entity::flags::destroying)); | |||||
if (entity->has_flags(entity::flags::autorelease)) | if (entity->has_flags(entity::flags::autorelease)) | ||||
{ | { | ||||
@@ -165,11 +162,9 @@ void Ticker::Ref(entity *entity) | |||||
int Ticker::Unref(entity *entity) | int Ticker::Unref(entity *entity) | ||||
{ | { | ||||
ASSERT(entity, "dereferencing null entity\n"); | |||||
ASSERT(entity->m_ref > 0, | |||||
"dereferencing unreferenced entity %s\n", entity->GetName().c_str()); | |||||
ASSERT(!entity->has_flags(entity::flags::autorelease), | |||||
"dereferencing autoreleased entity %s\n", entity->GetName().c_str()); | |||||
assert(entity); | |||||
assert(entity->m_ref > 0); | |||||
assert(!entity->has_flags(entity::flags::autorelease)); | |||||
return --entity->m_ref; | return --entity->m_ref; | ||||
} | } | ||||
@@ -11,7 +11,7 @@ | |||||
// | // | ||||
#include <lol/engine-internal.h> | #include <lol/engine-internal.h> | ||||
#include <../legacy/lol/base/assert.h> | |||||
#include <lol/msg> | |||||
#include "lolgl.h" | #include "lolgl.h" | ||||
@@ -11,7 +11,9 @@ | |||||
// | // | ||||
#include <lol/engine-internal.h> | #include <lol/engine-internal.h> | ||||
#include <../legacy/lol/base/assert.h> | |||||
#include <lol/msg> | |||||
#include <cassert> | |||||
// FIXME: fine-tune this define | // FIXME: fine-tune this define | ||||
#if defined LOL_USE_GLEW || defined HAVE_GL_2X || defined HAVE_GLES_2X | #if defined LOL_USE_GLEW || defined HAVE_GL_2X || defined HAVE_GLES_2X | ||||
@@ -117,7 +119,7 @@ uint32_t FramebufferFormat::GetFormat() | |||||
#endif | #endif | ||||
#endif | #endif | ||||
default: | default: | ||||
ASSERT(false, "unknown framebuffer format %d", m_format); | |||||
assert(false); | |||||
return 0; | return 0; | ||||
} | } | ||||
} | } | ||||
@@ -159,7 +161,7 @@ uint32_t FramebufferFormat::GetFormatOrder() | |||||
# endif | # endif | ||||
#endif | #endif | ||||
default: | default: | ||||
ASSERT(false, "unknown framebuffer format order %d", m_format); | |||||
assert(false); | |||||
return 0; | return 0; | ||||
} | } | ||||
} | } | ||||
@@ -243,8 +245,8 @@ Framebuffer::Framebuffer(ivec2 size, FramebufferFormat fbo_format) | |||||
#if defined GL_VERSION_1_1 || defined GL_ES_VERSION_2_0 | #if defined GL_VERSION_1_1 || defined GL_ES_VERSION_2_0 | ||||
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); | GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); | ||||
ASSERT(status == GL_FRAMEBUFFER_COMPLETE, | |||||
"invalid framebuffer status 0x%x", status); | |||||
if (status != GL_FRAMEBUFFER_COMPLETE) | |||||
msg::error("invalid framebuffer status 0x%x", status); | |||||
#endif | #endif | ||||
#if defined GL_VERSION_1_1 || defined GL_ES_VERSION_2_0 | #if defined GL_VERSION_1_1 || defined GL_ES_VERSION_2_0 | ||||
@@ -295,7 +297,8 @@ image Framebuffer::GetImage() const | |||||
void Framebuffer::Bind() | void Framebuffer::Bind() | ||||
{ | { | ||||
ASSERT(!m_data->m_bound, "trying to bind an already bound framebuffer"); | |||||
if (m_data->m_bound) | |||||
msg::error("trying to bind an already bound framebuffer"); | |||||
#if defined GL_VERSION_1_1 || defined GL_ES_VERSION_2_0 | #if defined GL_VERSION_1_1 || defined GL_ES_VERSION_2_0 | ||||
glBindFramebuffer(GL_FRAMEBUFFER, m_data->m_fbo); | glBindFramebuffer(GL_FRAMEBUFFER, m_data->m_fbo); | ||||
@@ -314,7 +317,8 @@ void Framebuffer::Bind() | |||||
void Framebuffer::Unbind() | void Framebuffer::Unbind() | ||||
{ | { | ||||
ASSERT(m_data->m_bound, "trying to unbind an unbound framebuffer"); | |||||
if (!m_data->m_bound) | |||||
msg::error("trying to unbind an unbound framebuffer"); | |||||
#if defined GL_VERSION_1_1 || defined GL_ES_VERSION_2_0 | #if defined GL_VERSION_1_1 || defined GL_ES_VERSION_2_0 | ||||
glBindFramebuffer(GL_FRAMEBUFFER, 0); | glBindFramebuffer(GL_FRAMEBUFFER, 0); | ||||
@@ -13,8 +13,8 @@ | |||||
#include <lol/engine-internal.h> | #include <lol/engine-internal.h> | ||||
#include <lol/msg> | #include <lol/msg> | ||||
#include <lol/pegtl> | #include <lol/pegtl> | ||||
#include <../legacy/lol/base/assert.h> | |||||
#include <cassert> | |||||
#include <string> | #include <string> | ||||
#include <memory> | #include <memory> | ||||
#include <map> | #include <map> | ||||
@@ -190,11 +190,11 @@ std::shared_ptr<Shader> Shader::Create(std::string const &name, std::string cons | |||||
{ | { | ||||
lolfx_parser p(code); | lolfx_parser p(code); | ||||
ASSERT(has_key(p.m_programs, "vert.glsl"), | |||||
"no vertex shader in %s", name.c_str()); | |||||
if (!has_key(p.m_programs, "vert.glsl")) | |||||
msg::error("no vertex shader in %s", name.c_str()); | |||||
ASSERT(has_key(p.m_programs, "frag.glsl"), | |||||
"no fragment shader in %s", name.c_str()); | |||||
if (!has_key(p.m_programs, "frag.glsl")) | |||||
msg::error("no fragment shader in %s", name.c_str()); | |||||
std::string vert = p.m_programs["vert.glsl"]; | std::string vert = p.m_programs["vert.glsl"]; | ||||
std::string frag = p.m_programs["frag.glsl"]; | std::string frag = p.m_programs["frag.glsl"]; | ||||
@@ -806,7 +806,7 @@ ShaderVar ShaderVar::GetShaderOut(ShaderProgram program) | |||||
switch (program.ToScalar()) | switch (program.ToScalar()) | ||||
{ | { | ||||
case ShaderProgram::Geometry: //TODO : L O L ------------------------------ | case ShaderProgram::Geometry: //TODO : L O L ------------------------------ | ||||
default: ASSERT(false); return ShaderVar(); | |||||
default: assert(false); return ShaderVar(); | |||||
case ShaderProgram::Vertex: return ShaderVar(ShaderVariable::InOut, ShaderVariableType::Vec4, Shader::GetProgramOutVariableLocal(program)); | case ShaderProgram::Vertex: return ShaderVar(ShaderVariable::InOut, ShaderVariableType::Vec4, Shader::GetProgramOutVariableLocal(program)); | ||||
case ShaderProgram::Pixel: return ShaderVar(ShaderVariable::InOut, ShaderVariableType::Vec4, Shader::GetProgramOutVariableLocal(program)); | case ShaderProgram::Pixel: return ShaderVar(ShaderVariable::InOut, ShaderVariableType::Vec4, Shader::GetProgramOutVariableLocal(program)); | ||||
} | } | ||||
@@ -818,7 +818,7 @@ void ShaderBlock::AddVar(ShaderVar const& var) | |||||
ShaderVariable qualifier = var.GetQualifier(); | ShaderVariable qualifier = var.GetQualifier(); | ||||
std::string type = var.GetType(); | std::string type = var.GetType(); | ||||
std::string name = Shader::GetVariablePrefix(qualifier) + var.m_name; | std::string name = Shader::GetVariablePrefix(qualifier) + var.m_name; | ||||
ASSERT(!has_key(m_parameters[qualifier.ToScalar()], name)); | |||||
assert(!has_key(m_parameters[qualifier.ToScalar()], name)); | |||||
m_parameters[qualifier.ToScalar()][name] = type; | m_parameters[qualifier.ToScalar()][name] = type; | ||||
} | } | ||||
@@ -850,8 +850,8 @@ void ShaderBlock::AddDefinitionParameters(const ShaderVariable type, const Shade | |||||
//---- | //---- | ||||
void ShaderBlock::Build(const ShaderProgram program, std::string& call, std::string& function) | void ShaderBlock::Build(const ShaderProgram program, std::string& call, std::string& function) | ||||
{ | { | ||||
ASSERT(m_name.length()); | |||||
ASSERT(m_parameters[ShaderVariable::InOut].size()); | |||||
assert(m_name.length()); | |||||
assert(m_parameters[ShaderVariable::InOut].size()); | |||||
//Build call in main | //Build call in main | ||||
std::string call_name = std::string("Call_") + m_name; | std::string call_name = std::string("Call_") + m_name; | ||||
@@ -875,8 +875,8 @@ void ShaderBlock::Build(const ShaderProgram program, std::string& call, std::str | |||||
ShaderBuilder::ShaderBuilder(std::string const& name, std::string const& version) | ShaderBuilder::ShaderBuilder(std::string const& name, std::string const& version) | ||||
: m_name(name), m_version(version) | : m_name(name), m_version(version) | ||||
{ | { | ||||
ASSERT(name.length()); | |||||
ASSERT(version.length()); | |||||
assert(name.length()); | |||||
assert(version.length()); | |||||
} | } | ||||
//---- | //---- | ||||
@@ -900,7 +900,7 @@ ShaderBuilder& ShaderBuilder::operator<<(const ShaderProgram program) | |||||
//---- | //---- | ||||
ShaderBuilder& ShaderBuilder::operator<<(ShaderBlock* new_block) | ShaderBuilder& ShaderBuilder::operator<<(ShaderBlock* new_block) | ||||
{ | { | ||||
ASSERT(m_current_program != ShaderProgram::MAX); | |||||
assert(m_current_program != ShaderProgram::MAX); | |||||
for (auto const block : m_blocks[m_current_program.ToScalar()]) | for (auto const block : m_blocks[m_current_program.ToScalar()]) | ||||
if (block == new_block) | if (block == new_block) | ||||
return *this; | return *this; | ||||
@@ -911,7 +911,7 @@ ShaderBuilder& ShaderBuilder::operator<<(ShaderBlock* new_block) | |||||
//---- | //---- | ||||
ShaderBuilder& ShaderBuilder::operator<<(ShaderBlock const& block) | ShaderBuilder& ShaderBuilder::operator<<(ShaderBlock const& block) | ||||
{ | { | ||||
ASSERT(m_current_program != ShaderProgram::MAX); | |||||
assert(m_current_program != ShaderProgram::MAX); | |||||
m_blocks[m_current_program.ToScalar()].push_back(new ShaderBlock(block)); | m_blocks[m_current_program.ToScalar()].push_back(new ShaderBlock(block)); | ||||
return *this; | return *this; | ||||
} | } | ||||
@@ -953,12 +953,13 @@ void ShaderBuilder::MergeParameters(std::map<std::string, std::string>& variable | |||||
{ | { | ||||
bool has_param = has_key(merged, key.first); | bool has_param = has_key(merged, key.first); | ||||
//Key exists, check the type to make sure it's the same | |||||
ASSERT(!has_param || (has_param && merged[key.first] == variables[key.first]), | |||||
"has_param=%d, key=%s merged[key]=%s, variables[key]=%s\n", | |||||
(int)has_param, key.first.c_str(), merged[key.first].c_str(), key.second.c_str()); | |||||
// Key exists, check the type to make sure it's the same | |||||
if (has_param && merged[key.first] != variables[key.first]) | |||||
msg::error("has_param=%d, key=%s merged[key]=%s, variables[key]=%s\n", | |||||
(int)has_param, key.first.c_str(), merged[key.first].c_str(), | |||||
key.second.c_str()); | |||||
//does not exist, had it | |||||
// does not exist, had it | |||||
if (!has_param) | if (!has_param) | ||||
merged[key.first] = key.second; | merged[key.first] = key.second; | ||||
} | } | ||||
@@ -11,7 +11,6 @@ | |||||
// | // | ||||
#include <lol/engine-internal.h> | #include <lol/engine-internal.h> | ||||
#include <../legacy/lol/base/assert.h> | |||||
#include <string> | #include <string> | ||||
@@ -11,7 +11,7 @@ | |||||
// | // | ||||
#include <lol/engine-internal.h> | #include <lol/engine-internal.h> | ||||
#include <../legacy/lol/base/assert.h> | |||||
#include <cassert> | |||||
/* | /* | ||||
* Image merge operations: merge, min/max, overlay, screen, multiply, | * Image merge operations: merge, min/max, overlay, screen, multiply, | ||||
@@ -42,7 +42,7 @@ static image generic_merge(image &src1, image &src2, float alpha) | |||||
typedef typename PixelType<FORMAT>::type pixel_t; | typedef typename PixelType<FORMAT>::type pixel_t; | ||||
ASSERT(src1.size() == src2.size()); | |||||
assert(src1.size() == src2.size()); | |||||
int const count = src1.size().x * src2.size().y; | int const count = src1.size().x * src2.size().y; | ||||
image dst(src1.size()); | image dst(src1.size()); | ||||
@@ -11,11 +11,11 @@ | |||||
// | // | ||||
#include <lol/engine-internal.h> | #include <lol/engine-internal.h> | ||||
#include <../legacy/lol/base/assert.h> | |||||
#include "image-private.h" | #include "image-private.h" | ||||
#include <algorithm> /* for std::swap */ | |||||
#include <cassert> // assert | |||||
#include <algorithm> // std::swap | |||||
namespace lol | namespace lol | ||||
{ | { | ||||
@@ -65,7 +65,7 @@ image::~image() | |||||
void image::Copy(uint8_t* src_pixels, ivec2 const& size, PixelFormat fmt) | void image::Copy(uint8_t* src_pixels, ivec2 const& size, PixelFormat fmt) | ||||
{ | { | ||||
ASSERT(fmt != PixelFormat::Unknown); | |||||
assert(fmt != PixelFormat::Unknown); | |||||
resize(size); | resize(size); | ||||
set_format(fmt); | set_format(fmt); | ||||
memcpy(m_data->m_pixels[(int)fmt]->data(), src_pixels, | memcpy(m_data->m_pixels[(int)fmt]->data(), src_pixels, | ||||
@@ -125,8 +125,8 @@ ivec2 image::size() const | |||||
void image::resize(ivec2 size) | void image::resize(ivec2 size) | ||||
{ | { | ||||
ASSERT(size.x > 0); | |||||
ASSERT(size.y > 0); | |||||
assert(size.x > 0); | |||||
assert(size.y > 0); | |||||
if (m_data->m_size != size) | if (m_data->m_size != size) | ||||
{ | { | ||||
@@ -175,8 +175,8 @@ void *image::lock2d_helper(PixelFormat T) | |||||
template<typename T> | template<typename T> | ||||
void image::unlock2d(array2d<T> const &array) | void image::unlock2d(array2d<T> const &array) | ||||
{ | { | ||||
ASSERT(has_key(m_data->m_pixels, (int)m_data->m_format)); | |||||
ASSERT(array.data() == m_data->m_pixels[(int)m_data->m_format]->data()); | |||||
assert(has_key(m_data->m_pixels, (int)m_data->m_format)); | |||||
assert(array.data() == m_data->m_pixels[(int)m_data->m_format]->data()); | |||||
} | } | ||||
/* Explicit specialisations for the above templates */ | /* Explicit specialisations for the above templates */ | ||||
@@ -195,15 +195,15 @@ _T(PixelFormat::RGBA_F32) | |||||
/* Special case for the "any" format: return the last active buffer */ | /* Special case for the "any" format: return the last active buffer */ | ||||
void *image::lock() | void *image::lock() | ||||
{ | { | ||||
ASSERT(m_data->m_format != PixelFormat::Unknown); | |||||
assert(m_data->m_format != PixelFormat::Unknown); | |||||
return m_data->m_pixels[(int)m_data->m_format]->data(); | return m_data->m_pixels[(int)m_data->m_format]->data(); | ||||
} | } | ||||
void image::unlock(void const *pixels) | void image::unlock(void const *pixels) | ||||
{ | { | ||||
ASSERT(has_key(m_data->m_pixels, (int)m_data->m_format)); | |||||
ASSERT(pixels == m_data->m_pixels[(int)m_data->m_format]->data()); | |||||
assert(has_key(m_data->m_pixels, (int)m_data->m_format)); | |||||
assert(pixels == m_data->m_pixels[(int)m_data->m_format]->data()); | |||||
} | } | ||||
} /* namespace lol */ | } /* namespace lol */ | ||||
@@ -11,9 +11,10 @@ | |||||
// | // | ||||
#include <lol/engine-internal.h> | #include <lol/engine-internal.h> | ||||
#include <../legacy/lol/base/assert.h> | |||||
#include <lol/image/movie.h> | #include <lol/image/movie.h> | ||||
#include <lol/msg> | |||||
#if LOL_USE_FFMPEG | #if LOL_USE_FFMPEG | ||||
extern "C" | extern "C" | ||||
{ | { | ||||
@@ -57,14 +58,14 @@ movie::movie(ivec2 size) | |||||
{ | { | ||||
#if LOL_USE_FFMPEG | #if LOL_USE_FFMPEG | ||||
m_frame = av_frame_alloc(); | m_frame = av_frame_alloc(); | ||||
ASSERT(m_frame); | |||||
assert(m_frame); | |||||
m_frame->format = AV_PIX_FMT_RGB8; // 3:3:2 packed for GIF | m_frame->format = AV_PIX_FMT_RGB8; // 3:3:2 packed for GIF | ||||
m_frame->width = m_size.x; | m_frame->width = m_size.x; | ||||
m_frame->height = m_size.y; | m_frame->height = m_size.y; | ||||
int ret = av_frame_get_buffer(m_frame, 32); | int ret = av_frame_get_buffer(m_frame, 32); | ||||
ASSERT(ret >= 0); | |||||
assert(ret >= 0); | |||||
#endif | #endif | ||||
} | } | ||||
@@ -11,7 +11,9 @@ | |||||
// | // | ||||
#include <lol/engine-internal.h> | #include <lol/engine-internal.h> | ||||
#include <../legacy/lol/base/assert.h> | |||||
#include <lol/msg> | |||||
#include <cassert> | |||||
#include "image-private.h" | #include "image-private.h" | ||||
@@ -129,8 +131,6 @@ void image::set_format(PixelFormat fmt) | |||||
#endif | #endif | ||||
switch (fmt) | switch (fmt) | ||||
{ | { | ||||
case PixelFormat::Unknown: | |||||
break; | |||||
case PixelFormat::Y_8: | case PixelFormat::Y_8: | ||||
data = new PixelData<PixelFormat::Y_8>(isize); break; | data = new PixelData<PixelFormat::Y_8>(isize); break; | ||||
case PixelFormat::RGB_8: | case PixelFormat::RGB_8: | ||||
@@ -143,11 +143,15 @@ void image::set_format(PixelFormat fmt) | |||||
data = new PixelData<PixelFormat::RGB_F32>(isize); break; | data = new PixelData<PixelFormat::RGB_F32>(isize); break; | ||||
case PixelFormat::RGBA_F32: | case PixelFormat::RGBA_F32: | ||||
data = new PixelData<PixelFormat::RGBA_F32>(isize); break; | data = new PixelData<PixelFormat::RGBA_F32>(isize); break; | ||||
case PixelFormat::Unknown: | |||||
default: | |||||
msg::error("invalid pixel type %d", (int)fmt); | |||||
assert(false); | |||||
break; | |||||
} | } | ||||
#if __GNUC__ | #if __GNUC__ | ||||
#pragma GCC diagnostic pop | #pragma GCC diagnostic pop | ||||
#endif | #endif | ||||
ASSERT(data, "invalid pixel type %d", (int)fmt); | |||||
m_data->m_pixels[(int)fmt] = data; | m_data->m_pixels[(int)fmt] = data; | ||||
} | } | ||||
@@ -346,8 +350,8 @@ void image::set_format(PixelFormat fmt) | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
ASSERT(false, "Unable to find image conversion from %d to %d", | |||||
(int)old_fmt, (int)fmt); | |||||
msg::error("Unable to find image conversion from %d to %d", | |||||
(int)old_fmt, (int)fmt); | |||||
} | } | ||||
} | } | ||||
@@ -17,6 +17,49 @@ | |||||
// ------------- | // ------------- | ||||
// | // | ||||
#define LOL_CALL(macro, args) macro args | |||||
#define LOL_EVAL(a) a | |||||
#define LOL_1ST(a, ...) a | |||||
#define LOL_GET_63RD(a01, a02, a03, a04, a05, a06, a07, a08, a09, a10, \ | |||||
a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, \ | |||||
a21, a22, a23, a24, a25, a26, a27, a28, a29, a30, \ | |||||
a31, a32, a33, a34, a35, a36, a37, a38, a39, a40, \ | |||||
a41, a42, a43, a44, a45, a46, a47, a48, a49, a50, \ | |||||
a51, a52, a53, a54, a55, a56, a57, a58, a59, a60, \ | |||||
a61, a62, a63, ...) a63 | |||||
#define LOL_COUNT_TO_3(...) \ | |||||
LOL_EVAL(LOL_GET_63RD(__VA_ARGS__, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, \ | |||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, \ | |||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, \ | |||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, \ | |||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, \ | |||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, \ | |||||
2, 1, TOO_FEW_ARGUMENTS)) | |||||
#define LOL_COUNT_TO_8(...) \ | |||||
LOL_EVAL(LOL_GET_63RD(__VA_ARGS__, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, \ | |||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, \ | |||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, \ | |||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, \ | |||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, \ | |||||
8, 8, 8, 8, 8, 7, 6, 5, 4, 3, \ | |||||
2, 1, TOO_FEW_ARGUMENTS)) | |||||
#define LOL_COUNT_TO_12(...) \ | |||||
LOL_EVAL(LOL_GET_63RD(__VA_ARGS__, 12,12,12,12,12,12,12,12,12,12,\ | |||||
12,12,12,12,12,12,12,12,12,12,\ | |||||
12,12,12,12,12,12,12,12,12,12,\ | |||||
12,12,12,12,12,12,12,12,12,12,\ | |||||
12,12,12,12,12,12,12,12,12,12,\ | |||||
12,11,10,9, 8, 7, 6, 5, 4, 3, \ | |||||
2, 1, TOO_FEW_ARGUMENTS)) | |||||
// Three levels of dispatch are needed because of Visual Studio's bizarre | |||||
// handling of __VA_ARGS__ inside macro calls | |||||
#define LOL_CAT3(a, b) a##b | |||||
#define LOL_CAT2(a, b) LOL_CAT3(a,b) | |||||
#define LOL_CAT(a, b) LOL_CAT2(a,b) | |||||
// Lua | // Lua | ||||
#include <lol/../lolua/baselua.h> | #include <lol/../lolua/baselua.h> | ||||
#include <lol/../easymesh/easymeshlua.h> | #include <lol/../easymesh/easymeshlua.h> | ||||
@@ -14,6 +14,8 @@ | |||||
#include <lol/engine-internal.h> | #include <lol/engine-internal.h> | ||||
#include <lol/lua.h> | #include <lol/lua.h> | ||||
#include <lol/msg> | |||||
#include <cassert> | |||||
#include <string> | #include <string> | ||||
#include <cstdlib> | #include <cstdlib> | ||||
#include <cctype> | #include <cctype> | ||||
@@ -35,7 +37,7 @@ class LuaBaseData | |||||
{ | { | ||||
char const *message = lua_tostring(l, -1); | char const *message = lua_tostring(l, -1); | ||||
msg::error("%s\n", message); | msg::error("%s\n", message); | ||||
debug::abort(); | |||||
assert(false); | |||||
return 0; | return 0; | ||||
} | } | ||||
@@ -19,8 +19,7 @@ extern "C" { | |||||
#include "3rdparty/lua/lauxlib.h" | #include "3rdparty/lua/lauxlib.h" | ||||
} | } | ||||
#include <../legacy/lol/base/assert.h> | |||||
#include <cassert> // assert | |||||
#include <vector> // std::vector | #include <vector> // std::vector | ||||
#include <string> // std::string | #include <string> // std::string | ||||
#include <cstdlib> // tolower | #include <cstdlib> // tolower | ||||
@@ -115,10 +114,10 @@ public: | |||||
virtual ~Object() { } | virtual ~Object() { } | ||||
static Object* New(lua_State*, int) | static Object* New(lua_State*, int) | ||||
{ | { | ||||
ASSERT(false); | |||||
assert(false); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
static const Library* GetLib() { ASSERT(false); return nullptr; } | |||||
static const Library* GetLib() { assert(false); return nullptr; } | |||||
}; | }; | ||||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||
@@ -200,7 +199,7 @@ private: | |||||
static const Object::Library* GetLibrary() | static const Object::Library* GetLibrary() | ||||
{ | { | ||||
const Object::Library* lib = TLuaClass::GetLib(); | const Object::Library* lib = TLuaClass::GetLib(); | ||||
ASSERT(lib); | |||||
assert(lib); | |||||
return lib; | return lib; | ||||
} | } | ||||
@@ -243,17 +242,17 @@ protected: | |||||
template <typename TLuaClass> static int Store(lua_State * l); | template <typename TLuaClass> static int Store(lua_State * l); | ||||
template <typename TLuaClass> static int Del(lua_State * l); | template <typename TLuaClass> static int Del(lua_State * l); | ||||
//------------------------------------------------------------------------- | //------------------------------------------------------------------------- | ||||
template <typename TLuaClass> static int ToString(lua_State*) { ASSERT(false); return 0; } | |||||
template <typename TLuaClass> static int OpAdd(lua_State*) { ASSERT(false); return 0; } | |||||
template <typename TLuaClass> static int OpSubstract(lua_State*) { ASSERT(false); return 0; } | |||||
template <typename TLuaClass> static int OpMultiply(lua_State*) { ASSERT(false); return 0; } | |||||
template <typename TLuaClass> static int OpDivide(lua_State*) { ASSERT(false); return 0; } | |||||
template <typename TLuaClass> static int OpModulo(lua_State*) { ASSERT(false); return 0; } | |||||
template <typename TLuaClass> static int OpUnaryNeg(lua_State*) { ASSERT(false); return 0; } | |||||
template <typename TLuaClass> static int OpConcat(lua_State*) { ASSERT(false); return 0; } | |||||
template <typename TLuaClass> static int CmpEqual(lua_State*) { ASSERT(false); return 0; } | |||||
template <typename TLuaClass> static int CmpLessThan(lua_State*) { ASSERT(false); return 0; } | |||||
template <typename TLuaClass> static int CmpLessEqual(lua_State*) { ASSERT(false); return 0; } | |||||
template <typename TLuaClass> static int ToString(lua_State*) { assert(false); return 0; } | |||||
template <typename TLuaClass> static int OpAdd(lua_State*) { assert(false); return 0; } | |||||
template <typename TLuaClass> static int OpSubstract(lua_State*) { assert(false); return 0; } | |||||
template <typename TLuaClass> static int OpMultiply(lua_State*) { assert(false); return 0; } | |||||
template <typename TLuaClass> static int OpDivide(lua_State*) { assert(false); return 0; } | |||||
template <typename TLuaClass> static int OpModulo(lua_State*) { assert(false); return 0; } | |||||
template <typename TLuaClass> static int OpUnaryNeg(lua_State*) { assert(false); return 0; } | |||||
template <typename TLuaClass> static int OpConcat(lua_State*) { assert(false); return 0; } | |||||
template <typename TLuaClass> static int CmpEqual(lua_State*) { assert(false); return 0; } | |||||
template <typename TLuaClass> static int CmpLessThan(lua_State*) { assert(false); return 0; } | |||||
template <typename TLuaClass> static int CmpLessEqual(lua_State*) { assert(false); return 0; } | |||||
}; | }; | ||||
//----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||
@@ -338,7 +337,7 @@ private: | |||||
bool is_nil = lua_isnil(m_state, m_index); | bool is_nil = lua_isnil(m_state, m_index); | ||||
if (!is_optional || (!is_nil && value_validity)) | if (!is_optional || (!is_nil && value_validity)) | ||||
{ | { | ||||
ASSERT(!is_nil); /* touky: should it assert, though ? */ | |||||
assert(!is_nil); /* touky: should it assert, though ? */ | |||||
return true; | return true; | ||||
} | } | ||||
return false; | return false; | ||||
@@ -384,9 +383,9 @@ protected: | |||||
//------------------------------------------------------------------------- | //------------------------------------------------------------------------- | ||||
#define INNER_ERROR "Your type is not implemented. For pointers, use LuaPtr<MyType>()" | #define INNER_ERROR "Your type is not implemented. For pointers, use LuaPtr<MyType>()" | ||||
template<typename T> T InnerDefault() { return T(0); } | template<typename T> T InnerDefault() { return T(0); } | ||||
template<typename T> bool InnerIsValid() { ASSERT(false, INNER_ERROR); return false; } | |||||
template<typename T> T InnerGet(T) { ASSERT(false, INNER_ERROR); return InnerDefault<T>(); } | |||||
template<typename T> int InnerPush(T) { ASSERT(false, INNER_ERROR); return 0; } | |||||
template<typename T> bool InnerIsValid() { msg::error("%s\n", INNER_ERROR); assert(false); return false; } | |||||
template<typename T> T InnerGet(T) { msg::error("%s\n", INNER_ERROR); assert(false); return InnerDefault<T>(); } | |||||
template<typename T> int InnerPush(T) { msg::error("%s\n", INNER_ERROR); assert(false); return 0; } | |||||
#ifndef INNER_SAFE_ENUM | #ifndef INNER_SAFE_ENUM | ||||
// Gets the value for the given enum type. | // Gets the value for the given enum type. | ||||
@@ -639,7 +638,7 @@ int ObjectHelper::Store(lua_State * l) | |||||
{ | { | ||||
auto stack = Lolua::Stack::Begin(l); | auto stack = Lolua::Stack::Begin(l); | ||||
TLuaClass* obj = stack.GetPtr<TLuaClass>(); | TLuaClass* obj = stack.GetPtr<TLuaClass>(); | ||||
ASSERT(obj); | |||||
assert(obj); | |||||
Loader::StoreObject(l, obj); | Loader::StoreObject(l, obj); | ||||
return 0; | return 0; | ||||
} | } | ||||
@@ -649,7 +648,7 @@ int ObjectHelper::Del(lua_State * l) | |||||
{ | { | ||||
auto stack = Lolua::Stack::Begin(l); | auto stack = Lolua::Stack::Begin(l); | ||||
TLuaClass* obj = stack.GetPtr<TLuaClass>(); | TLuaClass* obj = stack.GetPtr<TLuaClass>(); | ||||
ASSERT(obj); | |||||
assert(obj); | |||||
delete obj; | delete obj; | ||||
return 0; | return 0; | ||||
} | } | ||||
@@ -11,8 +11,8 @@ | |||||
// | // | ||||
#include <lol/engine-internal.h> | #include <lol/engine-internal.h> | ||||
#include <../legacy/lol/base/assert.h> | |||||
#include <lol/msg> // lol::msg | |||||
#include <memory> // std::shared_ptr | #include <memory> // std::shared_ptr | ||||
#include <tuple> // std::make_tuple | #include <tuple> // std::make_tuple | ||||
#include <cstring> | #include <cstring> | ||||
@@ -12,11 +12,12 @@ | |||||
// | // | ||||
#include <lol/engine-internal.h> | #include <lol/engine-internal.h> | ||||
#include <../legacy/lol/base/assert.h> | |||||
#include <map> | |||||
#include <vector> | |||||
#include <array> | |||||
#include <lol/msg> // lol::msg | |||||
#include <cassert> // assert | |||||
#include <map> // std::map | |||||
#include <vector> // std::vector | |||||
#include <array> // std::array | |||||
#include <cstdlib> | #include <cstdlib> | ||||
#if defined(_WIN32) | #if defined(_WIN32) | ||||
@@ -120,7 +121,9 @@ Scene::Scene(ivec2 size) | |||||
m_renderer(std::make_shared<Renderer>(size)) | m_renderer(std::make_shared<Renderer>(size)) | ||||
{ | { | ||||
/* TODO: FIX THAT */ | /* TODO: FIX THAT */ | ||||
ASSERT(!(g_used_id & ((uint64_t)1 << 63)), "Too many scenes !!!!"); | |||||
if (g_used_id & ((uint64_t)1 << 63)) | |||||
msg::error("too many scenes!\n"); | |||||
m_mask_id = g_used_id; | m_mask_id = g_used_id; | ||||
g_used_id = g_used_id << 1; | g_used_id = g_used_id << 1; | ||||
@@ -249,7 +252,7 @@ void Scene::PopCamera(Camera *cam) | |||||
} | } | ||||
} | } | ||||
ASSERT(false, "trying to pop a nonexistent camera from the scene"); | |||||
msg::error("trying to pop a nonexistent camera from the scene\n"); | |||||
} | } | ||||
void Scene::SetTileCam(int cam_idx) | void Scene::SetTileCam(int cam_idx) | ||||
@@ -300,8 +303,8 @@ int Scene::AddPrimitiveSource(uintptr_t key, std::shared_ptr<PrimitiveSource> so | |||||
void Scene::SetPrimitiveSource(int index, uintptr_t key, std::shared_ptr<PrimitiveSource> source) | void Scene::SetPrimitiveSource(int index, uintptr_t key, std::shared_ptr<PrimitiveSource> source) | ||||
{ | { | ||||
ASSERT(source); | |||||
ASSERT(index >= 0); | |||||
assert(source); | |||||
assert(index >= 0); | |||||
// Keep reference to old source until AFTER we release the lock | // Keep reference to old source until AFTER we release the lock | ||||
std::shared_ptr<PrimitiveSource> old; | std::shared_ptr<PrimitiveSource> old; | ||||
@@ -322,7 +325,7 @@ void Scene::ReleasePrimitiveSource(int index, uintptr_t key) | |||||
std::shared_ptr<PrimitiveSource> old; | std::shared_ptr<PrimitiveSource> old; | ||||
g_prim_mutex.lock(); | g_prim_mutex.lock(); | ||||
{ | { | ||||
ASSERT(0 <= index && index < int(g_prim_sources[key].size())); | |||||
assert(0 <= index && index < int(g_prim_sources[key].size())); | |||||
old = g_prim_sources[key][index]; | old = g_prim_sources[key][index]; | ||||
remove_at(g_prim_sources[key], index); | remove_at(g_prim_sources[key], index); | ||||
} | } | ||||
@@ -361,8 +364,8 @@ void Scene::AddPrimitiveRenderer(uintptr_t key, std::shared_ptr<PrimitiveRendere | |||||
void Scene::SetPrimitiveRenderer(int index, uintptr_t key, std::shared_ptr<PrimitiveRenderer> renderer) | void Scene::SetPrimitiveRenderer(int index, uintptr_t key, std::shared_ptr<PrimitiveRenderer> renderer) | ||||
{ | { | ||||
ASSERT(renderer); | |||||
ASSERT(index >= 0); | |||||
assert(renderer); | |||||
assert(index >= 0); | |||||
if (index >= int(m_prim_renderers[key].size())) | if (index >= int(m_prim_renderers[key].size())) | ||||
m_prim_renderers[key].resize(index + 1); | m_prim_renderers[key].resize(index + 1); | ||||
@@ -381,7 +384,7 @@ void Scene::ReleaseAllPrimitiveRenderers(uintptr_t key) | |||||
void Scene::AddTile(TileSet *tileset, int id, vec3 pos, vec2 scale, float radians) | void Scene::AddTile(TileSet *tileset, int id, vec3 pos, vec2 scale, float radians) | ||||
{ | { | ||||
ASSERT(id < tileset->GetTileCount()); | |||||
assert(id < tileset->GetTileCount()); | |||||
ivec2 size = tileset->GetTileSize(id); | ivec2 size = tileset->GetTileSize(id); | ||||
mat4 model = mat4::translate(pos) | mat4 model = mat4::translate(pos) | ||||
@@ -395,7 +398,7 @@ void Scene::AddTile(TileSet *tileset, int id, vec3 pos, vec2 scale, float radian | |||||
void Scene::AddTile(TileSet *tileset, int id, mat4 model) | void Scene::AddTile(TileSet *tileset, int id, mat4 model) | ||||
{ | { | ||||
ASSERT(id < tileset->GetTileCount()); | |||||
assert(id < tileset->GetTileCount()); | |||||
Tile t; | Tile t; | ||||
t.m_model = model; | t.m_model = model; | ||||
@@ -445,7 +448,7 @@ void Scene::EnableDisplay() | |||||
void Scene::DisableDisplay() | void Scene::DisableDisplay() | ||||
{ | { | ||||
ASSERT(m_display); | |||||
assert(m_display); | |||||
m_display->Disable(); | m_display->Disable(); | ||||
} | } | ||||
@@ -13,6 +13,7 @@ | |||||
#include <lol/engine-internal.h> | #include <lol/engine-internal.h> | ||||
#if __ANDROID__ | #if __ANDROID__ | ||||
# include <cassert> | |||||
# include <sys/types.h> | # include <sys/types.h> | ||||
# include <android/asset_manager_jni.h> | # include <android/asset_manager_jni.h> | ||||
#endif | #endif | ||||
@@ -69,7 +70,7 @@ class FileData | |||||
{ | { | ||||
m_type = (force_binary) ? (StreamType::FileBinary) : (StreamType::File); | m_type = (force_binary) ? (StreamType::FileBinary) : (StreamType::File); | ||||
#if __ANDROID__ | #if __ANDROID__ | ||||
ASSERT(g_assets); | |||||
assert(g_assets); | |||||
m_asset = AAssetManager_open(g_assets, file.c_str(), AASSET_MODE_UNKNOWN); | m_asset = AAssetManager_open(g_assets, file.c_str(), AASSET_MODE_UNKNOWN); | ||||
#elif HAVE_STDIO_H | #elif HAVE_STDIO_H | ||||
/* FIXME: no modes, no error checking, no nothing */ | /* FIXME: no modes, no error checking, no nothing */ | ||||
@@ -12,8 +12,8 @@ | |||||
// | // | ||||
#include <lol/engine-internal.h> | #include <lol/engine-internal.h> | ||||
#include <../legacy/lol/base/assert.h> | |||||
#include <cassert> | |||||
#include <cstdio> | #include <cstdio> | ||||
#include <string> | #include <string> | ||||
@@ -260,7 +260,7 @@ bool gui::init_draw() | |||||
{ | { | ||||
// Create shader | // Create shader | ||||
m_shader = Shader::Create(m_builder.GetName(), m_builder.Build()); | m_shader = Shader::Create(m_builder.GetName(), m_builder.Build()); | ||||
ASSERT(m_shader); | |||||
assert(m_shader); | |||||
m_ortho.m_uniform = m_shader->GetUniformLocation(m_ortho.m_var.tostring()); | m_ortho.m_uniform = m_shader->GetUniformLocation(m_ortho.m_var.tostring()); | ||||
m_texture.m_uniform = m_shader->GetUniformLocation(m_texture.m_var.tostring()); | m_texture.m_uniform = m_shader->GetUniformLocation(m_texture.m_var.tostring()); | ||||
@@ -54,7 +54,6 @@ au Syntax cpp | |||||
" Global keywords | " Global keywords | ||||
au Syntax cpp | au Syntax cpp | ||||
\ syn keyword cConstant | \ syn keyword cConstant | ||||
\ UNUSED ASSERT | |||||
""" | """ | ||||