From de29e057de26560ea17a7c2e24a434a4efd273f2 Mon Sep 17 00:00:00 2001 From: FlightlessMango Date: Sat, 1 Apr 2023 20:48:02 +0200 Subject: [PATCH] Trilinear filtering param --- README.md | 1 + src/overlay_params.cpp | 2 ++ src/overlay_params.h | 1 + src/vulkan.cpp | 6 ++++++ 4 files changed, 10 insertions(+) diff --git a/README.md b/README.md index 56b99696..845ca859 100644 --- a/README.md +++ b/README.md @@ -380,6 +380,7 @@ Parameters that are enabled by default have to be explicitly disabled. These (cu | `wine` | Shows current Wine or Proton version in use | | `picmip` | Mip-map LoD bias. Negative values will increase texture sharpness (and aliasing). Positive values will increase texture blurriness (-16 to 16) | | `af` | Anisotropic filtering level. Improves sharpness of textures viewed at an angle (0 to 16) | +| `trilinear` | Force trilinear filtering | Example: `MANGOHUD_CONFIG=cpu_temp,gpu_temp,position=top-right,height=500,font_size=32` Because comma is also used as option delimiter and needs to be escaped for values with a backslash, you can use `+` like `MANGOHUD_CONFIG=fps_limit=60+30+0` instead. diff --git a/src/overlay_params.cpp b/src/overlay_params.cpp index daf32515..28ac8b58 100644 --- a/src/overlay_params.cpp +++ b/src/overlay_params.cpp @@ -552,6 +552,7 @@ parse_overlay_env(struct overlay_params *params, params->enabled[OVERLAY_PARAM_ENABLED_log_versioning] = 0; params->enabled[OVERLAY_PARAM_ENABLED_hud_compact] = 0; params->enabled[OVERLAY_PARAM_ENABLED_exec_name] = 0; + params->enabled[OVERLAY_PARAM_ENABLED_trilinear] = 0; } #define OVERLAY_PARAM_BOOL(name) \ if (!strcmp(#name, key)) { \ @@ -707,6 +708,7 @@ parse_overlay_config(struct overlay_params *params, params->enabled[OVERLAY_PARAM_ENABLED_log_versioning] = 0; params->enabled[OVERLAY_PARAM_ENABLED_hud_compact] = 0; params->enabled[OVERLAY_PARAM_ENABLED_exec_name] = 0; + params->enabled[OVERLAY_PARAM_ENABLED_trilinear] = 0; params->options.erase("full"); } for (auto& it : params->options) { diff --git a/src/overlay_params.h b/src/overlay_params.h index 654cf578..c697ba79 100644 --- a/src/overlay_params.h +++ b/src/overlay_params.h @@ -91,6 +91,7 @@ typedef unsigned long KeySym; OVERLAY_PARAM_BOOL(battery_watt) \ OVERLAY_PARAM_BOOL(battery_time) \ OVERLAY_PARAM_BOOL(exec_name) \ + OVERLAY_PARAM_BOOL(trilinear) \ OVERLAY_PARAM_CUSTOM(fps_sampling_period) \ OVERLAY_PARAM_CUSTOM(output_folder) \ OVERLAY_PARAM_CUSTOM(output_file) \ diff --git a/src/vulkan.cpp b/src/vulkan.cpp index 13f9fbb3..d04e3d33 100644 --- a/src/vulkan.cpp +++ b/src/vulkan.cpp @@ -1948,6 +1948,12 @@ static VkResult overlay_CreateSampler( } else if (params->af == 0) sampler.anisotropyEnable = VK_FALSE; + if (params->enabled[OVERLAY_PARAM_ENABLED_trilinear]){ + sampler.magFilter = VK_FILTER_LINEAR; + sampler.minFilter = VK_FILTER_LINEAR; + sampler.mipmapMode = VK_SAMPLER_MIPMAP_MODE_LINEAR; + } + struct device_data *device_data = FIND(struct device_data, device); VkResult result = device_data->vtable.CreateSampler(device, &sampler, pAllocator, pSampler);