2020-06-29 14:15:50 +00:00
|
|
|
#pragma once
|
2020-07-06 17:31:40 +00:00
|
|
|
#ifndef MANGOHUD_OVERLAY_H
|
|
|
|
#define MANGOHUD_OVERLAY_H
|
2020-06-29 14:15:50 +00:00
|
|
|
|
2020-03-10 05:19:18 +00:00
|
|
|
#include <string>
|
|
|
|
#include <stdint.h>
|
2020-05-16 11:35:50 +00:00
|
|
|
#include <vector>
|
2020-03-10 05:19:18 +00:00
|
|
|
#include "imgui.h"
|
|
|
|
#include "overlay_params.h"
|
|
|
|
#include "iostats.h"
|
2020-06-24 18:14:24 +00:00
|
|
|
#include "timing.hpp"
|
2020-03-10 05:19:18 +00:00
|
|
|
|
|
|
|
struct frame_stat {
|
2020-03-24 19:38:08 +00:00
|
|
|
uint64_t stats[OVERLAY_PLOTS_MAX];
|
2020-03-10 05:19:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct swapchain_stats {
|
|
|
|
uint64_t n_frames;
|
2020-03-24 19:38:08 +00:00
|
|
|
enum overlay_plots stat_selector;
|
2020-03-10 05:19:18 +00:00
|
|
|
double time_dividor;
|
|
|
|
struct frame_stat stats_min, stats_max;
|
|
|
|
struct frame_stat frames_stats[200];
|
|
|
|
|
|
|
|
ImFont* font1 = nullptr;
|
2020-06-29 14:15:50 +00:00
|
|
|
ImFont* font_text = nullptr;
|
2020-03-10 05:19:18 +00:00
|
|
|
std::string time;
|
|
|
|
double fps;
|
|
|
|
struct iostats io;
|
|
|
|
uint64_t last_present_time;
|
|
|
|
unsigned n_frames_since_update;
|
|
|
|
uint64_t last_fps_update;
|
2020-05-16 11:35:50 +00:00
|
|
|
ImVec2 main_window_pos;
|
|
|
|
|
2020-03-16 22:24:04 +00:00
|
|
|
struct {
|
|
|
|
int32_t major;
|
|
|
|
int32_t minor;
|
2020-04-12 13:16:13 +00:00
|
|
|
bool is_gles;
|
2020-03-16 22:24:04 +00:00
|
|
|
} version_gl;
|
|
|
|
struct {
|
|
|
|
int32_t major;
|
|
|
|
int32_t minor;
|
|
|
|
int32_t patch;
|
|
|
|
} version_vk;
|
2020-03-23 14:35:21 +00:00
|
|
|
std::string engineName;
|
|
|
|
std::string engineVersion;
|
2020-04-28 15:05:25 +00:00
|
|
|
std::string deviceName;
|
2020-05-09 23:43:08 +00:00
|
|
|
std::string gpuName;
|
2020-05-10 00:22:44 +00:00
|
|
|
std::string driverName;
|
2020-08-11 19:20:49 +00:00
|
|
|
struct {
|
|
|
|
ImVec4 cpu,
|
|
|
|
gpu,
|
|
|
|
vram,
|
|
|
|
ram,
|
|
|
|
engine,
|
|
|
|
io,
|
|
|
|
frametime,
|
|
|
|
background,
|
|
|
|
text,
|
2020-07-18 19:18:27 +00:00
|
|
|
media_player,
|
|
|
|
wine;
|
2020-08-11 19:20:49 +00:00
|
|
|
} colors;
|
2020-03-10 05:19:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct fps_limit {
|
2020-06-24 18:14:24 +00:00
|
|
|
Clock::time_point frameStart;
|
|
|
|
Clock::time_point frameEnd;
|
|
|
|
Clock::duration targetFrameTime;
|
|
|
|
Clock::duration frameOverhead;
|
|
|
|
Clock::duration sleepTime;
|
2020-03-10 05:19:18 +00:00
|
|
|
};
|
|
|
|
|
2020-05-16 11:35:50 +00:00
|
|
|
struct benchmark_stats {
|
|
|
|
float total;
|
|
|
|
std::vector<float> fps_data;
|
2020-06-18 22:42:25 +00:00
|
|
|
std::vector<std::pair<std::string, float>> percentile_data;
|
2020-05-16 11:35:50 +00:00
|
|
|
};
|
|
|
|
|
2020-03-15 16:09:03 +00:00
|
|
|
extern struct fps_limit fps_limit_stats;
|
2020-05-09 23:36:09 +00:00
|
|
|
extern int32_t deviceID;
|
2020-03-15 16:09:03 +00:00
|
|
|
|
2020-05-16 11:35:50 +00:00
|
|
|
extern struct benchmark_stats benchmark;
|
|
|
|
|
|
|
|
void position_layer(struct swapchain_stats& data, struct overlay_params& params, ImVec2 window_size);
|
2020-03-17 13:00:20 +00:00
|
|
|
void render_imgui(swapchain_stats& data, struct overlay_params& params, ImVec2& window_size, bool is_vulkan);
|
2020-03-10 05:19:18 +00:00
|
|
|
void update_hud_info(struct swapchain_stats& sw_stats, struct overlay_params& params, uint32_t vendorID);
|
2020-09-06 08:30:57 +00:00
|
|
|
void update_hw_info(struct swapchain_stats& sw_stats, struct overlay_params& params, uint32_t vendorID);
|
2020-03-10 05:19:18 +00:00
|
|
|
void init_gpu_stats(uint32_t& vendorID, overlay_params& params);
|
2020-03-14 21:04:02 +00:00
|
|
|
void init_cpu_stats(overlay_params& params);
|
2020-06-21 11:44:12 +00:00
|
|
|
void check_keybinds(struct swapchain_stats& sw_stats, struct overlay_params& params, uint32_t vendorID);
|
2020-03-10 05:19:18 +00:00
|
|
|
void init_system_info(void);
|
|
|
|
void FpsLimiter(struct fps_limit& stats);
|
2020-05-10 12:11:56 +00:00
|
|
|
void get_device_name(int32_t vendorID, int32_t deviceID, struct swapchain_stats& sw_stats);
|
2020-08-02 06:25:04 +00:00
|
|
|
void calculate_benchmark_data(void *params_void);
|
2020-06-29 14:15:50 +00:00
|
|
|
void create_fonts(const overlay_params& params, ImFont*& small_font, ImFont*& text_font);
|
2020-08-11 19:20:49 +00:00
|
|
|
void convert_colors(bool do_conv, struct swapchain_stats& sw_stats, struct overlay_params& params);
|
2020-07-06 17:31:40 +00:00
|
|
|
|
2020-07-18 19:18:27 +00:00
|
|
|
#endif //MANGOHUD_OVERLAY_H
|