Skip to content

Commit

Permalink
Add a debug check in drawbuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Dec 21, 2022
1 parent ff49e4d commit ab869a2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Common/Render/DrawBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include "Common/Log.h"
#include "Common/StringUtils.h"

#include "Common/Math/math_util.h"

DrawBuffer::DrawBuffer() {
verts_ = new Vertex[MAX_VERTS];
fontscalex = 1.0f;
Expand Down Expand Up @@ -85,7 +87,13 @@ void DrawBuffer::Flush(bool set_blend_state) {
}

void DrawBuffer::V(float x, float y, float z, uint32_t color, float u, float v) {
_assert_msg_(count_ < MAX_VERTS, "Overflowed the DrawBuffer");
_dbg_assert_msg_(count_ < MAX_VERTS, "Overflowed the DrawBuffer");

#ifdef _DEBUG
if (my_isnanorinf(x) || my_isnanorinf(y) || my_isnanorinf(z)) {
_assert_(false);
}
#endif

Vertex *vert = &verts_[count_++];
vert->x = x;
Expand Down

0 comments on commit ab869a2

Please sign in to comment.