Apply anisotropic filter only when hitting "Apply"

Making the anisotropic filter value only be applied after hitting Apply
in the video menu will make it more natural for the Vulkan renderer to
restart itself when a new anisotropic value is selected, paving the way
to use the actual anisotropic filtering value in Vulkan.
This commit is contained in:
Ricardo Garcia 2021-03-21 00:06:22 +01:00
parent 15e9c5499d
commit 6f8949fd95

View file

@ -136,21 +136,6 @@ FOVCallback(void *s) {
Cvar_SetValue("fov", slider->curvalue);
}
static void
AnisotropicCallback(void *s)
{
menulist_s *list = (menulist_s *)s;
if (list->curvalue == 0)
{
Cvar_SetValue("r_anisotropic", 0);
}
else
{
Cvar_SetValue("r_anisotropic", pow(2, list->curvalue));
}
}
static void
ResetDefaults(void *unused)
{
@ -258,6 +243,24 @@ ApplyChanges(void *unused)
restart = true;
}
/* anisotropic filtering */
if (s_af_list.curvalue == 0)
{
if (gl_anisotropic->value != 0)
{
Cvar_SetValue("r_anisotropic", 0);
restart = true;
}
}
else
{
if (gl_anisotropic->value != pow(2, s_af_list.curvalue))
{
Cvar_SetValue("r_anisotropic", pow(2, s_af_list.curvalue));
restart = true;
}
}
/* multisample anti-aliasing */
if (s_msaa_list.curvalue == 0)
{
@ -536,7 +539,6 @@ VID_MenuInit(void)
s_af_list.generic.name = "aniso filtering";
s_af_list.generic.x = 0;
s_af_list.generic.y = (y += 10);
s_af_list.generic.callback = AnisotropicCallback;
s_af_list.itemnames = pow2_names;
s_af_list.curvalue = 0;
if (gl_anisotropic->value)