Skip to content

Vulkan RTX: r_rtx mode visualization + auto vk_rtx_demo_spirv.inc#178

Merged
timfox merged 2 commits intomainfrom
cursor/rtx-mode-visualization-0a71
May 4, 2026
Merged

Vulkan RTX: r_rtx mode visualization + auto vk_rtx_demo_spirv.inc#178
timfox merged 2 commits intomainfrom
cursor/rtx-mode-visualization-0a71

Conversation

@timfox
Copy link
Copy Markdown
Owner

@timfox timfox commented May 4, 2026

Summary

Advances the Vulkan KHR RTX demo path toward the documented r_rtx modes (1=shadows, 2=reflections, 3=full) by visualizing mode in the closest-hit shader, wiring the frame UBO to closest-hit, and automating regeneration of vk_rtx_demo_spirv.inc.

Technical changes

  • VkRtxFrameUBO: outputSize.z carries clamped r_rtx (0–3) each frame; documented in struct comment.
  • vk_rtx_init: descriptor binding 2 (uniform buffer) stage flags = raygen | closest hit.
  • rtx_demo.rchit: reads rtx.outputSize.z; tints base albedo by mode (1 darker, 2 cool blue mix, 3 warm accent). Mode 0 keeps legacy flat grey.
  • rtx_demo.rgen: comment only (UBO layout unchanged size-wise).
  • scripts/compile_shaders.sh: after compiling RTX stages, writes src/renderers/vulkan/vk_rtx_demo_spirv.inc with correct VK_RTX_DEMO_*_SPV_SIZE macros (PROJECT_ROOT export).
  • Regenerated shader_data.c, shader_build_meta.txt, and vk_rtx_demo_spirv.inc via ./scripts/compile_shaders.sh --apply.

Docs

  • docs/RENDERERS_FUTURE.md — RTX table row updated.
  • CHANGELOG.md — [Unreleased] → Added.

Validation

  • ./scripts/compile_engine.sh vulkan (recompiles shaders; smoke path OK)
  • ctest -R smoke_test
  • Separate configure: cmake -B build-rtx-Release -DUSE_VULKAN_RTX=ON + build idtech3_vulkan_x86 (RTX defines compile)

Notes

This is visualization scaffolding for r_rtx presets on the existing single-hit demo; true shadows/reflections/full RT still require additional pipelines / secondary rays / integration per RENDERERS_FUTURE.md.

Open in Web Open in Cursor 

- Pass latched r_rtx (1-3) in frame UBO outputSize.z; rchit shades by mode
  (1=darken, 2=cool, 3=warm) for demo visualization
- Descriptor: binding 2 UBO visible to raygen + closest hit
- compile_shaders.sh: emit vk_rtx_demo_spirv.inc from RTX SPIR-V (PROJECT_ROOT)
- Regenerate shader_data and embedded RTX modules; update RENDERERS_FUTURE

Co-authored-by: Tim Fox <timfox@outlook.com>
@timfox timfox marked this pull request as ready for review May 4, 2026 23:05
Co-authored-by: Cursor <cursoragent@cursor.com>
@timfox timfox merged commit ac46e61 into main May 4, 2026
19 of 23 checks passed
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 22b9f3b0d5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +341 to +344
out_path.write_text("\n".join(lines) + "\n", encoding="utf-8")
print(f"Wrote {out_path}")

write_vk_rtx_demo_spirv_inc()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Gate vk_rtx_demo_spirv.inc writes behind apply mode

compile_shaders.sh now always rewrites src/renderers/vulkan/vk_rtx_demo_spirv.inc even when called in generation-only mode, so invocations that intentionally avoid touching tracked sources (for example the CMake custom command and scripts/validate_ci_build.sh, both of which run without --apply) will still dirty the working tree and can fail in read-only source checkouts. This bypasses the existing --generated-dir/--apply workflow and should be gated so source-tree updates only happen in an explicit apply step.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale comment

Security review complete: I found no high-confidence medium, high, or critical vulnerabilities introduced by this PR.

I also checked the existing unresolved automation thread; it is a build/workflow issue rather than a security finding, so there is no prior security finding to re-report.

Open in Web View Automation 

Sent by Cursor Automation: Find vulnerabilities

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security review complete for PR #178.

No high-confidence medium, high, or critical vulnerabilities were identified in the added or modified code. I also checked the existing unresolved automation thread and it appears to be a build/workflow concern rather than a security finding, so I did not re-report it as a vulnerability.

Open in Web View Automation 

Sent by Cursor Automation: Find vulnerabilities

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.

2 participants