diff --git a/README.md b/README.md index 57ddf2c0..56b99696 100644 --- a/README.md +++ b/README.md @@ -379,6 +379,7 @@ Parameters that are enabled by default have to be explicitly disabled. These (cu | `wine_color` | Change color of the wine/proton text | | `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) | 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 14ef2197..daf32515 100644 --- a/src/overlay_params.cpp +++ b/src/overlay_params.cpp @@ -420,6 +420,7 @@ parse_gl_size_query(const char *str) #define parse_fcat_overlay_width(s) parse_unsigned(s) #define parse_fcat_screen_edge(s) parse_unsigned(s) #define parse_picmip(s) parse_signed(s) +#define parse_af(s) parse_signed(s) #define parse_cpu_color(s) parse_color(s) #define parse_gpu_color(s) parse_color(s) @@ -647,6 +648,7 @@ parse_overlay_config(struct overlay_params *params, params->battery_color =0xff9078; params->fsr_steam_sharpness = -1; params->picmip = 0; + params->af = -1; #ifdef HAVE_X11 params->toggle_hud = { XK_Shift_R, XK_F12 }; diff --git a/src/overlay_params.h b/src/overlay_params.h index de60a16e..654cf578 100644 --- a/src/overlay_params.h +++ b/src/overlay_params.h @@ -165,6 +165,7 @@ typedef unsigned long KeySym; OVERLAY_PARAM_CUSTOM(fcat_screen_edge) \ OVERLAY_PARAM_CUSTOM(fcat_overlay_width) \ OVERLAY_PARAM_CUSTOM(picmip) \ + OVERLAY_PARAM_CUSTOM(af) \ enum overlay_param_position { LAYER_POSITION_TOP_LEFT, @@ -278,7 +279,7 @@ struct overlay_params { unsigned short fcat_screen_edge; unsigned short fcat_overlay_width; int picmip; - + int af; size_t font_params_hash; }; diff --git a/src/vulkan.cpp b/src/vulkan.cpp index 6bba89ab..13f9fbb3 100644 --- a/src/vulkan.cpp +++ b/src/vulkan.cpp @@ -1938,8 +1938,15 @@ static VkResult overlay_CreateSampler( const VkAllocationCallbacks* pAllocator, VkSampler* pSampler) { + auto params = HUDElements.params; VkSamplerCreateInfo sampler = *pCreateInfo; - sampler.mipLodBias = HUDElements.params->picmip; + sampler.mipLodBias = params->picmip; + + if (params->af > 0){ + sampler.anisotropyEnable = VK_TRUE; + sampler.maxAnisotropy = params->af; + } else if (params->af == 0) + sampler.anisotropyEnable = VK_FALSE; struct device_data *device_data = FIND(struct device_data, device); VkResult result = device_data->vtable.CreateSampler(device, &sampler, pAllocator, pSampler);