Skip to content

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

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

Vulkan: remove stale compile-time feature flags and dead PBR branches#295
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/feature-flag-cleanup-cf0a

Conversation

@cursor

@cursor cursor Bot commented Aug 6, 2026

Copy link
Copy Markdown

Summary

Reduce Vulkan renderer technical debt by removing compile-time feature flags that are permanently on/off and deleting their dead #else branches. Behavior on the active paths is unchanged.

Branch: cursor/feature-flag-cleanup-cf0amain

Flags removed

Flag Why safe
USE_VBO_GRID Never defined; tr_local.h documents SF_GRID deliberately off the static VBO path
USE_TESS_NEEDS_NORMAL / USE_TESS_NEEDS_ST2 Commented-out defines with no struct fields; guards only wrapped always-on code
USE_DEDICATED_ALLOCATION dead #ifndef Always defined in vk.h for non-_DEBUG builds; override was redundant
USE_VK_PBR dead #else branches Unconditionally #define USE_VK_PBR in tr_local.h; non-PBR fallbacks were unreachable
VK_CUBEMAP / VK_PBR_BRDFLUT nesting Flattened now that PBR is always compiled in
Reactive/object-id (void)0 else stubs PBR path always active at compile time

Intentionally kept

  • One-sided #ifdef USE_VK_PBR blocks that gate runtime vk.pbrActive behavior
  • GLSL shader templates (gen_frag.tmpl, gen_vert.tmpl) — still compile both PBR and legacy variants via -DUSE_VK_PBR
  • Optional CMake gates (USE_VULKAN_RTX, USE_EXPERIMENTAL_RENDERERS)

Stats

  • 27 files touched, ~989 lines removed across 2 commits
  • Added scripts/tools/unwrap_use_vk_pbr.py for future cleanups

Test plan

  • ./tests/scripts/test_vulkan_regression_source_guards.sh PASS
  • Grep: zero USE_VBO_GRID, USE_TESS_NEEDS, #ifndef USE_VK_PBR, #ifndef USE_DEDICATED_ALLOCATION in renderers/vulkan
  • ./scripts/smoke_test.sh ./build-vk-Release (full build not run in headless VM)

Behavioral parity checks

  • Active PBR pipeline creation path preserved (10-binding vertex layout, 45-entry fragment specialization map)
  • VBO static-surface path unchanged (face/triangle only; grid path was already dead)
  • Dedicated allocation extension wiring unchanged for Release builds
  • Forward+ graphics descriptor set returns vk_fp_graphics_descriptor (was already the USE_VK_PBR branch)
  • Shader module init uses vk_bind_generated_shaders() PBR path exclusively
Open in Web View Automation 

cursoragent and others added 2 commits August 6, 2026 10:03
- 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>
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