From 9b8ef5ac74f7df86c38e6bf46a352cc6d0041e86 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Mon, 28 Nov 2022 08:13:31 +0100 Subject: [PATCH] gfx/util: Rename debug to util(ity) They may be useful for debugging, but they are still utilities. --- CMakeLists.txt | 4 +-- source/filters/filter-autoframing.cpp | 2 +- source/filters/filter-autoframing.hpp | 4 +-- source/gfx/{gfx-debug.cpp => gfx-util.cpp} | 26 +++++++++---------- source/gfx/{gfx-debug.hpp => gfx-util.hpp} | 8 +++--- .../gfx/shader/gfx-shader-param-texture.cpp | 2 +- 6 files changed, 23 insertions(+), 23 deletions(-) rename source/gfx/{gfx-debug.cpp => gfx-util.cpp} (89%) rename source/gfx/{gfx-debug.hpp => gfx-util.hpp} (95%) diff --git a/CMakeLists.txt b/CMakeLists.txt index ea01073..2db60dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1046,8 +1046,8 @@ list(APPEND PROJECT_PRIVATE_SOURCE "source/util/util-platform.cpp" "source/util/util-threadpool.cpp" "source/util/util-threadpool.hpp" - "source/gfx/gfx-debug.hpp" - "source/gfx/gfx-debug.cpp" + "source/gfx/gfx-util.hpp" + "source/gfx/gfx-util.cpp" "source/gfx/gfx-opengl.hpp" "source/gfx/gfx-opengl.cpp" "source/gfx/gfx-source-texture.hpp" diff --git a/source/filters/filter-autoframing.cpp b/source/filters/filter-autoframing.cpp index ab54daf..1ca393a 100644 --- a/source/filters/filter-autoframing.cpp +++ b/source/filters/filter-autoframing.cpp @@ -201,7 +201,7 @@ autoframing_instance::autoframing_instance(obs_data_t* data, obs_source_t* self) ::streamfx::obs::gs::context gctx; // Get debug renderer. - _gfx_debug = ::streamfx::gfx::debug::get(); + _gfx_debug = ::streamfx::gfx::util::get(); // Create the render target for the input buffering. _input = std::make_shared<::streamfx::obs::gs::rendertarget>(GS_RGBA_UNORM, GS_ZS_NONE); diff --git a/source/filters/filter-autoframing.hpp b/source/filters/filter-autoframing.hpp index a4aa508..478f9c0 100644 --- a/source/filters/filter-autoframing.hpp +++ b/source/filters/filter-autoframing.hpp @@ -18,7 +18,7 @@ */ #pragma once -#include "gfx/gfx-debug.hpp" +#include "gfx/gfx-util.hpp" #include "obs/gs/gs-rendertarget.hpp" #include "obs/gs/gs-texture.hpp" #include "obs/gs/gs-vertexbuffer.hpp" @@ -85,7 +85,7 @@ namespace streamfx::filter::autoframing { std::pair _size; std::pair _out_size; - std::shared_ptr<::streamfx::gfx::debug> _gfx_debug; + std::shared_ptr<::streamfx::gfx::util> _gfx_debug; std::shared_ptr<::streamfx::obs::gs::effect> _standard_effect; std::shared_ptr<::streamfx::obs::gs::rendertarget> _input; std::shared_ptr<::streamfx::obs::gs::vertex_buffer> _vb; diff --git a/source/gfx/gfx-debug.cpp b/source/gfx/gfx-util.cpp similarity index 89% rename from source/gfx/gfx-debug.cpp rename to source/gfx/gfx-util.cpp index 9c174b2..6e66b0c 100644 --- a/source/gfx/gfx-debug.cpp +++ b/source/gfx/gfx-util.cpp @@ -18,7 +18,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -#include "gfx-debug.hpp" +#include "gfx-util.hpp" #include "graphics/matrix4.h" #include "obs/gs/gs-helper.hpp" #include "plugin.hpp" @@ -42,21 +42,21 @@ #define D_LOG_DEBUG(...) P_LOG_DEBUG(ST_PREFIX __VA_ARGS__) #endif -std::shared_ptr streamfx::gfx::debug::get() +std::shared_ptr streamfx::gfx::util::get() { - static std::weak_ptr instance; - static std::mutex lock; + static std::weak_ptr instance; + static std::mutex lock; std::unique_lock ul(lock); if (instance.expired()) { - auto hard_instance = std::shared_ptr(new streamfx::gfx::debug()); + auto hard_instance = std::shared_ptr(new streamfx::gfx::util()); instance = hard_instance; return hard_instance; } return instance.lock(); } -streamfx::gfx::debug::debug() +streamfx::gfx::util::util() { { std::filesystem::path file = ::streamfx::data_file_path("effects/standard.effect"); @@ -68,7 +68,7 @@ streamfx::gfx::debug::debug() } } -streamfx::gfx::debug::~debug() +streamfx::gfx::util::~util() { obs::gs::context gctx{}; @@ -78,7 +78,7 @@ streamfx::gfx::debug::~debug() _quad_vb.reset(); } -void streamfx::gfx::debug::draw_point(float x, float y, uint32_t color) +void streamfx::gfx::util::draw_point(float x, float y, uint32_t color) { obs::gs::context gctx{}; @@ -100,7 +100,7 @@ void streamfx::gfx::debug::draw_point(float x, float y, uint32_t color) gs_load_vertexbuffer(nullptr); } -void streamfx::gfx::debug::draw_line(float x, float y, float x2, float y2, uint32_t color /*= 0xFFFFFFFF*/) +void streamfx::gfx::util::draw_line(float x, float y, float x2, float y2, uint32_t color /*= 0xFFFFFFFF*/) { obs::gs::context gctx{}; @@ -127,8 +127,8 @@ void streamfx::gfx::debug::draw_line(float x, float y, float x2, float y2, uint3 gs_load_vertexbuffer(nullptr); } -void streamfx::gfx::debug::draw_arrow(float x, float y, float x2, float y2, float w /*= 0.*/, - uint32_t color /*= 0xFFFFFFFF*/) +void streamfx::gfx::util::draw_arrow(float x, float y, float x2, float y2, float w /*= 0.*/, + uint32_t color /*= 0xFFFFFFFF*/) { obs::gs::context gctx{}; @@ -195,8 +195,8 @@ void streamfx::gfx::debug::draw_arrow(float x, float y, float x2, float y2, floa gs_load_vertexbuffer(nullptr); } -void streamfx::gfx::debug::draw_rectangle(float x, float y, float w, float h, bool frame, - uint32_t color /*= 0xFFFFFFFF*/) +void streamfx::gfx::util::draw_rectangle(float x, float y, float w, float h, bool frame, + uint32_t color /*= 0xFFFFFFFF*/) { obs::gs::context gctx{}; diff --git a/source/gfx/gfx-debug.hpp b/source/gfx/gfx-util.hpp similarity index 95% rename from source/gfx/gfx-debug.hpp rename to source/gfx/gfx-util.hpp index 0476c05..5291099 100644 --- a/source/gfx/gfx-debug.hpp +++ b/source/gfx/gfx-util.hpp @@ -26,7 +26,7 @@ #include "warning-enable.hpp" namespace streamfx::gfx { - class debug { + class util { std::shared_ptr<::streamfx::obs::gs::effect> _effect; std::shared_ptr<::streamfx::obs::gs::vertex_buffer> _point_vb; std::shared_ptr<::streamfx::obs::gs::vertex_buffer> _line_vb; @@ -34,13 +34,13 @@ namespace streamfx::gfx { std::shared_ptr<::streamfx::obs::gs::vertex_buffer> _quad_vb; public /* Singleton */: - static std::shared_ptr get(); + static std::shared_ptr get(); private: - debug(); + util(); public: - ~debug(); + ~util(); void draw_point(float x, float y, uint32_t color = 0xFFFFFFFF); diff --git a/source/gfx/shader/gfx-shader-param-texture.cpp b/source/gfx/shader/gfx-shader-param-texture.cpp index c16f5b8..3640f00 100644 --- a/source/gfx/shader/gfx-shader-param-texture.cpp +++ b/source/gfx/shader/gfx-shader-param-texture.cpp @@ -18,7 +18,7 @@ #include "gfx-shader-param-texture.hpp" #include "strings.hpp" #include "gfx-shader.hpp" -#include "gfx/gfx-debug.hpp" +#include "gfx/gfx-util.hpp" #include "obs/gs/gs-helper.hpp" #include "obs/obs-source-tracker.hpp" #include "util/util-platform.hpp"