From 75bf42e28b23a92c44f6eec0d2cc6c0a02244e60 Mon Sep 17 00:00:00 2001 From: Axel Gneiting Date: Sat, 10 Jun 2017 13:08:48 -0500 Subject: [PATCH] AA off is now vid_fsaa = 0 for compatibility with QuakeSpasm --- Quake/gl_vidsdl.c | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/Quake/gl_vidsdl.c b/Quake/gl_vidsdl.c index 75802d40e..9569161be 100644 --- a/Quake/gl_vidsdl.c +++ b/Quake/gl_vidsdl.c @@ -89,7 +89,7 @@ static cvar_t vid_desktopfullscreen = {"vid_desktopfullscreen", "0", CVAR_ARCHIV static cvar_t vid_borderless = {"vid_borderless", "0", CVAR_ARCHIVE}; // QuakeSpasm cvar_t vid_filter = {"vid_filter", "0", CVAR_ARCHIVE}; cvar_t vid_anisotropic = {"vid_anisotropic", "0", CVAR_ARCHIVE}; -cvar_t vid_fsaa = {"vid_fsaa", "4", CVAR_ARCHIVE}; +cvar_t vid_fsaa = {"vid_fsaa", "0", CVAR_ARCHIVE}; cvar_t vid_fsaamode = { "vid_fsaamode", "0", CVAR_ARCHIVE }; cvar_t vid_gamma = {"gamma", "1", CVAR_ARCHIVE}; //johnfitz -- moved here from view.c @@ -1228,21 +1228,20 @@ static void GL_CreateColorBuffer( void ) vulkan_globals.sample_count = VK_SAMPLE_COUNT_1_BIT; vulkan_globals.supersampling = false; - if (vid_fsaamode.value) { - const int fsaa = CLAMP(2, (int)vid_fsaa.value, 16); + const int fsaa = (int)vid_fsaa.value; VkImageFormatProperties image_format_properties; vkGetPhysicalDeviceImageFormatProperties(vulkan_physical_device, vulkan_globals.color_format, VK_IMAGE_TYPE_2D, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, 0, &image_format_properties); // Workaround: Intel advertises 16 samples but crashes when using it. - if ((fsaa == 16) && (image_format_properties.sampleCounts & VK_SAMPLE_COUNT_16_BIT) && (vulkan_globals.device_properties.vendorID != 0x8086)) + if ((fsaa >= 16) && (image_format_properties.sampleCounts & VK_SAMPLE_COUNT_16_BIT) && (vulkan_globals.device_properties.vendorID != 0x8086)) vulkan_globals.sample_count = VK_SAMPLE_COUNT_16_BIT; else if ((fsaa >= 8) && (image_format_properties.sampleCounts & VK_SAMPLE_COUNT_8_BIT)) vulkan_globals.sample_count = VK_SAMPLE_COUNT_8_BIT; else if ((fsaa >= 4) && (image_format_properties.sampleCounts & VK_SAMPLE_COUNT_4_BIT)) vulkan_globals.sample_count = VK_SAMPLE_COUNT_4_BIT; - else if (image_format_properties.sampleCounts & VK_SAMPLE_COUNT_2_BIT) + else if ((fsaa >= 2) && (image_format_properties.sampleCounts & VK_SAMPLE_COUNT_2_BIT)) vulkan_globals.sample_count = VK_SAMPLE_COUNT_2_BIT; switch(vulkan_globals.sample_count) @@ -1266,7 +1265,7 @@ static void GL_CreateColorBuffer( void ) if (vulkan_globals.sample_count != VK_SAMPLE_COUNT_1_BIT) { - vulkan_globals.supersampling = (vulkan_physical_device_features.sampleRateShading && vid_fsaamode.value >= 2) ? true : false; + vulkan_globals.supersampling = (vulkan_physical_device_features.sampleRateShading && vid_fsaamode.value >= 1) ? true : false; if (vulkan_globals.supersampling) Con_Printf("Supersampling enabled\n"); @@ -2305,8 +2304,8 @@ enum { VID_OPT_BPP, VID_OPT_FULLSCREEN, VID_OPT_VSYNC, - VID_OPT_ANTIALIASING_MODE, VID_OPT_ANTIALIASING_SAMPLES, + VID_OPT_ANTIALIASING_MODE, VID_OPT_FILTER, VID_OPT_ANISOTROPY, VID_OPT_UNDERWATER, @@ -2496,8 +2495,6 @@ VID_Menu_ChooseNextAAMode static void VID_Menu_ChooseNextAAMode(int dir) { if(vulkan_physical_device_features.sampleRateShading) { - Cvar_SetValueQuick(&vid_fsaamode, (float)(((int)vid_fsaamode.value + 3 + dir) % 3)); - } else { Cvar_SetValueQuick(&vid_fsaamode, (float)(((int)vid_fsaamode.value + 2 + dir) % 2)); } } @@ -2524,7 +2521,9 @@ static void VID_Menu_ChooseNextAASamples(int dir) } else { - if (value <= 4) + if (value <= 2) + value = 0; + else if (value <= 4) value = 2; else if (value <= 8) value = 4; @@ -2592,12 +2591,12 @@ static void VID_MenuKey (int key) case VID_OPT_VSYNC: Cbuf_AddText ("toggle vid_vsync\n"); // kristian break; - case VID_OPT_ANTIALIASING_MODE: - VID_Menu_ChooseNextAAMode (-1); - break; case VID_OPT_ANTIALIASING_SAMPLES: VID_Menu_ChooseNextAASamples(-1); break; + case VID_OPT_ANTIALIASING_MODE: + VID_Menu_ChooseNextAAMode (-1); + break; case VID_OPT_FILTER: Cbuf_AddText ("toggle vid_filter\n"); break; @@ -2628,12 +2627,12 @@ static void VID_MenuKey (int key) case VID_OPT_VSYNC: Cbuf_AddText ("toggle vid_vsync\n"); break; - case VID_OPT_ANTIALIASING_MODE: - VID_Menu_ChooseNextAAMode(1); - break; case VID_OPT_ANTIALIASING_SAMPLES: VID_Menu_ChooseNextAASamples(1); break; + case VID_OPT_ANTIALIASING_MODE: + VID_Menu_ChooseNextAAMode(1); + break; case VID_OPT_FILTER: Cbuf_AddText ("toggle vid_filter\n"); break; @@ -2665,12 +2664,12 @@ static void VID_MenuKey (int key) case VID_OPT_VSYNC: Cbuf_AddText ("toggle vid_vsync\n"); break; - case VID_OPT_ANTIALIASING_MODE: - VID_Menu_ChooseNextAAMode(1); - break; case VID_OPT_ANTIALIASING_SAMPLES: VID_Menu_ChooseNextAASamples(1); break; + case VID_OPT_ANTIALIASING_MODE: + VID_Menu_ChooseNextAAMode(1); + break; case VID_OPT_FILTER: Cbuf_AddText ("toggle vid_filter\n"); break; @@ -2749,13 +2748,13 @@ static void VID_MenuDraw (void) M_Print (16, y, " Vertical sync"); M_DrawCheckbox (184, y, (int)vid_vsync.value); break; - case VID_OPT_ANTIALIASING_MODE: + case VID_OPT_ANTIALIASING_SAMPLES: M_Print (16, y, " Antialiasing"); - M_Print (184, y, ((int)vid_fsaamode.value == 0) ? "off" : (((int)vid_fsaamode.value == 1) ? "Multisample" : "Supersample")); + M_Print (184, y, ((int)vid_fsaa.value >= 2) ? va("%ix", CLAMP(2, (int)vid_fsaa.value, 16)) : "off"); break; - case VID_OPT_ANTIALIASING_SAMPLES: - M_Print(16, y, " AA Samples"); - M_Print(184, y, va("%i", CLAMP(2, (int)vid_fsaa.value, 16))); + case VID_OPT_ANTIALIASING_MODE: + M_Print (16, y, " AA Mode"); + M_Print (184, y, ((int)vid_fsaamode.value == 0) ? "Multisample" : "Supersample"); break; case VID_OPT_FILTER: M_Print (16, y, " Filter");