Skip to content

Add unit coverage for Vulkan postfx parameter sanitization#39

Draft
cursor[bot] wants to merge 1 commit intonext-gen-5from
cursor/missing-test-coverage-ab24
Draft

Add unit coverage for Vulkan postfx parameter sanitization#39
cursor[bot] wants to merge 1 commit intonext-gen-5from
cursor/missing-test-coverage-ab24

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor bot commented Apr 2, 2026

Summary

This PR adds focused unit coverage for Vulkan post-processing parameter sanitization paths introduced/expanded in recent TAA and auto-exposure work.

Risky behavior now covered

  • TAA parameter sanitization boundaries:
    • r_taa_feedbackStationary clamped to [0.0, 0.99]
    • r_taa_feedbackMotion clamped to [0.0, 0.99]
    • r_taa_sharpen clamped to [0.0, 1.0]
    • hasValidTAAHistory correctly mapped to shader flag 0.0/1.0
  • Auto-exposure parameter fallback/safety behavior:
    • target/manual floor handling (>= 1e-4) for stable log2(target/manual) fallback
    • minimum exposure floor (>= 0.01)
    • max exposure forced to be >= min
    • valid luminance path preserving filtered log luminance

Test files added/updated

  • Added: tests/unit/test_vk_postfx_sanitize.c
  • Added: src/renderers/vulkan/vk_postfx_sanitize.c
  • Added: src/renderers/vulkan/vk_postfx_sanitize.h
  • Updated: src/renderers/vulkan/vk_postfx_params.c (calls sanitizer helpers; no intended behavior change)
  • Updated: CMakeLists.txt (register new unit test target)

Why these tests materially reduce regression risk

These code paths feed shader uniforms every frame and sit on core rendering flow with high blast radius. Regressions in clamp/fallback logic can cause temporal instability, over/under-exposure spikes, or invalid parameters that degrade frame quality across all scenes. The new unit tests lock down edge-case behavior deterministically without GPU/runtime dependencies.

Validation run

  • ctest -R "unit_macros|unit_vk_postfx_sanitize" --output-on-failure -V passed.
Open in Web View Automation 

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