Add support for debug groups in OpenGL and Vulkan

This commit is contained in:
Jack Andersen
2019-07-20 22:41:07 -10:00
parent deefc8e995
commit ae5d7e5131
8 changed files with 174 additions and 76 deletions

View File

@@ -12,6 +12,7 @@
#include <condition_variable>
#include <queue>
#include "boo/graphicsdev/IGraphicsDataFactory.hpp"
#include "boo/graphicsdev/IGraphicsCommandQueue.hpp"
#include "../Common.hpp"
namespace boo {
@@ -268,4 +269,27 @@ public:
}
};
#ifdef BOO_GRAPHICS_DEBUG_GROUPS
template <typename CommandQueue>
class GraphicsDebugGroup {
/* Stack only */
void* operator new(size_t);
void operator delete(void*);
void* operator new[](size_t);
void operator delete[](void*);
CommandQueue* m_q;
public:
explicit GraphicsDebugGroup(CommandQueue* q, const char* name,
const std::array<float, 4>& color = {1.f, 1.f, 1.f, 1.f}) : m_q(q) {
m_q->pushDebugGroup(name, color);
}
~GraphicsDebugGroup() {
m_q->popDebugGroup();
}
};
#define SCOPED_GRAPHICS_DEBUG_GROUP(...) GraphicsDebugGroup _GfxDbg_(__VA_ARGS__);
#else
#define SCOPED_GRAPHICS_DEBUG_GROUP(...)
#endif
} // namespace boo