mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-24 04:15:11 +00:00
gs-helper: Add class for managed debug markers
This commit is contained in:
parent
9b0ea98243
commit
90cdc30ef1
2 changed files with 33 additions and 0 deletions
|
@ -28,3 +28,27 @@ gs::context::~context()
|
|||
{
|
||||
obs_leave_graphics();
|
||||
}
|
||||
|
||||
gs::debug_marker::debug_marker(const float color[4], std::string name) : _name(name)
|
||||
{
|
||||
gs_debug_marker_begin(color, _name.c_str());
|
||||
}
|
||||
|
||||
gs::debug_marker::debug_marker(const float color[4], std::string format, ...)
|
||||
{
|
||||
size_t size;
|
||||
std::vector<char> buffer(64);
|
||||
|
||||
va_list vargs;
|
||||
va_start(vargs, format);
|
||||
size = vsnprintf(buffer.data(), buffer.size(), format.c_str(), vargs);
|
||||
va_end(vargs);
|
||||
|
||||
_name = std::string(buffer.data(), buffer.data() + size);
|
||||
gs_debug_marker_begin(color, _name.c_str());
|
||||
}
|
||||
|
||||
gs::debug_marker::~debug_marker()
|
||||
{
|
||||
gs_debug_marker_end();
|
||||
}
|
||||
|
|
|
@ -37,4 +37,13 @@ namespace gs {
|
|||
context();
|
||||
~context();
|
||||
};
|
||||
|
||||
class debug_marker {
|
||||
std::string _name;
|
||||
|
||||
public:
|
||||
debug_marker(const float color[4], std::string name);
|
||||
debug_marker(const float color[4], std::string format, ...);
|
||||
~debug_marker();
|
||||
};
|
||||
} // namespace gs
|
||||
|
|
Loading…
Reference in a new issue