Skip to content

Vulkan: remove dead USE_UPLOAD_QUEUE and non-reversed depth branches#163

Draft
cursor[bot] wants to merge 1 commit intomainfrom
cursor/feature-flag-cleanup-abe8
Draft

Vulkan: remove dead USE_UPLOAD_QUEUE and non-reversed depth branches#163
cursor[bot] wants to merge 1 commit intomainfrom
cursor/feature-flag-cleanup-abe8

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor Bot commented Apr 30, 2026

Summary

Cleanup of compile-time toggles that were never meaningfully optional: one path was dead or always taken.

Flags / toggles removed

Removed Why it is safe
USE_UPLOAD_QUEUE Never defined by CMake or headers anywhere in the repo. The #ifdef blocks could never compile the “upload queue” path; the #else path was the only real behavior. The guarded code also referenced Vk_Instance members (staging_command_buffer, image_uploaded, rendering_finished2) that are not declared on the struct, so enabling the macro would not build without further work.
USE_REVERSED_DEPTH Unconditionally #defined in vk.h for the Vulkan renderer, so every build used reversed Z. All #else branches (standard depth) were dead. GLSL for atmosphere.frag and oit_accum.frag was always compiled with -DUSE_REVERSED_DEPTH via scripts/compile_shaders.sh.

Behavioral parity

  • Semantics: Kept the code paths that were active when USE_UPLOAD_QUEUE was undefined and when USE_REVERSED_DEPTH was defined (reversed depth everywhere for Vulkan).
  • Build: ./scripts/compile_engine.sh vulkan succeeds.
  • Tests: ctest in build-vk-Release — all 19 tests passed (smoke, renderer regression, unit tests).
  • Shaders: Regenerated embedded SPIR-V (shader_data.c, shader_build_meta.txt) after simplifying GLSL and the compile script.

Files touched (high level)

  • Vulkan: vk_frame_submit.c, vk_init_device.c, vk_presentation.c, depth/viewport/pipeline/flare/projection helpers, vk.h, tr_main.c.
  • Shaders: atmosphere.frag, oit_accum.frag, scripts/compile_shaders.sh, regenerated SPIR-V blobs.
Open in Web View Automation 

- USE_UPLOAD_QUEUE was never defined in CMake or headers; the guarded code
  referenced Vk_Instance fields that do not exist, so only the #else path
  could ever compile. Remove the dead branch and staging CB allocation.
- Reversed Z is unconditional for this renderer (vk.h always defined
  USE_REVERSED_DEPTH). Remove the macro and fold #else branches in C and
  GLSL; shader script no longer injects -DUSE_REVERSED_DEPTH for standalone
  compiles. Regenerate embedded SPIR-V for atmosphere and OIT accum.

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