Skip to content

Commit

Permalink
Revert D63909398: IGL: Update Assert macros so that they always log i…
Browse files Browse the repository at this point in the history
…f logging is enabled

Differential Revision:
D63909398

Original commit changeset: 72ed3b838c92

Original Phabricator Diff: D63909398

fbshipit-source-id: 125d9ce4e64017a3284a2e778d385dd6fddd3912
  • Loading branch information
Kamal Hussain authored and facebook-github-bot committed Oct 8, 2024
1 parent bce689f commit 6bcfa65
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 20 deletions.
2 changes: 0 additions & 2 deletions src/igl/Assert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ void setDebugBreakEnabled(bool enabled) {
#endif

void _IGLDebugBreak() {
#if IGL_DEBUG_BREAK_ENABLED
if (igl::isDebugBreakEnabled()) {
#ifdef IGL_DEBUGGER_SIGTRAP
raise(SIGTRAP);
Expand All @@ -53,7 +52,6 @@ void _IGLDebugBreak() {
#warning "IGLDebugBreak() not implemented on this platform"
#endif
}
#endif // IGL_DEBUG_BREAK_ENABLED
}

// ----------------------------------------------------------------------------
Expand Down
22 changes: 5 additions & 17 deletions src/igl/Assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,6 @@

#include <igl/Log.h>

#if IGL_DEBUG || defined(IGL_FORCE_ENABLE_LOGS)
#define IGL_VERIFY_ENABLED 1
#else
#define IGL_VERIFY_ENABLED 0
#endif

#if IGL_DEBUG
#define IGL_DEBUG_BREAK_ENABLED 1
#else
#define IGL_DEBUG_BREAK_ENABLED 0
#endif

IGL_API void _IGLDebugBreak();

namespace igl {
Expand All @@ -82,22 +70,22 @@ static inline const T& _IGLVerify(const T& cond,
int line,
const char* format,
...) {
#if IGL_VERIFY_ENABLED
if (!cond) {
IGLLog(IGLLogError, "[IGL] %s in '%s' (%s:%d): ", reason, func, file, line);
va_list ap;
va_start(ap, format);
IGLLogV(IGLLogError, format, ap);
va_end(ap);
IGLLog(IGLLogError, IGL_NEWLINE);
_IGLDebugBreak();
if (igl::isDebugBreakEnabled()) {
_IGLDebugBreak();
}
}
#endif // IGL_VERIFY_ENABLED
return cond;
}
} // namespace igl

#if IGL_VERIFY_ENABLED
#if IGL_DEBUG

#define _IGL_DEBUG_ABORT(cond, format, ...) \
(void)::igl::_IGLVerify( \
Expand All @@ -120,7 +108,7 @@ static inline const T& _IGLVerify(const T& cond,
#define _IGL_DEBUG_VERIFY(cond, format, ...) (cond)
#define _IGL_DEBUG_VERIFY_NOT(cond, format, ...) (cond)

#endif // IGL_VERIFY_ENABLED
#endif

#define IGL_DEBUG_ABORT(format, ...) _IGL_DEBUG_ABORT(false, (format), ##__VA_ARGS__)

Expand Down
2 changes: 1 addition & 1 deletion src/igl/opengl/RenderPipelineState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ void RenderPipelineState::unbind() {
// associated with the associated buffer.
// bufferOffset is an offset in bytes to the start of the vertex attributes in the buffer.
void RenderPipelineState::bindVertexAttributes(size_t bufferIndex, size_t bufferOffset) {
#if IGL_VERIFY_ENABLED
#if IGL_DEBUG
static GLint sMaxNumVertexAttribs = 0;
if (0 == sMaxNumVertexAttribs) {
getContext().getIntegerv(GL_MAX_VERTEX_ATTRIBS, &sMaxNumVertexAttribs);
Expand Down

0 comments on commit 6bcfa65

Please sign in to comment.