renderer/directx12: fix uploadRegion null-guard tests on Zig 0.15.2#384
Merged
Conversation
3 tasks
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>
911060e to
7bce6b3
Compare
3 tasks
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR #382 introduced four sentinel-pointer null-guard tests that never actually ran on Windows. Two issues stacked on top of each other:
@ptrFromInt(0xDEAD1)violates Zig 0.15.2's pointer-alignment check for?*ID3D12Resource/?*ID3D12GraphicsCommandList, sozig build testfailed 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.log.err, which the Zig test runner counts vialog_err_countand the build runner reports aslogged errors.This PR fixes both:
0xDEAD1→0xDEAD8(still distinct from0xDEAD0, still grep-locatable in a panic dump, now 8-byte aligned).log.errcalls inuploadRegionare downgraded tolog.warn. The warning is still logged for diagnostics, the caller still receiveserror.UploadFailed, andState.uploadstill drops the placement viamarkForUnload(renderer/image: drop placement after upload failure #383).errwas the wrong signal level for a recoverable, caller-handled state.Test plan
zig build testpasses on Windows (verified locally; pre-fix failed with 3 compile errors then 3logged errors)zig buildclean🤖 Generated with Claude Code