wip ogl stuff

win-gl
flightlessmango 3 years ago
parent dc7bb0fdf4
commit a4adde7d93

File diff suppressed because it is too large Load Diff

@ -63,11 +63,12 @@ void writeFile(string filename){
#endif
std::ofstream out(filename, ios::out | ios::app);
if (out){
printf("creating log file\n");
out << "v1" << endl;
out << MANGOHUD_VERSION << endl;
out << "---------------------SYSTEM INFO---------------------" << endl;
out << "os," << "cpu," << "gpu," << "ram," << "kernel," << "driver," << "cpu_governor," << "Wine/Proton," << "sync," << "renderer," << "cpu_scheduler" << endl;
out << os << "," << cpu << "," << gpu << "," << ram << "," << kernel << "," << driver << "," << cpu_governor << "," << wineVersion << "," << HUDElements.sync << "," << HUDElements.sw_stats->engineName<< "," << HUDElements.cpu_sched << endl;
// out << os << "," << cpu << "," << gpu << "," << ram << "," << kernel << "," << driver << "," << cpu_governor << "," << wineVersion << "," << HUDElements.sync << "," << HUDElements.sw_stats->engineName << "," << HUDElements.cpu_sched << endl;
out << "--------------------FRAME METRICS--------------------" << endl;
out << "fps," << "frametime," << "cpu_load," << "gpu_load," << "cpu_temp," << "gpu_temp," << "gpu_core_clock," << "gpu_mem_clock," << "gpu_vram_used," << "gpu_power," << "ram_used," << "current_watt,";
for (auto &item : logArray.back().custom_data){
@ -152,6 +153,7 @@ Logger::Logger(overlay_params* in_params)
void Logger::start_logging() {
if(m_logging_on) return;
printf("started logging\n");
m_values_valid = false;
m_logging_on = true;
m_log_start = Clock::now();
@ -168,9 +170,9 @@ void Logger::start_logging() {
currentLogFile << os << "," << cpu << "," << gpu << "," << ram << "," << kernel << "," << driver << "," << cpu_governor << "," << wineVersion << "," << HUDElements.sync << "," << HUDElements.sw_stats->engineName << HUDElements.cpu_sched << endl;
currentLogFile << "--------------------FRAME METRICS--------------------" << endl;
currentLogFile << "fps," << "frametime," << "cpu_load," << "gpu_load," << "cpu_temp," << "gpu_temp," << "gpu_core_clock," << "gpu_mem_clock," << "gpu_vram_used," << "gpu_power," << "ram_used," << "current_watt,";
for (size_t i = 0; i < cpuStats.GetCPUData().size(); i++){
currentLogFile << "cpu" + to_string(i) + ",";
}
// for (size_t i = 0; i < cpuStats.GetCPUData().size(); i++){
// currentLogFile << "cpu" + to_string(i) + ",";
// }
currentLogFile << "elapsed" << endl;
}
printf("Wrote info to log file\n");
@ -184,6 +186,7 @@ void Logger::stop_logging() {
if(!m_logging_on) return;
m_logging_on = false;
m_log_end = Clock::now();
printf("stopped logging\n");
std::thread(calculate_benchmark_data, m_params).detach();

@ -31,8 +31,10 @@ void impl::d3d11::init()
{
printf("init d3d11\n");
auto ret = kiero::bind(8, (void**)&oPresent, reinterpret_cast<void *>(hkPresent11));
assert(ret == kiero::Status::Success);
init_d3d_shared();
if(ret != kiero::Status::Success)
printf("not dx11\n");
else
init_d3d_shared();
}
#endif // KIERO_INCLUDE_D3D11

@ -18,6 +18,8 @@ void impl::d3d12::init()
{
printf("init d3d12\n");
auto ret = kiero::bind(140, (void**)&oPresentD3D12, reinterpret_cast<void*>(hkPresent12));
assert(ret == kiero::Status::Success);
init_d3d_shared();
if(ret != kiero::Status::Success)
printf("not dx12\n");
else
init_d3d_shared();
}

@ -15,7 +15,7 @@ void init_d3d_shared(){
return;
parse_overlay_config(&params, getenv("MANGOHUD_CONFIG"));
cfg_inited = true;
// init_cpu_stats(params);
init_cpu_stats(params);
}
void d3d_run(){

@ -16,6 +16,7 @@
#if KIERO_INCLUDE_D3D11
# include <dxgi.h>
# include <d3d11.h>
# include "d3d11_hook.h"
#endif
#if KIERO_INCLUDE_D3D12
@ -25,6 +26,7 @@
#else
#include "/usr/include/wine/windows/d3d12.h"
#endif
# include "d3d12_hook.h"
#endif
#if KIERO_INCLUDE_OPENGL
@ -363,7 +365,8 @@ kiero::Status::Enum kiero::init(RenderType::Enum _renderType)
::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
g_renderType = RenderType::D3D11;
impl::d3d11::init();
return Status::Success;
#endif
}
@ -513,6 +516,7 @@ kiero::Status::Enum kiero::init(RenderType::Enum _renderType)
::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
g_renderType = RenderType::D3D12;
impl::d3d12::init();
return Status::Success;
#endif
}

@ -42,13 +42,14 @@ void renderTypes() {
{
render_types.push_back(kiero::RenderType::D3D11);
}
if (::GetModuleHandle(KIERO_TEXT("d3d12.dll")) != NULL)
if (::GetModuleHandle(KIERO_TEXT("D3D12.dll")) != NULL)
{
render_types.push_back(kiero::RenderType::D3D12);
}
if (::GetModuleHandle(KIERO_TEXT("opengl32.dll")) != NULL)
{
render_types.push_back(kiero::RenderType::OpenGL);
}
for (auto& _type : render_types)
kiero::init(_type);
@ -59,12 +60,9 @@ int MainThread()
ConsoleSetup();
printf("MangoHud Attached!\n");
renderTypes();
init_ogl();
if (!render_types.empty()){
impl::d3d11::init();
impl::d3d12::init();
if (!render_types.empty())
return 1;
}
return 0;
}

@ -3,17 +3,21 @@
#include <assert.h>
#include "windows.h"
#include <GL/gl.h>
#include "d3d_shared.h"
BOOL __stdcall (*owglSwapBuffers)(HDC hDc);
BOOL __stdcall hwglSwapBuffers(HDC hDc)
{
printf("swapbuffer\n");
d3d_run();
return owglSwapBuffers(hDc);
}
void init_ogl(){
printf("init ogl\n");
auto ret = kiero::bind(336, (void**)&owglSwapBuffers, reinterpret_cast<void *>(hwglSwapBuffers));
assert(ret == kiero::Status::Success);
if(ret != kiero::Status::Success)
printf("not opengl\n");
else
init_d3d_shared();
}
Loading…
Cancel
Save