Skip to content

renderer/directx12: fix uploadRegion null-guard tests on Zig 0.15.2#384

Merged
deblasis merged 1 commit into
windowsfrom
kitten-into-wintty/dx12-sentinel-align
May 20, 2026
Merged

renderer/directx12: fix uploadRegion null-guard tests on Zig 0.15.2#384
deblasis merged 1 commit into
windowsfrom
kitten-into-wintty/dx12-sentinel-align

Conversation

@deblasis
Copy link
Copy Markdown
Owner

Summary

PR #382 introduced four sentinel-pointer null-guard tests that never actually ran on Windows. Two issues stacked on top of each other:

  1. @ptrFromInt(0xDEAD1) violates Zig 0.15.2's pointer-alignment check for ?*ID3D12Resource / ?*ID3D12GraphicsCommandList, so zig build test failed at compile time. The CI green tick on renderer/directx12: surface staging-buffer upload failures #382 was Linux/Mac-only — the Texture tests are Windows-conditional and the alignment rule fires per-target.
  2. After fixing the alignment, the tests still failed because the null-guard branches call log.err, which the Zig test runner counts via log_err_count and the build runner reports as logged errors.

This PR fixes both:

  • 0xDEAD10xDEAD8 (still distinct from 0xDEAD0, still grep-locatable in a panic dump, now 8-byte aligned).
  • The three null-guard log.err calls in uploadRegion are downgraded to log.warn. The warning is still logged for diagnostics, the caller still receives error.UploadFailed, and State.upload still drops the placement via markForUnload (renderer/image: drop placement after upload failure #383). err was the wrong signal level for a recoverable, caller-handled state.

Test plan

  • zig build test passes on Windows (verified locally; pre-fix failed with 3 compile errors then 3 logged errors)
  • zig build clean
  • No production-behavior change; existing manual smoke (probe-iterm2-image.ps1) still renders

🤖 Generated with Claude Code

PR #382 introduced four sentinel-pointer null-guard tests that never
actually ran on Windows: zig build test failed at compile time because
@ptrFromInt(0xDEAD1) is not 8-byte aligned and Zig 0.15.2 enforces
pointer alignment for @ptrFromInt. After the alignment fix, the tests
failed again at runtime because the null-guard branches call log.err,
which the test runner counts via log_err_count and the build runner
reports as "logged errors".

Two changes:

* Use 0xDEAD8 instead of 0xDEAD1 for the sentinel pointers. Both are
  still distinct from 0xDEAD0 (so the failing-field is grep-locatable
  in a panic dump), and 0xDEAD8 is 8-byte aligned so @ptrFromInt
  accepts it.
* Downgrade the three null-guard log.err calls in uploadRegion to
  log.warn. Production behavior is virtually identical: the warning
  is still logged for diagnostic purposes, the caller still receives
  error.UploadFailed, and State.upload still drops the placement
  via markForUnload (PR #383). The previous err level was the wrong
  signal for a recoverable, caller-handled state.

Followup to PRs #382/#383 (DX12 image-upload audit).

Co-Authored-By: Alessandro De Blasis <alex@deblasis.net>
@deblasis deblasis force-pushed the kitten-into-wintty/dx12-sentinel-align branch from 911060e to 7bce6b3 Compare May 20, 2026 05:28
@deblasis deblasis merged commit 3e9e295 into windows May 20, 2026
98 checks passed
@deblasis deblasis deleted the kitten-into-wintty/dx12-sentinel-align branch May 20, 2026 05:44
deblasis added a commit that referenced this pull request May 21, 2026
…384)

PR #382 introduced four sentinel-pointer null-guard tests that never
actually ran on Windows: zig build test failed at compile time because
@ptrFromInt(0xDEAD1) is not 8-byte aligned and Zig 0.15.2 enforces
pointer alignment for @ptrFromInt. After the alignment fix, the tests
failed again at runtime because the null-guard branches call log.err,
which the test runner counts via log_err_count and the build runner
reports as "logged errors".

Two changes:

* Use 0xDEAD8 instead of 0xDEAD1 for the sentinel pointers. Both are
  still distinct from 0xDEAD0 (so the failing-field is grep-locatable
  in a panic dump), and 0xDEAD8 is 8-byte aligned so @ptrFromInt
  accepts it.
* Downgrade the three null-guard log.err calls in uploadRegion to
  log.warn. Production behavior is virtually identical: the warning
  is still logged for diagnostic purposes, the caller still receives
  error.UploadFailed, and State.upload still drops the placement
  via markForUnload (PR #383). The previous err level was the wrong
  signal for a recoverable, caller-handled state.

Followup to PRs #382/#383 (DX12 image-upload audit).
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