Skip to content

Add Vulkan renderer from vkQuake3 (Sui Jingfeng's fork)#861

Open
runlevel5 wants to merge 7 commits intoioquake:mainfrom
runlevel5:add-vulkan-renderer
Open

Add Vulkan renderer from vkQuake3 (Sui Jingfeng's fork)#861
runlevel5 wants to merge 7 commits intoioquake:mainfrom
runlevel5:add-vulkan-renderer

Conversation

@runlevel5
Copy link
Copy Markdown

@runlevel5 runlevel5 commented Feb 11, 2026

Port the Vulkan renderer from vkQuake3 into ioquake3 as a third renderer option alongside OpenGL 1.x and OpenGL 2.0. The renderer is self-contained with its own image loaders, font rendering, and noise functions.

CMake integration:

  • New BUILD_RENDERER_VULKAN option (default ON)
  • New cmake/renderer_vulkan.cmake build rules
  • Updated static-linking guard to support 3 renderers
  • Added Vulkan renderer to macOS bundle, JPEG/FreeType guards

Source fixes applied to vkQuake3 code:

  • Removed duplicate vk_image_sampler.c (kept vk_image_sampler2.c)
  • Fixed R_LoadImage signature (int* -> uint32_t*) to match declaration
  • Fixed puff.h include path for ioquake3 directory layout
  • Added QALIGN macro definition missing from upstream q_shared.h
  • Re-query VkSurfaceCapabilitiesKHR before swapchain creation to fix stale surface dimensions on Wayland (matching Quake3e's approach)

Tested on Fedora 43, AMD Radeon RX 6600 XT via RADV:

  • All 3 renderers, client, server, and game VMs build cleanly
  • Vulkan renderer initializes, renders, and shuts down correctly
  • Swapchain dimensions match window at r_mode 4 and r_mode -2

TODO

  • Fix CI builds (in progress now)
  • Support macOS (via MoltenVK)
  • Test it on Windows (I need help with this please)

Port the Vulkan renderer from vkQuake3 into ioquake3 as a third renderer
option alongside OpenGL 1.x and OpenGL 2.0. The renderer is self-contained
with its own image loaders, font rendering, and noise functions.

CMake integration:
- New BUILD_RENDERER_VULKAN option (default ON)
- New cmake/renderer_vulkan.cmake build rules
- Updated static-linking guard to support 3 renderers
- Added Vulkan renderer to macOS bundle, JPEG/FreeType guards

Source fixes applied to vkQuake3 code:
- Removed duplicate vk_image_sampler.c (kept vk_image_sampler2.c)
- Fixed R_LoadImage signature (int* -> uint32_t*) to match declaration
- Fixed puff.h include path for ioquake3 directory layout
- Added QALIGN macro definition missing from upstream q_shared.h
- Re-query VkSurfaceCapabilitiesKHR before swapchain creation to fix
  stale surface dimensions on Wayland (matching Quake3e's approach)

Tested on Fedora 43, AMD Radeon RX 6600 XT via RADV:
- All 3 renderers, client, server, and game VMs build cleanly
- Vulkan renderer initializes, renders, and shuts down correctly
- Swapchain dimensions match window at r_mode 4 and r_mode -2
The .vspv/.fspv files are intermediate build artifacts generated by
glslangValidator. Only the .c byte-array files are needed for
compilation. Add .vspv/.fspv patterns to .gitignore.
The Vulkan renderer currently only builds and works on Linux. It has
not been tested on macOS, Windows, OpenBSD, or Emscripten. Setting the
default to OFF prevents CI failures on unsupported platforms.
- Update bundled Vulkan headers from 1.1 to 1.4 (header version 341),
  removing obsolete SPIR-V tools and platform-specific headers now
  provided via vulkan_core.h
- Add VK_KHR_portability_enumeration and VK_KHR_portability_subset
  support required for MoltenVK on macOS
- Add USE_INTERNAL_VULKAN_HEADERS CMake option to allow building
  against system-provided Vulkan headers
- Fix SDL2 header includes in Vulkan renderer to use standard paths
- Document macOS MoltenVK requirement in vulkan-readme.md and README.md
Fix all build warnings in the Vulkan renderer (shadow variables, format
specifiers, strict prototypes, array size mismatches, header guard typo,
unhandled switch cases, and a real memcpy bug in R_MovePatchSurfacesToHunk
where heightLodError was copied to itself instead of the hunk allocation).

Add r_swapInterval cvar support so the Vulkan renderer respects vsync
settings. Previously the present mode selection always preferred MAILBOX
over FIFO regardless of r_swapInterval, causing vsync to have no effect
and frame rates to run uncapped at 1000+ fps.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant