Add a separate build option for the OpenGL renderer

This commit is contained in:
Alexander Babikov
2021-04-26 02:45:20 +05:00
parent b1fb9def6e
commit b4a16437d3
9 changed files with 33 additions and 14 deletions

View File

@@ -66,7 +66,7 @@ BEGIN
MENUITEM "&SDL (Software)", IDM_VID_SDL_SW
MENUITEM "SDL (&Hardware)", IDM_VID_SDL_HW
MENUITEM "SDL (&OpenGL)", IDM_VID_SDL_OPENGL
#ifdef DEV_BRANCH /* feature-opengl */
#if defined(DEV_BRANCH) && defined(USE_OPENGL)
MENUITEM "Open&GL (3.3 Core)", IDM_VID_OPENGL_CORE
#endif
#ifdef USE_VNC
@@ -237,7 +237,7 @@ BEGIN
END
END
#ifdef DEV_BRANCH /* feature-opengl */
#if defined(DEV_BRANCH) && defined(USE_OPENGL)
VidGLSubMenu MENU DISCARDABLE
BEGIN
POPUP "Target &framerate"

View File

@@ -20,7 +20,7 @@ add_library(plat OBJECT win.c win_dynld.c win_thread.c win_cdrom.c
add_library(ui OBJECT win_ui.c win_stbar.c win_sdl.c win_dialog.c win_about.c
win_settings.c win_devconf.c win_snd_gain.c win_specify_dim.c win_new_floppy.c
win_jsconf.c win_media_menu.c 86Box.rc glad.c win_opengl.c win_opengl_glslp.c)
win_jsconf.c win_media_menu.c 86Box.rc)
if(MSVC)
# MSVC complains when we include the manifest from 86Box.rc...
@@ -49,5 +49,11 @@ if(DISCORD)
target_sources(ui PRIVATE win_discord.c)
endif()
if(OPENGL)
# PUBLIC due to config.c
target_compile_definitions(ui PUBLIC USE_OPENGL)
target_sources(ui PRIVATE glad.c win_opengl.c win_opengl_glslp.c)
endif()
target_link_libraries(86Box advapi32 comctl32 comdlg32 gdi32 shell32 iphlpapi
dxguid imm32 hid setupapi uxtheme version winmm psapi)

View File

@@ -63,6 +63,9 @@ ifeq ($(DEV_BUILD), y)
ifndef OPEN_AT
OPEN_AT := y
endif
ifndef OPENGL
OPENGL := y
endif
ifndef PAS16
PAS16 := n
endif
@@ -133,6 +136,9 @@ else
ifndef OPEN_AT
OPEN_AT := n
endif
ifndef OPENGL
OPENGL := n
endif
ifndef PAS16
PAS16 := n
endif
@@ -433,7 +439,7 @@ ifeq ($(WX), y)
UIOBJ := wx_main.o wx_ui.o wx_stbar.o wx_render.o
else
UIOBJ := win_ui.o win_stbar.o \
win_sdl.o win_opengl.o win_opengl_glslp.o glad.o \
win_sdl.o \
win_dialog.o win_about.o \
win_settings.o win_devconf.o win_snd_gain.o win_specify_dim.o \
win_new_floppy.o win_jsconf.o win_media_menu.o
@@ -527,6 +533,12 @@ ifeq ($(OPEN_AT), y)
OPTS += -DUSE_OPEN_AT
endif
ifeq ($(OPENGL), y)
OPTS += -DUSE_OPENGL
RFLAGS += -DUSE_OPENGL
DEVBROBJ += win_opengl.o win_opengl_glslp.o glad.o
endif
ifeq ($(PAS16), y)
OPTS += -DUSE_PAS16
DEVBROBJ += snd_pas16.o

View File

@@ -104,7 +104,7 @@ static const struct {
{ "SDL_Software", 1, (int(*)(void*))sdl_inits, sdl_close, NULL, sdl_pause, sdl_enable, sdl_set_fs, NULL },
{ "SDL_Hardware", 1, (int(*)(void*))sdl_inith, sdl_close, NULL, sdl_pause, sdl_enable, sdl_set_fs, NULL },
{ "SDL_OpenGL", 1, (int(*)(void*))sdl_initho, sdl_close, NULL, sdl_pause, sdl_enable, sdl_set_fs, NULL }
#ifdef DEV_BRANCH /* feature-opengl */
#if defined(DEV_BRANCH) && defined(USE_OPENGL)
,{ "OpenGL_Core", 1, (int(*)(void*))opengl_init, opengl_close, opengl_resize, opengl_pause, NULL, opengl_set_fs, opengl_reload}
#else
,{ "OpenGL_Core", 1, (int(*)(void*))sdl_initho, sdl_close, NULL, sdl_pause, sdl_enable, sdl_set_fs, NULL } /* fall back to SDL_OpenGL */
@@ -939,7 +939,7 @@ plat_vidapi_name(int api)
case 2:
name = "sdl_opengl";
break;
#ifdef DEV_BRANCH /* feature-opengl */
#if defined(DEV_BRANCH) && defined(USE_OPENGL)
case 3:
name = "opengl_core";
break;

View File

@@ -207,7 +207,7 @@ int delete_submenu(HMENU parent, HMENU target)
static void
show_render_options_menu()
{
#ifdef DEV_BRANCH /* feature-opengl */
#if defined(DEV_BRANCH) && defined(USE_OPENGL)
static int menu_vidapi = -1;
static HMENU cur_menu = NULL;
@@ -288,7 +288,7 @@ ResetAllMenus(void)
CheckMenuItem(menuMain, IDM_VID_SDL_SW, MF_UNCHECKED);
CheckMenuItem(menuMain, IDM_VID_SDL_HW, MF_UNCHECKED);
CheckMenuItem(menuMain, IDM_VID_SDL_OPENGL, MF_UNCHECKED);
#ifdef DEV_BRANCH /* feature-opengl */
#if defined(DEV_BRANCH) && defined(USE_OPENGL)
CheckMenuItem(menuMain, IDM_VID_OPENGL_CORE, MF_UNCHECKED);
show_render_options_menu();
#endif
@@ -738,7 +738,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case IDM_VID_SDL_SW:
case IDM_VID_SDL_HW:
case IDM_VID_SDL_OPENGL:
#ifdef DEV_BRANCH /* feature-opengl */
#if defined(DEV_BRANCH) && defined(USE_OPENGL)
case IDM_VID_OPENGL_CORE:
#endif
#ifdef USE_VNC
@@ -751,7 +751,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
show_render_options_menu();
break;
#ifdef DEV_BRANCH /* feature-opengl */
#if defined(DEV_BRANCH) && defined(USE_OPENGL)
case IDM_VID_GL_FPS_BLITTER:
case IDM_VID_GL_FPS_25:
case IDM_VID_GL_FPS_30: