Skip to content

Vulkan: remove stale compile-time feature flags and dead branches - #296

Draft
cursor[bot] wants to merge 4 commits into
mainfrom
cursor/feature-flag-cleanup-0684
Draft

Vulkan: remove stale compile-time feature flags and dead branches#296
cursor[bot] wants to merge 4 commits into
mainfrom
cursor/feature-flag-cleanup-0684

Conversation

@cursor

@cursor cursor Bot commented Aug 8, 2026

Copy link
Copy Markdown

Summary

Removes stale compile-time feature flags and dead preprocessor branches in the Vulkan renderer where rollout is complete. The active PBR/VBO/Vulkan paths are unchanged; OpenGL fallbacks and never-defined grid/tess paths are deleted.

Flags removed

Flag Why safe
USE_VBO_GRID Never defined in tr_local.h; SF_GRID stays off the static VBO path by design
USE_TESS_NEEDS_NORMAL / USE_TESS_NEEDS_ST2 Commented-out defines with no struct fields; guards only wrapped removed assignments
USE_VK_PBR (compile-time #else) Always #define USE_VK_PBR in tr_local.h; runtime vk.pbrActive gating kept
USE_VBO / USE_VULKAN / USE_FOG_COLLAPSE (file guards) Permanently defined for renderers/vulkan; OpenGL / non-VBO fallbacks removed
USE_DEDICATED_ALLOCATION override Always #define USE_DEDICATED_ALLOCATION in vk.h

Tooling

  • scripts/tools/unwrap_use_vk_pbr.py — unwrap USE_VK_PBR #else branches
  • scripts/tools/unwrap_compile_flags.py — unwrap always-on Vulkan macros with nested #if depth tracking

Behavioral parity checks

  • idtech3_vulkan_x86 builds successfully (make idtech3_vulkan_x86 in build-vk-Release with IDTECH3_PROFILE=core)
  • Preprocessor balance scan on renderers/vulkan C/H sources (no orphan #if/#endif)
  • Restored vk_vbo.c R_BuildWorldVBO after verifying cherry-picked grid removal did not truncate the function
  • Fixed extern "C" header guards so C compilation exposes contract APIs

Test plan

  • ./scripts/bootstrap.sh engine
  • ./scripts/smoke_test.sh ./build-vk-Release (or relevant subset)
  • Manual: client/server with mod data if applicable
  • Manifest updated if sources moved or CMake gates changed (docs/ENGINE_MODULE_MANIFEST.md)
  • ./scripts/ci/audit_unconditional_sources.sh (when touching CMake source lists)
Open in Web View Automation 

cursoragent and others added 4 commits August 8, 2026 10:02
- USE_VBO_GRID: never defined (SF_GRID deliberately off VBO path per tr_local.h);
  remove dead grid VBO estimate/queue/pack paths in vk_vbo.c and tr_surface.c.
- USE_TESS_NEEDS_NORMAL / USE_TESS_NEEDS_ST2: commented-out defines with no
  struct fields; remove preprocessor guards that only wrapped always-on paths.
- USE_VK_PBR dead #else: unwrap non-PBR shader module init/destroy fallbacks in
  vk_shader_modules.c and vk_shutdown.c; flatten VK_CUBEMAP/VK_PBR_BRDFLUT nesting
  in tr_local.h; unwrap reactive/object-id storage descriptor (void)0 else stubs.
- USE_DEDICATED_ALLOCATION: always defined in vk.h; drop redundant #ifndef override
  in vk_instance.c.

Behavior unchanged on the active PBR/VBO/dedicated-allocation paths.

Co-authored-by: Tim Fox <timfox@outlook.com>
USE_VK_PBR is unconditionally defined in tr_local.h for the Vulkan
renderer. Remove non-PBR #else fallbacks in pipeline creation, vertex
layout, descriptor counts, and BSP/surface helpers while keeping shader
templates and runtime vk.pbrActive gating intact.

Adds scripts/tools/unwrap_use_vk_pbr.py for future cleanups.

Co-authored-by: Tim Fox <timfox@outlook.com>
Remove dead OpenGL and non-PBR preprocessor branches guarded by macros
that are permanently defined in renderers/vulkan/tr_local.h and
tr_common.h. Adds scripts/tools/unwrap_compile_flags.py with safer
nested #if depth tracking.

Fixes VK_CUBEMAP nesting and orphaned endif left by partial unwrap in
tr_init.c, tr_shade.c, vk_object_id.c, and contract headers.

Co-authored-by: Tim Fox <timfox@outlook.com>
- Restore vk_vbo.c from main and delete USE_VBO_GRID/TESS blocks (not unwrap).
- Unwrap USE_VK_PBR/USE_VBO with depth-safe endif matching.
- Fix extern C guards in shadow/frame/reflection contract headers.
- Repair tr_init.c VK_CUBEMAP nesting and remove orphan USE_VULKAN endif.
- Remove stray preprocessor lines in tr_shade.c and vk_object_id.c.
- Harden unwrap_compile_flags.py endif regex (no .*$ swallowing).

Co-authored-by: Tim Fox <timfox@outlook.com>
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