gfx/util: Rename debug to util(ity)

They may be useful for debugging, but they are still utilities.
This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2022-11-28 08:13:31 +01:00
parent c18c5e457a
commit 9b8ef5ac74
6 changed files with 23 additions and 23 deletions

View File

@ -1046,8 +1046,8 @@ list(APPEND PROJECT_PRIVATE_SOURCE
"source/util/util-platform.cpp" "source/util/util-platform.cpp"
"source/util/util-threadpool.cpp" "source/util/util-threadpool.cpp"
"source/util/util-threadpool.hpp" "source/util/util-threadpool.hpp"
"source/gfx/gfx-debug.hpp" "source/gfx/gfx-util.hpp"
"source/gfx/gfx-debug.cpp" "source/gfx/gfx-util.cpp"
"source/gfx/gfx-opengl.hpp" "source/gfx/gfx-opengl.hpp"
"source/gfx/gfx-opengl.cpp" "source/gfx/gfx-opengl.cpp"
"source/gfx/gfx-source-texture.hpp" "source/gfx/gfx-source-texture.hpp"

View File

@ -201,7 +201,7 @@ autoframing_instance::autoframing_instance(obs_data_t* data, obs_source_t* self)
::streamfx::obs::gs::context gctx; ::streamfx::obs::gs::context gctx;
// Get debug renderer. // Get debug renderer.
_gfx_debug = ::streamfx::gfx::debug::get(); _gfx_debug = ::streamfx::gfx::util::get();
// Create the render target for the input buffering. // Create the render target for the input buffering.
_input = std::make_shared<::streamfx::obs::gs::rendertarget>(GS_RGBA_UNORM, GS_ZS_NONE); _input = std::make_shared<::streamfx::obs::gs::rendertarget>(GS_RGBA_UNORM, GS_ZS_NONE);

View File

@ -18,7 +18,7 @@
*/ */
#pragma once #pragma once
#include "gfx/gfx-debug.hpp" #include "gfx/gfx-util.hpp"
#include "obs/gs/gs-rendertarget.hpp" #include "obs/gs/gs-rendertarget.hpp"
#include "obs/gs/gs-texture.hpp" #include "obs/gs/gs-texture.hpp"
#include "obs/gs/gs-vertexbuffer.hpp" #include "obs/gs/gs-vertexbuffer.hpp"
@ -85,7 +85,7 @@ namespace streamfx::filter::autoframing {
std::pair<uint32_t, uint32_t> _size; std::pair<uint32_t, uint32_t> _size;
std::pair<uint32_t, uint32_t> _out_size; std::pair<uint32_t, uint32_t> _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::effect> _standard_effect;
std::shared_ptr<::streamfx::obs::gs::rendertarget> _input; std::shared_ptr<::streamfx::obs::gs::rendertarget> _input;
std::shared_ptr<::streamfx::obs::gs::vertex_buffer> _vb; std::shared_ptr<::streamfx::obs::gs::vertex_buffer> _vb;

View File

@ -18,7 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE. // SOFTWARE.
#include "gfx-debug.hpp" #include "gfx-util.hpp"
#include "graphics/matrix4.h" #include "graphics/matrix4.h"
#include "obs/gs/gs-helper.hpp" #include "obs/gs/gs-helper.hpp"
#include "plugin.hpp" #include "plugin.hpp"
@ -42,21 +42,21 @@
#define D_LOG_DEBUG(...) P_LOG_DEBUG(ST_PREFIX __VA_ARGS__) #define D_LOG_DEBUG(...) P_LOG_DEBUG(ST_PREFIX __VA_ARGS__)
#endif #endif
std::shared_ptr<streamfx::gfx::debug> streamfx::gfx::debug::get() std::shared_ptr<streamfx::gfx::util> streamfx::gfx::util::get()
{ {
static std::weak_ptr<streamfx::gfx::debug> instance; static std::weak_ptr<streamfx::gfx::util> instance;
static std::mutex lock; static std::mutex lock;
std::unique_lock<std::mutex> ul(lock); std::unique_lock<std::mutex> ul(lock);
if (instance.expired()) { if (instance.expired()) {
auto hard_instance = std::shared_ptr<streamfx::gfx::debug>(new streamfx::gfx::debug()); auto hard_instance = std::shared_ptr<streamfx::gfx::util>(new streamfx::gfx::util());
instance = hard_instance; instance = hard_instance;
return hard_instance; return hard_instance;
} }
return instance.lock(); return instance.lock();
} }
streamfx::gfx::debug::debug() streamfx::gfx::util::util()
{ {
{ {
std::filesystem::path file = ::streamfx::data_file_path("effects/standard.effect"); 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{}; obs::gs::context gctx{};
@ -78,7 +78,7 @@ streamfx::gfx::debug::~debug()
_quad_vb.reset(); _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{}; 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); 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{}; 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); gs_load_vertexbuffer(nullptr);
} }
void streamfx::gfx::debug::draw_arrow(float x, float y, float x2, float y2, float w /*= 0.*/, void streamfx::gfx::util::draw_arrow(float x, float y, float x2, float y2, float w /*= 0.*/,
uint32_t color /*= 0xFFFFFFFF*/) uint32_t color /*= 0xFFFFFFFF*/)
{ {
obs::gs::context gctx{}; 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); gs_load_vertexbuffer(nullptr);
} }
void streamfx::gfx::debug::draw_rectangle(float x, float y, float w, float h, bool frame, void streamfx::gfx::util::draw_rectangle(float x, float y, float w, float h, bool frame,
uint32_t color /*= 0xFFFFFFFF*/) uint32_t color /*= 0xFFFFFFFF*/)
{ {
obs::gs::context gctx{}; obs::gs::context gctx{};

View File

@ -26,7 +26,7 @@
#include "warning-enable.hpp" #include "warning-enable.hpp"
namespace streamfx::gfx { namespace streamfx::gfx {
class debug { class util {
std::shared_ptr<::streamfx::obs::gs::effect> _effect; 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> _point_vb;
std::shared_ptr<::streamfx::obs::gs::vertex_buffer> _line_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; std::shared_ptr<::streamfx::obs::gs::vertex_buffer> _quad_vb;
public /* Singleton */: public /* Singleton */:
static std::shared_ptr<streamfx::gfx::debug> get(); static std::shared_ptr<streamfx::gfx::util> get();
private: private:
debug(); util();
public: public:
~debug(); ~util();
void draw_point(float x, float y, uint32_t color = 0xFFFFFFFF); void draw_point(float x, float y, uint32_t color = 0xFFFFFFFF);

View File

@ -18,7 +18,7 @@
#include "gfx-shader-param-texture.hpp" #include "gfx-shader-param-texture.hpp"
#include "strings.hpp" #include "strings.hpp"
#include "gfx-shader.hpp" #include "gfx-shader.hpp"
#include "gfx/gfx-debug.hpp" #include "gfx/gfx-util.hpp"
#include "obs/gs/gs-helper.hpp" #include "obs/gs/gs-helper.hpp"
#include "obs/obs-source-tracker.hpp" #include "obs/obs-source-tracker.hpp"
#include "util/util-platform.hpp" #include "util/util-platform.hpp"