summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Lachnit <stephanlachnit@debian.org>2021-07-08 21:55:36 +0200
committerStephan Lachnit <stephanlachnit@debian.org>2021-07-08 21:55:36 +0200
commit0d3158048a7fb792223fde0273429cf2d112c2de (patch)
tree1cdfd04b160cacaf6938f3465275a9d94ea68467
parent233581f6de5b55822a271eef7d80d82219bce7c9 (diff)
New upstream version 0.6.5
-rw-r--r--README.md2
-rwxr-xr-xbuild-srt.sh7
-rwxr-xr-xbuild-with-srt-docker.sh12
-rw-r--r--meson.build2
-rw-r--r--src/font.cpp2
-rw-r--r--src/gl/imgui_hud.cpp35
-rw-r--r--src/gl/imgui_impl_opengl3.cpp15
-rw-r--r--src/hud_elements.cpp2
-rw-r--r--src/overlay.cpp11
-rw-r--r--src/overlay.h39
-rw-r--r--src/overlay_params.cpp4
-rw-r--r--src/overlay_params.h2
-rw-r--r--src/vulkan.cpp40
13 files changed, 99 insertions, 74 deletions
diff --git a/README.md b/README.md
index 91b8f7a..87c4404 100644
--- a/README.md
+++ b/README.md
@@ -162,7 +162,7 @@ Parameters that are enabled by default have to be explicitly disabled. These (cu
| `font_glyph_ranges` | Specify extra font glyph ranges, comma separated: `korean`, `chinese`, `chinese_simplified`, `japanese`, `cyrillic`, `thai`, `vietnamese`, `latin_ext_a`, `latin_ext_b`. If you experience crashes or text is just squares, reduce font size or glyph ranges. |
| `no_small_font` | Use primary font size for smaller text like units |
| `width=`<br>`height=` | Customizeable hud dimensions (in pixels) |
-| `position=` | Location of the hud: `top-left` (default), `top-right`, `bottom-left`, `bottom-right`, `top-center` |
+| `position=` | Location of the hud: `top-left` (default), `top-right`, `middle-left`, `middle-right`, `bottom-left`, `bottom-right`, `top-center` |
| `offset_x` `offset_y` | Hud position offsets |
| `no_display` | Hide the hud by default |
| `toggle_hud=`<br>`toggle_logging=` | Modifiable toggle hotkeys. Default are `Shift_R+F12` and `Shift_L+F2`, respectively. |
diff --git a/build-srt.sh b/build-srt.sh
index 572c0e5..e29821d 100755
--- a/build-srt.sh
+++ b/build-srt.sh
@@ -43,12 +43,9 @@ dependencies() {
if [[ ! -f ./bin/get-pip.py ]]; then
curl https://bootstrap.pypa.io/get-pip.py -o bin/get-pip.py
+ python3 ./bin/get-pip.py
fi
- python3 ./bin/get-pip.py
-
- if [[ $(pip3 show meson >/dev/null; echo $?) == 1 || $(pip3 show mako >/dev/null; echo $?) == 1 ]]; then
- pip3 install meson mako
- fi
+ pip3 install 'meson>=0.54' mako
if [[ ! -f /usr/include/NVCtrl/NVCtrl.h ]]; then
curl -LO http://mirrors.kernel.org/ubuntu/pool/main/n/nvidia-settings/libxnvctrl0_440.64-0ubuntu1_amd64.deb
diff --git a/build-with-srt-docker.sh b/build-with-srt-docker.sh
index b06a86f..80898e1 100755
--- a/build-with-srt-docker.sh
+++ b/build-with-srt-docker.sh
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
+# Usage example: $0 master soldier 0.20210618.0
set -u
if [ $# -eq 2 ]; then
@@ -11,9 +12,12 @@ BRANCH="${1:-master}"
# soldier 0.20201022.1 or newer
# scout 0.20201104.0 or newer
RUNTIME="${2:-soldier}"
-VERSION="${3:-0.20201022.1}"
-IMAGE="steamrt_${RUNTIME}_amd64:mango-${VERSION}"
+VERSION="${3:-0.20210618.0}"
+IMAGE="steamrt_${RUNTIME}_${VERSION}_amd64:mango-${RUNTIME}"
BASEURL="https://repo.steampowered.com/steamrt-images-${RUNTIME}/snapshots/${VERSION}"
+CACHEDIR="./cache/steamrt-images-${RUNTIME}/snapshots/${VERSION}"
+
+mkdir -p "${CACHEDIR}"
echo -e "\e[1mBuilding branch \e[92m${BRANCH}\e[39m using \e[92m${RUNTIME}:${VERSION}\e[39m runtime\e[0m"
@@ -23,8 +27,8 @@ if ! docker inspect --type=image ${IMAGE} 2>&1 >/dev/null ; then
mkdir -p ./cache/empty
sed "s/%RUNTIME%/${RUNTIME}/g" steamrt.Dockerfile.in > ./cache/steamrt.Dockerfile
- wget -P ./cache -c ${BASEURL}/com.valvesoftware.SteamRuntime.Sdk-amd64,i386-${RUNTIME}-sysroot.tar.gz
- cp --reflink=always "./cache/com.valvesoftware.SteamRuntime.Sdk-amd64,i386-${RUNTIME}-sysroot.tar.gz" ./cache/empty/
+ wget -P "${CACHEDIR}" -c ${BASEURL}/com.valvesoftware.SteamRuntime.Sdk-amd64,i386-${RUNTIME}-sysroot.tar.gz
+ cp --reflink=always "${CACHEDIR}/com.valvesoftware.SteamRuntime.Sdk-amd64,i386-${RUNTIME}-sysroot.tar.gz" ./cache/empty/
docker build -f ./cache/steamrt.Dockerfile -t ${IMAGE} ./cache/empty
fi
diff --git a/meson.build b/meson.build
index d3535c2..30a8e1c 100644
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,6 @@
project('MangoHud',
['c', 'cpp'],
- version : 'v0.6.4',
+ version : 'v0.6.5',
license : 'MIT',
default_options : ['buildtype=release', 'c_std=c99', 'cpp_std=c++14']
)
diff --git a/src/font.cpp b/src/font.cpp
index f90c8fb..11bd3be 100644
--- a/src/font.cpp
+++ b/src/font.cpp
@@ -18,7 +18,7 @@ void create_fonts(const overlay_params& params, ImFont*& small_font, ImFont*& te
static const ImWchar default_range[] =
{
0x0020, 0x00FF, // Basic Latin + Latin Supplement
- 0x2019, 0x2019, // RIGHT SINGLE QUOTATION MARK
+ 0x2018, 0x201F, // Bunch of quotation marks
//0x0100, 0x017F, // Latin Extended-A
//0x2103, 0x2103, // Degree Celsius
//0x2109, 0x2109, // Degree Fahrenheit
diff --git a/src/gl/imgui_hud.cpp b/src/gl/imgui_hud.cpp
index 02f3382..bf95945 100644
--- a/src/gl/imgui_hud.cpp
+++ b/src/gl/imgui_hud.cpp
@@ -50,7 +50,7 @@ struct state {
};
static GLVec last_vp {}, last_sb {};
-static swapchain_stats sw_stats {};
+swapchain_stats sw_stats {};
static state state;
static uint32_t vendorID;
static std::string deviceName;
@@ -77,15 +77,29 @@ void imgui_init()
add_blacklist(item);
}
- if (engine != EngineTypes::ZINK){
+ if (sw_stats.engine != EngineTypes::ZINK){
+ sw_stats.engine = OPENGL;
+
+ stringstream ss;
+ string line;
auto pid = getpid();
- string find_wined3d = "lsof -w -lnPX -L -p " + to_string(pid) + " | grep -oh wined3d";
- string ret_wined3d = exec(find_wined3d);
- if (ret_wined3d == "wined3d\n" )
- engine = WINED3D;
- else
- engine = OpenGL;
+ string path = "/proc/" + to_string(pid) + "/map_files/";
+ auto files = exec("ls " + path);
+ ss << files;
+
+ while(std::getline(ss, line, '\n')){
+ auto file = path + line;
+ auto sym = read_symlink(file.c_str());
+ if (sym.find("wined3d") != std::string::npos) {
+ sw_stats.engine = WINED3D;
+ break;
+ } else if (sym.find("libtogl.so") != std::string::npos || sym.find("libtogl_client.so") != std::string::npos) {
+ sw_stats.engine = TOGL;
+ break;
+ }
+ }
}
+
is_blacklisted(true);
notifier.params = &params;
start_notifier(notifier);
@@ -144,11 +158,6 @@ void imgui_create(void *ctx)
ImGui::GetIO().DisplaySize = ImVec2(last_vp[2], last_vp[3]);
ImGui_ImplOpenGL3_Init();
- // Make a dummy GL call (we don't actually need the result)
- // IF YOU GET A CRASH HERE: it probably means that you haven't initialized the OpenGL function loader used by this code.
- // Desktop OpenGL 3/4 need a function loader. See the IMGUI_IMPL_OPENGL_LOADER_xxx explanation above.
- GLint current_texture;
- glGetIntegerv(GL_TEXTURE_BINDING_2D, &current_texture);
create_fonts(params, sw_stats.font1, sw_stats.font_text);
sw_stats.font_params_hash = params.font_params_hash;
diff --git a/src/gl/imgui_impl_opengl3.cpp b/src/gl/imgui_impl_opengl3.cpp
index c1729dd..1a1c734 100644
--- a/src/gl/imgui_impl_opengl3.cpp
+++ b/src/gl/imgui_impl_opengl3.cpp
@@ -78,13 +78,6 @@ namespace MangoHud { namespace GL {
extern overlay_params params;
-// Desktop GL 3.2+ has glDrawElementsBaseVertex() which GL ES and WebGL don't have.
-#if defined(IMGUI_IMPL_OPENGL_ES2) || defined(IMGUI_IMPL_OPENGL_ES3) || !defined(GL_VERSION_3_2)
-#define IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET 0
-#else
-#define IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET 1
-#endif
-
// OpenGL Data
static GLuint g_GlVersion = 0; // Extracted at runtime using GL_MAJOR_VERSION, GL_MINOR_VERSION queries.
static char g_GlslVersionString[32] = ""; // Specified by user or detected based on compile time GL settings.
@@ -400,8 +393,8 @@ void GetOpenGLVersion(int& major, int& minor, bool& isGLES)
if (!version)
return;
- //if (glGetError() == 0x500) {
-
+ //if (glGetError() == 0x500)
+ {
for (int i = 0; prefixes[i]; i++) {
const size_t length = strlen(prefixes[i]);
if (strncmp(version, prefixes[i], length) == 0) {
@@ -412,7 +405,7 @@ void GetOpenGLVersion(int& major, int& minor, bool& isGLES)
}
sscanf(version, "%d.%d", &major, &minor);
- //}
+ }
}
bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
@@ -454,7 +447,7 @@ bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
ImGuiIO& io = ImGui::GetIO();
io.BackendRendererName = "imgui_impl_opengl3";
//#if IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET
- if ((!g_IsGLES && g_GlVersion >= 320) || (g_IsGLES && g_GlVersion >= 320))
+ if (g_GlVersion >= 320) // GL/GLES 3.2+
io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
// Store GLSL version string so we can refer to it later in case we recreate shaders.
diff --git a/src/hud_elements.cpp b/src/hud_elements.cpp
index 51961b6..2425bf7 100644
--- a/src/hud_elements.cpp
+++ b/src/hud_elements.cpp
@@ -348,7 +348,7 @@ void HudElements::ram(){
void HudElements::fps(){
if (HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_fps]){
ImGui::TableNextRow(); ImGui::TableNextColumn();
- ImGui::TextColored(HUDElements.colors.engine, "%s", engines[engine]);
+ ImGui::TextColored(HUDElements.colors.engine, "%s", engines[HUDElements.sw_stats->engine]);
ImGui::TableNextColumn();
if (HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_fps_color_change]){
int fps = int(HUDElements.sw_stats->fps);
diff --git a/src/overlay.cpp b/src/overlay.cpp
index 8a5f554..ebdf0d0 100644
--- a/src/overlay.cpp
+++ b/src/overlay.cpp
@@ -19,8 +19,7 @@ struct benchmark_stats benchmark;
struct fps_limit fps_limit_stats {};
ImVec2 real_font_size;
std::vector<logData> graph_data;
-const char* engines[] = {"Unknown", "OpenGL", "VULKAN", "DXVK", "VKD3D", "DAMAVAND", "ZINK", "WINED3D", "Feral3D"};
-EngineTypes engine = Unknown;
+const char* engines[] = {"Unknown", "OpenGL", "VULKAN", "DXVK", "VKD3D", "DAMAVAND", "ZINK", "WINED3D", "Feral3D", "ToGL"};
void update_hw_info(struct swapchain_stats& sw_stats, struct overlay_params& params, uint32_t vendorID)
{
@@ -191,6 +190,14 @@ void position_layer(struct swapchain_stats& data, struct overlay_params& params,
data.main_window_pos = ImVec2(width - window_size.x - margin + params.offset_x, margin + params.offset_y);
ImGui::SetNextWindowPos(data.main_window_pos, ImGuiCond_Always);
break;
+ case LAYER_POSITION_MIDDLE_LEFT:
+ data.main_window_pos = ImVec2(margin + params.offset_x, height / 2 - window_size.y / 2 - margin + params.offset_y);
+ ImGui::SetNextWindowPos(data.main_window_pos, ImGuiCond_Always);
+ break;
+ case LAYER_POSITION_MIDDLE_RIGHT:
+ data.main_window_pos = ImVec2(width - window_size.x - margin + params.offset_x, height / 2 - window_size.y / 2 - margin + params.offset_y);
+ ImGui::SetNextWindowPos(data.main_window_pos, ImGuiCond_Always);
+ break;
case LAYER_POSITION_BOTTOM_LEFT:
data.main_window_pos = ImVec2(margin + params.offset_x, height - window_size.y - margin + params.offset_y);
ImGui::SetNextWindowPos(data.main_window_pos, ImGuiCond_Always);
diff --git a/src/overlay.h b/src/overlay.h
index 86c5e3e..99c975f 100644
--- a/src/overlay.h
+++ b/src/overlay.h
@@ -21,6 +21,25 @@ struct frame_stat {
uint64_t stats[OVERLAY_PLOTS_MAX];
};
+enum EngineTypes
+{
+ UNKNOWN,
+
+ OPENGL,
+ VULKAN,
+
+ DXVK,
+ VKD3D,
+ DAMAVAND,
+ ZINK,
+
+ WINED3D,
+ FERAL3D,
+ TOGL,
+};
+
+extern const char* engines[];
+
struct swapchain_stats {
uint64_t n_frames;
enum overlay_plots stat_selector;
@@ -54,6 +73,7 @@ struct swapchain_stats {
std::string deviceName;
std::string gpuName;
std::string driverName;
+ enum EngineTypes engine;
};
struct fps_limit {
@@ -78,25 +98,6 @@ struct LOAD_DATA {
unsigned high_load;
};
-enum EngineTypes
-{
- Unknown,
-
- OpenGL,
- Vulkan,
-
- DXVK,
- VKD3D,
- DAMAVAND,
- ZINK,
-
- WINED3D,
- Feral3D
-};
-
-extern const char* engines[];
-extern enum EngineTypes engine;
-
extern struct fps_limit fps_limit_stats;
extern int32_t deviceID;
diff --git a/src/overlay_params.cpp b/src/overlay_params.cpp
index b1fc586..86450fa 100644
--- a/src/overlay_params.cpp
+++ b/src/overlay_params.cpp
@@ -74,6 +74,10 @@ parse_position(const char *str)
return LAYER_POSITION_TOP_LEFT;
if (!strcmp(str, "top-right"))
return LAYER_POSITION_TOP_RIGHT;
+ if (!strcmp(str, "middle-left"))
+ return LAYER_POSITION_MIDDLE_LEFT;
+ if (!strcmp(str, "middle-right"))
+ return LAYER_POSITION_MIDDLE_RIGHT;
if (!strcmp(str, "bottom-left"))
return LAYER_POSITION_BOTTOM_LEFT;
if (!strcmp(str, "bottom-right"))
diff --git a/src/overlay_params.h b/src/overlay_params.h
index 33b5367..4c7663f 100644
--- a/src/overlay_params.h
+++ b/src/overlay_params.h
@@ -143,6 +143,8 @@ typedef unsigned long KeySym;
enum overlay_param_position {
LAYER_POSITION_TOP_LEFT,
LAYER_POSITION_TOP_RIGHT,
+ LAYER_POSITION_MIDDLE_LEFT,
+ LAYER_POSITION_MIDDLE_RIGHT,
LAYER_POSITION_BOTTOM_LEFT,
LAYER_POSITION_BOTTOM_RIGHT,
LAYER_POSITION_TOP_CENTER,
diff --git a/src/vulkan.cpp b/src/vulkan.cpp
index 4781b1c..eadbb40 100644
--- a/src/vulkan.cpp
+++ b/src/vulkan.cpp
@@ -72,6 +72,10 @@ int hudFirstRow, hudSecondRow;
VkPhysicalDeviceDriverProperties driverProps = {};
int32_t deviceID;
+namespace MangoHud { namespace GL {
+ extern swapchain_stats sw_stats;
+}}
+
/* Mapped from VkInstace/VkPhysicalDevice */
struct instance_data {
struct vk_instance_dispatch_table vtable;
@@ -79,6 +83,7 @@ struct instance_data {
struct overlay_params params;
uint32_t api_version;
string engineName, engineVersion;
+ enum EngineTypes engine;
notify_thread notifier;
};
@@ -1781,6 +1786,7 @@ static VkResult overlay_CreateSwapchainKHR(
swapchain_data->sw_stats.version_vk.patch = VK_VERSION_PATCH(prop.apiVersion);
swapchain_data->sw_stats.engineName = device_data->instance->engineName;
swapchain_data->sw_stats.engineVersion = device_data->instance->engineVersion;
+ swapchain_data->sw_stats.engine = device_data->instance->engine;
std::stringstream ss;
// ss << prop.deviceName;
@@ -1801,8 +1807,8 @@ static VkResult overlay_CreateSwapchainKHR(
ss << "." << VK_VERSION_MINOR(prop.driverVersion) + 1;
ss << "." << "0";
} else {
- ss << "." << VK_VERSION_MINOR(prop.driverVersion);
- ss << "." << VK_VERSION_PATCH(prop.driverVersion) + 1;
+ ss << "." << VK_VERSION_MINOR(prop.driverVersion);
+ ss << "." << VK_VERSION_PATCH(prop.driverVersion);
}
}
@@ -2138,6 +2144,7 @@ static VkResult overlay_CreateInstance(
get_instance_chain_info(pCreateInfo, VK_LAYER_LINK_INFO);
std::string engineVersion,engineName;
+ enum EngineTypes engine = EngineTypes::UNKNOWN;
if (!is_blacklisted(true)) {
const char* pEngineName = nullptr;
if (pCreateInfo->pApplicationInfo)
@@ -2149,25 +2156,25 @@ static VkResult overlay_CreateInstance(
engineVersion = to_string(VK_VERSION_MAJOR(engineVer)) + "." + to_string(VK_VERSION_MINOR(engineVer)) + "." + to_string(VK_VERSION_PATCH(engineVer));
}
- if (engine < 1){
- if (engineName == "DXVK")
- engine = DXVK;
+ if (engineName == "DXVK")
+ engine = DXVK;
- else if (engineName == "vkd3d")
- engine = VKD3D;
+ else if (engineName == "vkd3d")
+ engine = VKD3D;
- else if(engineName == "mesa zink")
- engine = ZINK;
+ else if(engineName == "mesa zink") {
+ engine = ZINK;
+ MangoHud::GL::sw_stats.engine = ZINK;
+ }
- else if (engineName == "Damavand")
- engine = DAMAVAND;
+ else if (engineName == "Damavand")
+ engine = DAMAVAND;
- else if (engineName == "Feral3D")
- engine = Feral3D;
+ else if (engineName == "Feral3D")
+ engine = FERAL3D;
- else
- engine = Vulkan;
- }
+ else
+ engine = VULKAN;
}
assert(chain_info->u.pLayerInfo);
@@ -2216,6 +2223,7 @@ static VkResult overlay_CreateInstance(
}
}
+ instance_data->engine = engine;
instance_data->engineName = engineName;
instance_data->engineVersion = engineVersion;
}