Skip to content

stub vulkan build #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master-vulkan
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ if(NOT DAEMON_EXTERNAL_APP)
option(USE_MUMBLE "Build Daemon with mumblelink sumpport" ON)
endif()

if (BUILD_CLIENT)
option(USE_VULKAN "Use Vulkan rendering API instead of OpenGL." OFF)
endif()

option(USE_SMP "Compile with support for running the renderer in a separate thread" ON)
option(USE_BREAKPAD "Generate Daemon crash dumps (which require Breakpad tools to read)" OFF)
endif()
Expand Down Expand Up @@ -562,6 +566,13 @@ if (BUILD_CLIENT OR BUILD_TTY_CLIENT OR BUILD_SERVER OR BUILD_DUMMY_APP)
endif()
endif()

if (USE_VULKAN)
add_definitions("-DDAEMON_RENDERER_VULKAN=1")
else()
add_definitions("-DDAEMON_RENDERER_OPENGL=1")
endif()

# TODO: Split OpenGL and Vulkan library configuration.
# Look for OpenGL here before we potentially switch to looking for static libs.
if (BUILD_CLIENT)
if (LINUX OR FREEBSD)
Expand Down Expand Up @@ -937,9 +948,16 @@ if (BUILD_CLIENT)
if (USE_SMP)
list(APPEND Definitions USE_SMP)
endif()

if (USE_VULKAN)
set(CLIENT_EXECUTABLE_NAME daemon-vulkan)
else()
set(CLIENT_EXECUTABLE_NAME daemon)
endif()

AddApplication(
Target client
ExecutableName daemon
ExecutableName ${CLIENT_EXECUTABLE_NAME}
ApplicationMain ${ENGINE_DIR}/client/ClientApplication.cpp
Definitions ${Definitions}
Flags ${WARNINGS}
Expand Down
1 change: 1 addition & 0 deletions src.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ set(COMMONTESTLIST
${ENGINE_DIR}/qcommon/q_math_test.cpp
)

# TODO: Split OpenGL and Vulkan list.
set(RENDERERLIST
${ENGINE_DIR}/renderer/DetectGLVendors.cpp
${ENGINE_DIR}/renderer/DetectGLVendors.h
Expand Down
13 changes: 13 additions & 0 deletions src/engine/renderer/tr_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

static void GfxInfo_f();

#if defined(DAEMON_RENDERER_OPENGL)
constexpr rendererApi_t rendererApi = rendererApi_t::OPENGL;
#elif defined(DAEMON_RENDERER_VULKAN)
constexpr rendererApi_t rendererApi = rendererApi_t::VULKAN;
#else
#error Undefined renderer API.
#endif

Cvar::Range<Cvar::Cvar<int>> r_rendererApi( "r_rendererApi", "Renderer API: 0: OpenGL, 1: Vulkan", Cvar::ROM,
Util::ordinal( rendererApi ),
Util::ordinal( rendererApi_t::OPENGL ),
Util::ordinal( rendererApi_t::VULKAN ) );

cvar_t *r_glMajorVersion;
cvar_t *r_glMinorVersion;
cvar_t *r_glProfile;
Expand Down
8 changes: 8 additions & 0 deletions src/engine/renderer/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,12 @@ enum class ssaoMode {
RSPEEDS_NEAR_FAR,
};

enum class rendererApi_t
{
OPENGL,
VULKAN,
};

enum class glDebugModes_t
{
GLDEBUG_NONE,
Expand Down Expand Up @@ -2834,6 +2840,8 @@ enum class ssaoMode {
//
// cvars
//
extern Cvar::Range<Cvar::Cvar<int>> r_rendererAPI;

extern cvar_t *r_glMajorVersion; // override GL version autodetect (for testing)
extern cvar_t *r_glMinorVersion;
extern cvar_t *r_glProfile;
Expand Down