From 895dff97e608a21836bbe2da41a6f721101c3e02 Mon Sep 17 00:00:00 2001 From: ec- Date: Thu, 3 Jun 2021 13:10:48 +0300 Subject: [PATCH] Updated Makefile, disabled opengl2 renderer module by default --- .github/workflows/build.yml | 12 +++++------ Makefile | 42 ++++++++++++++++++++++++++++++------- README.md | 16 +++++++++----- code/client/cl_main.c | 4 ++++ 4 files changed, 56 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 08ea3c6a..4a7ea31c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -167,9 +167,9 @@ jobs: - name: Build run: | - make ${{ matrix.rule }} -j 8 ARCH=${{ matrix.arch }} CC=${{ matrix.cc }} DESTDIR=bin USE_RENDERER_DLOPEN=0 ${{ matrix.use_sdl }} USE_VULKAN=1 CNAME=quake3e-vulkan BUILD_SERVER=0 + make ${{ matrix.rule }} -j 8 ARCH=${{ matrix.arch }} CC=${{ matrix.cc }} DESTDIR=bin USE_RENDERER_DLOPEN=0 ${{ matrix.use_sdl }} RENDERER_DEFAULT=vulkan CNAME=quake3e-vulkan BUILD_SERVER=0 make clean ARCH=${{ matrix.arch }} - make ${{ matrix.rule }} -j 8 ARCH=${{ matrix.arch }} CC=${{ matrix.cc }} DESTDIR=bin USE_RENDERER_DLOPEN=0 ${{ matrix.use_sdl }} USE_VULKAN_API=0 + make ${{ matrix.rule }} -j 8 ARCH=${{ matrix.arch }} CC=${{ matrix.cc }} DESTDIR=bin USE_RENDERER_DLOPEN=0 ${{ matrix.use_sdl }} RENDERER_DEFAULT=opengl - uses: actions/upload-artifact@v2 if: matrix.cc == 'gcc' && matrix.config == 'Release' @@ -210,9 +210,9 @@ jobs: apt-get -qq update apt-get install -y make gcc g++ apt-get -y install libcurl4-openssl-dev mesa-common-dev libxxf86dga-dev libxrandr-dev libxxf86vm-dev libasound-dev - make ${{ matrix.rule }} -j 4 ARCH=${{ matrix.arch }} CC=${{ matrix.cc }} DESTDIR=bin USE_RENDERER_DLOPEN=0 USE_SDL=0 USE_VULKAN=1 CNAME=quake3e-vulkan BUILD_SERVER=0 + make ${{ matrix.rule }} -j 4 ARCH=${{ matrix.arch }} CC=${{ matrix.cc }} DESTDIR=bin USE_RENDERER_DLOPEN=0 USE_SDL=0 RENDERER_DEFAULT=vulkan CNAME=quake3e-vulkan BUILD_SERVER=0 make clean ARCH=${{ matrix.arch }} - make ${{ matrix.rule }} -j 4 ARCH=${{ matrix.arch }} CC=${{ matrix.cc }} DESTDIR=bin USE_RENDERER_DLOPEN=0 USE_SDL=0 USE_VULKAN_API=0 + make ${{ matrix.rule }} -j 4 ARCH=${{ matrix.arch }} CC=${{ matrix.cc }} DESTDIR=bin USE_RENDERER_DLOPEN=0 USE_SDL=0 RENDERER_DEFAULT=opengl - uses: actions/upload-artifact@v2 if: false @@ -246,9 +246,9 @@ jobs: - name: Build run: | - make ${{ matrix.rule }} -j 4 CC=${{ matrix.cc }} DESTDIR=bin INSTALL=ginstall USE_RENDERER_DLOPEN=0 USE_VULKAN=1 CNAME=quake3e-vulkan BUILD_SERVER=0 + make ${{ matrix.rule }} -j 4 CC=${{ matrix.cc }} DESTDIR=bin INSTALL=ginstall USE_RENDERER_DLOPEN=0 RENDERER_DEFAULT=vulkan CNAME=quake3e-vulkan BUILD_SERVER=0 make clean ARCH=${{ matrix.arch }} - make ${{ matrix.rule }} -j 4 CC=${{ matrix.cc }} DESTDIR=bin INSTALL=ginstall USE_RENDERER_DLOPEN=0 USE_VULKAN_API=0 + make ${{ matrix.rule }} -j 4 CC=${{ matrix.cc }} DESTDIR=bin INSTALL=ginstall USE_RENDERER_DLOPEN=0 RENDERER_DEFAULT=opengl - uses: actions/upload-artifact@v2 if: matrix.cc == 'clang' && matrix.config == 'Release' diff --git a/Makefile b/Makefile index 0e6915c3..10397b45 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,8 @@ BUILD_SERVER = 1 USE_SDL = 1 USE_CURL = 1 USE_LOCAL_HEADERS= 0 -USE_VULKAN = 0 +USE_VULKAN = 1 +USE_OPENGL = 1 USE_OPENGL2 = 0 USE_SYSTEM_JPEG = 0 USE_VULKAN_API = 1 @@ -41,6 +42,10 @@ DNAME = quake3e.ded RENDERER_PREFIX = $(CNAME) +# valid options: opengl, vulkan, opengl2 +RENDERER_DEFAULT = opengl + + ifeq ($(V),1) echo_cmd=@: Q= @@ -143,12 +148,28 @@ ifndef USE_CURL_DLOPEN endif endif -ifneq ($(USE_RENDERER_DLOPEN),0) -USE_VULKAN=1 +ifeq ($(USE_RENDERER_DLOPEN),0) + ifeq ($(RENDERER_DEFAULT),opengl) + USE_OPENGL=1 + USE_OPENGL2=0 + USE_VULKAN=0 + USE_VULKAN_API=0 + endif + ifeq ($(RENDERER_DEFAULT),opengl2) + USE_OPENGL=0 + USE_OPENGL2=1 + USE_VULKAN=0 + USE_VULKAN_API=0 + endif + ifeq ($(RENDERER_DEFAULT),vulkan) + USE_OPENGL=0 + USE_OPENGL2=0 + USE_VULKAN=1 + endif endif ifneq ($(USE_VULKAN),0) -USE_VULKAN_API=1 + USE_VULKAN_API=1 endif @@ -232,6 +253,7 @@ endif ifneq ($(USE_RENDERER_DLOPEN),0) BASE_CFLAGS += -DUSE_RENDERER_DLOPEN BASE_CFLAGS += -DRENDERER_PREFIX=\\\"$(RENDERER_PREFIX)\\\" + BASE_CFLAGS += -DRENDERER_DEFAULT="$(RENDERER_DEFAULT)" endif ifdef DEFAULT_BASEDIR @@ -496,9 +518,15 @@ endif ifneq ($(BUILD_CLIENT),0) TARGETS += $(B)/$(TARGET_CLIENT) ifneq ($(USE_RENDERER_DLOPEN),0) - TARGETS += $(B)/$(TARGET_REND1) - TARGETS += $(B)/$(TARGET_REND2) - TARGETS += $(B)/$(TARGET_RENDV) + ifeq ($(USE_OPENGL),1) + TARGETS += $(B)/$(TARGET_REND1) + endif + ifeq ($(USE_OPENGL2),1) + TARGETS += $(B)/$(TARGET_REND2) + endif + ifeq ($(USE_VULKAN),1) + TARGETS += $(B)/$(TARGET_RENDV) + endif endif endif diff --git a/README.md b/README.md index 1d872608..cc68369c 100644 --- a/README.md +++ b/README.md @@ -137,23 +137,29 @@ Copy the resulting binaries from created `build` directory --- -Several make options are available for linux/mingw/macos builds: +Several Makefile options are available for linux/mingw/macos builds: `BUILD_CLIENT=1` - build unified client/server executable, enabled by default `BUILD_SERVER=1` - build dedicated server executable, enabled by default -`USE_SDL=0`- use SDL2 backend for video, audio, input subsystems, disabled by default, enforced for macos +`USE_SDL=0`- use SDL2 backend for video, audio, input subsystems, enabled by default, enforced for macos -`USE_VULKAN=0` - link client with vulkan renderer instead of OpenGL, disabled by default, works only with single renderer builds +`USE_VULKAN=1` - build vulkan modular renderer, enabled by default -`USE_RENDERER_DLOPEN=1` - do not link single renderer into client binary, compile all renderers (ignoring USE_VULKAN setting) as dynamic libraries and allow to switch them on the fly via `\cl_renderer` cvar, enabled by default +`USE_OPENGL=1` - build opengl modular renderer, enabled by default + +`USE_OPENGL2=0` - build opengl2 modular renderer, disabled by default + +`USE_RENDERER_DLOPEN=1` - do not link single renderer into client binary, compile all enabled renderers as dynamic libraries and allow to switch them on the fly via `\cl_renderer` cvar, enabled by default + +`RENDERER_DEFAULT=opengl` - set default value for `\cl_renderer` cvar or use selected renderer for static build for `USE_RENDERER_DLOPEN=0`, valid options are `opengl`, `opengl2`, `vulkan` `USE_SYSTEM_JPEG=0` - use current system JPEG library, disabled by default Example: -`make BUILD_SERVER=0 USE_RENDERER_DLOPEN=0 USE_VULKAN=1` - which means do not build dedicated binary, build client with single static vulkan renderer +`make BUILD_SERVER=0 USE_RENDERER_DLOPEN=0 RENDERER_DEFAULT=vulkan` - which means do not build dedicated binary, build client with single static vulkan renderer ## Contacts diff --git a/code/client/cl_main.c b/code/client/cl_main.c index 74cdd3c8..afdb5c00 100644 --- a/code/client/cl_main.c +++ b/code/client/cl_main.c @@ -3775,7 +3775,11 @@ static void CL_InitGLimp_Cvars( void ) cl_drawBuffer = Cvar_Get( "r_drawBuffer", "GL_BACK", CVAR_CHEAT ); #ifdef USE_RENDERER_DLOPEN +#ifdef RENDERER_DEFAULT + cl_renderer = Cvar_Get( "cl_renderer", XSTRING( RENDERER_DEFAULT ), CVAR_ARCHIVE | CVAR_LATCH ); +#else cl_renderer = Cvar_Get( "cl_renderer", "opengl", CVAR_ARCHIVE | CVAR_LATCH ); +#endif if ( !isValidRenderer( cl_renderer->string ) ) { Cvar_ForceReset( "cl_renderer" ); }