Skip to content

Commit 4b2e78a

Browse files
committed
vulkan: make sure to parse config before checking parameters
1 parent 070fa1b commit 4b2e78a

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/vulkan.cpp

+15-8
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ using namespace std;
5656
float offset_x, offset_y, hudSpacing;
5757
int hudFirstRow, hudSecondRow;
5858
VkPhysicalDeviceDriverProperties driverProps = {};
59+
overlay_params params {};
5960

6061
#if !defined(_WIN32)
6162
namespace MangoHud { namespace GL {
@@ -1938,29 +1939,35 @@ static VkResult overlay_CreateSampler(
19381939
const VkAllocationCallbacks* pAllocator,
19391940
VkSampler* pSampler)
19401941
{
1941-
auto params = HUDElements.params;
1942+
1943+
parse_overlay_config(&params, getenv("MANGOHUD_CONFIG"));
1944+
_params = &params;
1945+
19421946
VkSamplerCreateInfo sampler = *pCreateInfo;
1943-
sampler.mipLodBias = params->picmip;
1947+
sampler.mipLodBias = params.picmip;
19441948

1945-
if (params->af > 0){
1949+
if (params.af > 0){
19461950
sampler.anisotropyEnable = VK_TRUE;
1947-
sampler.maxAnisotropy = params->af;
1948-
} else if (params->af == 0)
1951+
sampler.maxAnisotropy = params.af;
1952+
} else if (params.af == 0)
19491953
sampler.anisotropyEnable = VK_FALSE;
19501954

1951-
if (params->enabled[OVERLAY_PARAM_ENABLED_trilinear]){
1955+
if (params.enabled[OVERLAY_PARAM_ENABLED_trilinear]){
1956+
std::cerr << "USING trillear\n";
19521957
sampler.magFilter = VK_FILTER_LINEAR;
19531958
sampler.minFilter = VK_FILTER_LINEAR;
19541959
sampler.mipmapMode = VK_SAMPLER_MIPMAP_MODE_LINEAR;
19551960
}
19561961

1957-
if (params->enabled[OVERLAY_PARAM_ENABLED_bicubic]){
1962+
if (params.enabled[OVERLAY_PARAM_ENABLED_bicubic]){
1963+
std::cerr << "USING bicubic\n";
19581964
sampler.magFilter = VK_FILTER_CUBIC_IMG;
19591965
sampler.minFilter = VK_FILTER_CUBIC_IMG;
19601966
sampler.mipmapMode = VK_SAMPLER_MIPMAP_MODE_LINEAR;
19611967
}
19621968

1963-
if (params->enabled[OVERLAY_PARAM_ENABLED_retro]){
1969+
if (params.enabled[OVERLAY_PARAM_ENABLED_retro]){
1970+
std::cerr << "USING retro\n";
19641971
sampler.magFilter = VK_FILTER_NEAREST;
19651972
sampler.minFilter = VK_FILTER_NEAREST;
19661973
sampler.mipmapMode = VK_SAMPLER_MIPMAP_MODE_NEAREST;

0 commit comments

Comments
 (0)