Skip to content

Commit

Permalink
AA off is now vid_fsaa = 0 for compatibility with QuakeSpasm
Browse files Browse the repository at this point in the history
  • Loading branch information
Axel Gneiting committed Jun 10, 2017
1 parent a8cfb9d commit 75bf42e
Showing 1 changed file with 23 additions and 24 deletions.
47 changes: 23 additions & 24 deletions Quake/gl_vidsdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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");
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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));
}
}
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 75bf42e

Please sign in to comment.