|
|
@ -22,6 +22,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
namespace fs = ghc::filesystem;
|
|
|
|
namespace fs = ghc::filesystem;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC
|
|
|
|
|
|
|
|
typedef int ( *PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC) (int attribute, unsigned int *value);
|
|
|
|
|
|
|
|
#define GLX_RENDERER_VENDOR_ID_MESA 0x8183
|
|
|
|
|
|
|
|
#define GLX_RENDERER_DEVICE_ID_MESA 0x8184
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern void* get_glx_proc_address(const char* name);
|
|
|
|
|
|
|
|
|
|
|
|
namespace MangoHud { namespace GL {
|
|
|
|
namespace MangoHud { namespace GL {
|
|
|
|
|
|
|
|
|
|
|
|
struct GLVec
|
|
|
|
struct GLVec
|
|
|
@ -67,6 +75,17 @@ overlay_params params {};
|
|
|
|
static std::unique_ptr<notify_thread, std::function<void(notify_thread *)>>
|
|
|
|
static std::unique_ptr<notify_thread, std::function<void(notify_thread *)>>
|
|
|
|
stop_it(¬ifier, [](notify_thread *n){ stop_notifier(*n); });
|
|
|
|
stop_it(¬ifier, [](notify_thread *n){ stop_notifier(*n); });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static bool mesa_queryInteger(int attrib, unsigned int *value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
static PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC queryInteger =
|
|
|
|
|
|
|
|
reinterpret_cast<decltype(queryInteger)>(get_glx_proc_address(
|
|
|
|
|
|
|
|
"glXQueryCurrentRendererIntegerMESA"));
|
|
|
|
|
|
|
|
if (queryInteger)
|
|
|
|
|
|
|
|
return !!queryInteger(attrib, value);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void imgui_init()
|
|
|
|
void imgui_init()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (cfg_inited)
|
|
|
|
if (cfg_inited)
|
|
|
@ -108,7 +127,7 @@ void imgui_init()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//static
|
|
|
|
//static
|
|
|
|
void imgui_create(void *ctx)
|
|
|
|
void imgui_create(void *ctx, const gl_platform plat)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (inited)
|
|
|
|
if (inited)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -137,7 +156,12 @@ void imgui_create(void *ctx)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (deviceName.find("zink") != std::string::npos)
|
|
|
|
if (deviceName.find("zink") != std::string::npos)
|
|
|
|
sw_stats.engine = EngineTypes::ZINK;
|
|
|
|
sw_stats.engine = EngineTypes::ZINK;
|
|
|
|
init_gpu_stats(vendorID, 0, params);
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t device_id = 0;
|
|
|
|
|
|
|
|
if (plat == gl_platform::GLX)
|
|
|
|
|
|
|
|
mesa_queryInteger(GLX_RENDERER_DEVICE_ID_MESA, &device_id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
init_gpu_stats(vendorID, device_id, params);
|
|
|
|
sw_stats.gpuName = gpu = get_device_name(vendorID, deviceID);
|
|
|
|
sw_stats.gpuName = gpu = get_device_name(vendorID, deviceID);
|
|
|
|
SPDLOG_DEBUG("gpu: {}", gpu);
|
|
|
|
SPDLOG_DEBUG("gpu: {}", gpu);
|
|
|
|
// Setup Dear ImGui context
|
|
|
|
// Setup Dear ImGui context
|
|
|
@ -179,11 +203,11 @@ void imgui_shutdown()
|
|
|
|
inited = false;
|
|
|
|
inited = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void imgui_set_context(void *ctx)
|
|
|
|
void imgui_set_context(void *ctx, const gl_platform plat)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!ctx)
|
|
|
|
if (!ctx)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
imgui_create(ctx);
|
|
|
|
imgui_create(ctx, plat);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void imgui_render(unsigned int width, unsigned int height)
|
|
|
|
void imgui_render(unsigned int width, unsigned int height)
|
|
|
|