From ddc46affca195ed8ce01fbc2d9c16ef67e97ffe6 Mon Sep 17 00:00:00 2001 From: Agent X <44549182+Agent-11@users.noreply.github.com> Date: Wed, 3 Apr 2024 19:30:57 -0400 Subject: [PATCH] Remove MSAA --- src/pc/configfile.c | 4 +- src/pc/configfile.h | 1 - src/pc/djui/djui_panel_display.c | 53 -------------------------- src/pc/djui/djui_panel_host_settings.c | 6 +-- src/pc/gfx/gfx_dummy.c | 5 --- src/pc/gfx/gfx_dxgi.cpp | 5 --- src/pc/gfx/gfx_sdl1.c | 5 --- src/pc/gfx/gfx_sdl2.c | 13 ------- src/pc/gfx/gfx_window_manager_api.h | 1 - 9 files changed, 4 insertions(+), 89 deletions(-) diff --git a/src/pc/configfile.c b/src/pc/configfile.c index 63525b84..500172dc 100644 --- a/src/pc/configfile.c +++ b/src/pc/configfile.c @@ -66,8 +66,7 @@ ConfigWindow configWindow = { .reset = false, .fullscreen = false, .exiting_fullscreen = false, - .settings_changed = false, - .msaa = 0, + .settings_changed = false }; unsigned int configFiltering = 2; // 0=force nearest, 1=linear, 2=three-point unsigned int configMasterVolume = 80; // 0 - MAX_VOLUME @@ -177,7 +176,6 @@ static const struct ConfigOption options[] = { {.name = "window_h", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.h}, {.name = "vsync", .type = CONFIG_TYPE_BOOL, .boolValue = &configWindow.vsync}, {.name = "texture_filtering", .type = CONFIG_TYPE_UINT, .uintValue = &configFiltering}, - {.name = "msaa", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.msaa}, {.name = "master_volume", .type = CONFIG_TYPE_UINT, .uintValue = &configMasterVolume}, {.name = "music_volume", .type = CONFIG_TYPE_UINT, .uintValue = &configMusicVolume}, {.name = "sfx_volume", .type = CONFIG_TYPE_UINT, .uintValue = &configSfxVolume}, diff --git a/src/pc/configfile.h b/src/pc/configfile.h index 00aff835..3b496124 100644 --- a/src/pc/configfile.h +++ b/src/pc/configfile.h @@ -25,7 +25,6 @@ typedef struct { bool fullscreen; bool exiting_fullscreen; bool settings_changed; - unsigned int msaa; } ConfigWindow; extern ConfigWindow configWindow; diff --git a/src/pc/djui/djui_panel_display.c b/src/pc/djui/djui_panel_display.c index 5061b3e6..2717cb78 100644 --- a/src/pc/djui/djui_panel_display.c +++ b/src/pc/djui/djui_panel_display.c @@ -6,13 +6,8 @@ #include "pc/utils/misc.h" #include "pc/configfile.h" -#define MSAA_ORIGINAL_UNSET ((u32)-1) - static struct DjuiInputbox* sFrameLimitInput = NULL; static struct DjuiSelectionbox* sInterpolationSelectionBox = NULL; -static struct DjuiText* sRestartText = NULL; -static u32 sMsaaSelection = 0; -static u32 sMsaaOriginal = MSAA_ORIGINAL_UNSET; static void djui_panel_display_apply(UNUSED struct DjuiBase* caller) { configWindow.settings_changed = true; @@ -35,29 +30,9 @@ static void djui_panel_display_frame_limit_text_change(struct DjuiBase* caller) djui_base_set_enabled(&sInterpolationSelectionBox->base, (configFrameLimit > 30 || (configFrameLimit <= 30 && configUncappedFramerate))); } -static void djui_panel_display_msaa_change(UNUSED struct DjuiBase* caller) { - switch (sMsaaSelection) { - case 1: configWindow.msaa = 2; break; - case 2: configWindow.msaa = 4; break; - case 3: configWindow.msaa = 8; break; - case 4: configWindow.msaa = 16; break; - default: configWindow.msaa = 0; break; - } - - if (sMsaaOriginal != configWindow.msaa) { - djui_text_set_text(sRestartText, DLANG(DISPLAY, MUST_RESTART)); - } else { - djui_text_set_text(sRestartText, ""); - } -} - void djui_panel_display_create(struct DjuiBase* caller) { struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(DISPLAY, DISPLAY)); struct DjuiBase* body = djui_three_panel_get_body(panel); - struct DjuiSelectionbox* msaa = NULL; - - // save original msaa value - if (sMsaaOriginal == MSAA_ORIGINAL_UNSET) { sMsaaOriginal = configWindow.msaa; } { djui_checkbox_create(body, DLANG(DISPLAY, FULLSCREEN), &configWindow.fullscreen, djui_panel_display_apply); @@ -99,38 +74,10 @@ void djui_panel_display_create(struct DjuiBase* caller) { char* filterChoices[3] = { DLANG(DISPLAY, NEAREST), DLANG(DISPLAY, LINEAR), DLANG(DISPLAY, TRIPOINT) }; djui_selectionbox_create(body, DLANG(DISPLAY, FILTERING), filterChoices, 3, &configFiltering, NULL); - int maxMsaa = wm_api->get_max_msaa(); - if (maxMsaa >= 2) { - if (configWindow.msaa >= 16) { sMsaaSelection = 4; } - else if (configWindow.msaa >= 8) { sMsaaSelection = 3; } - else if (configWindow.msaa >= 4) { sMsaaSelection = 2; } - else if (configWindow.msaa >= 2) { sMsaaSelection = 1; } - else { sMsaaSelection = 0; } - - int choiceCount = 2; - if (maxMsaa >= 16) { choiceCount = 5; } - else if (maxMsaa >= 8) { choiceCount = 4; } - else if (maxMsaa >= 4) { choiceCount = 3; } - - char* msaaChoices[5] = { DLANG(DISPLAY, OFF), "2x", "4x", "8x", "16x" }; - msaa = djui_selectionbox_create(body, DLANG(DISPLAY, ANTIALIASING), msaaChoices, choiceCount, &sMsaaSelection, djui_panel_display_msaa_change); - } - char* drawDistanceChoices[6] = { DLANG(DISPLAY, D0P5X), DLANG(DISPLAY, D1X), DLANG(DISPLAY, D1P5X), DLANG(DISPLAY, D3X), DLANG(DISPLAY, D10X), DLANG(DISPLAY, D100X) }; djui_selectionbox_create(body, DLANG(DISPLAY, DRAW_DISTANCE), drawDistanceChoices, 6, &configDrawDistance, NULL); djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); - - sRestartText = djui_text_create(body, ""); - djui_text_set_alignment(sRestartText, DJUI_HALIGN_CENTER, DJUI_VALIGN_TOP); - djui_base_set_color(&sRestartText->base, 255, 100, 100, 255); - djui_base_set_size_type(&sRestartText->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); - djui_base_set_size(&sRestartText->base, 1.0f, 64); - } - - // force the restart text to update - if (msaa) { - djui_panel_display_msaa_change(&msaa->base); } djui_panel_add(caller, panel, NULL); diff --git a/src/pc/djui/djui_panel_host_settings.c b/src/pc/djui/djui_panel_host_settings.c index cda44231..190c0b54 100644 --- a/src/pc/djui/djui_panel_host_settings.c +++ b/src/pc/djui/djui_panel_host_settings.c @@ -58,14 +58,14 @@ void djui_panel_host_settings_create(struct DjuiBase* caller) { char* lChoices[3] = { DLANG(HOST_SETTINGS, LEAVE_LEVEL), DLANG(HOST_SETTINGS, STAY_IN_LEVEL), DLANG(HOST_SETTINGS, NONSTOP) }; djui_selectionbox_create(body, DLANG(HOST_SETTINGS, ON_STAR_COLLECTION), lChoices, 3, &configStayInLevelAfterStar, NULL); + char* bChoices[3] = { DLANG(HOST_SETTINGS, BOUNCY_BOUNDS_OFF), DLANG(HOST_SETTINGS, BOUNCY_BOUNDS_ON), DLANG(HOST_SETTINGS, BOUNCY_BOUNDS_ON_CAP) }; + djui_selectionbox_create(body, DLANG(HOST_SETTINGS, BOUNCY_LEVEL_BOUNDS), bChoices, 3, &configBouncyLevelBounds, NULL); + djui_checkbox_create(body, DLANG(HOST_SETTINGS, SKIP_INTRO_CUTSCENE), &configSkipIntro, NULL); djui_checkbox_create(body, DLANG(HOST_SETTINGS, PAUSE_ANYWHERE), &configPauseAnywhere, NULL); djui_checkbox_create(body, DLANG(HOST_SETTINGS, BUBBLE_ON_DEATH), &configBubbleDeath, NULL); djui_checkbox_create(body, DLANG(HOST_SETTINGS, NAMETAGS), &configNametags, NULL); - char* bChoices[3] = { DLANG(HOST_SETTINGS, BOUNCY_BOUNDS_OFF), DLANG(HOST_SETTINGS, BOUNCY_BOUNDS_ON), DLANG(HOST_SETTINGS, BOUNCY_BOUNDS_ON_CAP) }; - djui_selectionbox_create(body, DLANG(HOST_SETTINGS, BOUNCY_LEVEL_BOUNDS), bChoices, 3, &configBouncyLevelBounds, NULL); - struct DjuiRect* rect1 = djui_rect_container_create(body, 32); { struct DjuiText* text1 = djui_text_create(&rect1->base, DLANG(HOST_SETTINGS, AMOUNT_OF_PLAYERS)); diff --git a/src/pc/gfx/gfx_dummy.c b/src/pc/gfx/gfx_dummy.c index aed6594b..5ae1d353 100644 --- a/src/pc/gfx/gfx_dummy.c +++ b/src/pc/gfx/gfx_dummy.c @@ -80,10 +80,6 @@ static void gfx_dummy_wm_delay(u32 ms) { sleep_ms(ms); } -static int gfx_dummy_get_max_msaa(void) { - return 0; -} - static void gfx_dummy_set_window_title(UNUSED const char* title) { } @@ -212,7 +208,6 @@ struct GfxWindowManagerAPI gfx_dummy_wm_api = { gfx_dummy_wm_set_clipboard_text, gfx_dummy_wm_set_cursor_visible, gfx_dummy_wm_delay, - gfx_dummy_get_max_msaa, gfx_dummy_set_window_title, gfx_dummy_reset_window_title }; diff --git a/src/pc/gfx/gfx_dxgi.cpp b/src/pc/gfx/gfx_dxgi.cpp index 3b2f802c..6230bc21 100644 --- a/src/pc/gfx/gfx_dxgi.cpp +++ b/src/pc/gfx/gfx_dxgi.cpp @@ -665,10 +665,6 @@ void gfx_dxgi_delay(u32 ms) { Sleep(ms); } -static int gfx_dxgi_get_max_msaa(void) { - return 0; -} - static void gfx_dxgi_set_window_title(const char* title) { SetWindowTextA(dxgi.h_wnd, title); } @@ -746,7 +742,6 @@ struct GfxWindowManagerAPI gfx_dxgi = { gfx_dxgi_set_clipboard_text, gfx_dxgi_set_cursor_visible, gfx_dxgi_delay, - gfx_dxgi_get_max_msaa, gfx_dxgi_set_window_title, gfx_dxgi_reset_window_title }; diff --git a/src/pc/gfx/gfx_sdl1.c b/src/pc/gfx/gfx_sdl1.c index 45a52f3f..3a05eb60 100644 --- a/src/pc/gfx/gfx_sdl1.c +++ b/src/pc/gfx/gfx_sdl1.c @@ -180,10 +180,6 @@ static void gfx_sdl_delay(u32 ms) { SDL_Delay(ms); } -static int gfx_sdl_get_max_msaa(void) { - return 0; -} - static void gfx_sdl_set_window_title(const char* title) { SDL_WM_SetCaption(title, NULL); } @@ -220,7 +216,6 @@ struct GfxWindowManagerAPI gfx_sdl = { gfx_sdl_set_clipboard_text, gfx_sdl_set_cursor_visible, gfx_sdl_delay, - gfx_sdl_get_max_msaa, gfx_sdl_set_window_title, gfx_sdl_reset_window_title }; diff --git a/src/pc/gfx/gfx_sdl2.c b/src/pc/gfx/gfx_sdl2.c index 3d3f96b7..169fd8af 100644 --- a/src/pc/gfx/gfx_sdl2.c +++ b/src/pc/gfx/gfx_sdl2.c @@ -112,11 +112,6 @@ static void gfx_sdl_init(const char *window_title) { SDL_Init(SDL_INIT_VIDEO); SDL_StartTextInput(); - if (configWindow.msaa > 0) { - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, configWindow.msaa); - } - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); @@ -256,13 +251,6 @@ static void gfx_sdl_delay(u32 ms) { SDL_Delay(ms); } -static int gfx_sdl_get_max_msaa(void) { - int maxSamples = 0; - glGetIntegerv(GL_MAX_SAMPLES, &maxSamples); - if (maxSamples > 16) { maxSamples = 16; } - return maxSamples; -} - static void gfx_sdl_set_window_title(const char* title) { SDL_SetWindowTitle(wnd, title); } @@ -302,7 +290,6 @@ struct GfxWindowManagerAPI gfx_sdl = { gfx_sdl_set_clipboard_text, gfx_sdl_set_cursor_visible, gfx_sdl_delay, - gfx_sdl_get_max_msaa, gfx_sdl_set_window_title, gfx_sdl_reset_window_title }; diff --git a/src/pc/gfx/gfx_window_manager_api.h b/src/pc/gfx/gfx_window_manager_api.h index ebb5eefb..cb613c30 100644 --- a/src/pc/gfx/gfx_window_manager_api.h +++ b/src/pc/gfx/gfx_window_manager_api.h @@ -26,7 +26,6 @@ struct GfxWindowManagerAPI { void (*set_clipboard_text)(char*); void (*set_cursor_visible)(bool); void (*delay)(unsigned int ms); - int (*get_max_msaa)(void); void (*set_window_title)(const char* title); void (*reset_window_title)(void); };