Skip to content

d3d12_compute_test: the CachedPSO blob's bytes no longer hide the test's bytes (C4456) - #2852

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
etcetera-yt:compute-test-cachedpso-bytes
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
etcetera-yt:compute-test-cachedpso-bytes

Conversation

@etcetera-yt

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: new BUILD item, MSVC C4456 in runtime/test/d3d12_compute_test.cpp (claim)

What and why

#1683 (9cc95bf) added the CachedPSO checks to d3d12_compute_test. They copy the cached blob into a vector named bytes, which hides the test's constexpr UINT elements = 64, bytes = elements * 4; (line 285). On main ec8ec4c9, MSVC prints:

runtime\test\d3d12_compute_test.cpp(395,39): warning C4456: declaration of 'bytes' hides previous local declaration

The vector is now blob_bytes (8 lines, one file). Nothing else changes, so there's no change in behaviour.

Nothing is left for this item. On main, the build has two other new C4996 warnings in tests, fopen at d3d12_bundle_test.cpp:518 and getenv at d3d12_first_light_test.cpp:68; they are separate items. The xgameruntime.cpp C4201/C4996 warnings are left to #1798, per #2296.

Tested

NVIDIA GeForce RTX 5060 Ti, driver 621.14, Windows 10 19045. VS 2022 Build Tools (MSVC), Vulkan SDK 1.4.363.0.

cmake -S runtime -B runtime/build
cmake --build runtime/build --config RelWithDebInfo -- -m:2
ctest --test-dir runtime/build -C RelWithDebInfo --output-on-failure
LEONIDA_VK_VALIDATION=1 ctest --test-dir runtime/build -C RelWithDebInfo --output-on-failure
main ec8ec4c9 this PR 78ea5f84
build warnings 14, including this C4456 13, no C4456
ctest 120/121, 8 skipped; d3d12_vulkan_device fails same
ctest, validation on 120/121, 7 skipped; same failure, no VUIDs same
d3d12_compute Passed Passed (both ways)

d3d12_vulkan_device fails on Windows 10 with and without this PR (new format 191: the host refuses a texture the layer creates: the Windows 10 runtime has no A4B4G4R4). #2438 fixes that.

Not tested: a clang-cl build, and other GPUs. The change is a rename, so there is no negative control beyond the warning itself, which main still prints.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

AI-assisted (Claude Code).

🤖 Generated with Claude Code

…t's bytes (C4456)

The CachedPSO block (9cc95bf) copies the cached blob into a
std::vector<std::uint8_t> named bytes, which hides the test's
constexpr UINT bytes = elements * 4 (line 285); MSVC reports C4456 at
line 395. The vector is now blob_bytes. No behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tupacfan04

Copy link
Copy Markdown
Contributor

Code read of 78ea5f84. Looks right. A pure rename of the shadowing local (bytes → blob_bytes) in that block, with every use updated, so C4456 goes away and behaviour is unchanged.

AI-assisted review (Claude Code).

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pure C4456 fix, verified by inspection: the cached-blob vector is renamed to blob_bytes and all six uses (the byte loop, copy, and five resealed() calls) are updated; the constexpr UINT ... bytes at line 285 is untouched, as are its uses. No behaviour change, git diff --check clean, one file +8/-8. A configured MSVC build is not present in the worktree, so I did not re-run the warning build; the diff is exactly the warning the body quotes. Approve.

@iurysf

iurysf commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested 78ea5f84 on RTX 4070 (NVIDIA 621.01), Windows 11 (10.0.26300), MSVC 14.44, Windows SDK 10.0.26100, Vulkan SDK 1.4.363.1, RelWithDebInfo: pass.

  • Base ec8ec4c9 builds with one warning C4456 at d3d12_compute_test.cpp(395) (14 warning lines in total). Recompiling d3d12_compute_test on this head prints no warnings, so C4456 is gone.
  • ctest --test-dir runtime/build -C RelWithDebInfo --output-on-failure: 121 passed, 0 failed on both ec8ec4c9 and this head (8 skipped and gameinput disabled, identical on both: no game files, no LEONIDA_VK_VALIDATION, no RGB9E5 render targets on this GPU, no SDL3). d3d12_compute passes.
  • Unlike the Windows 10 run in the description, d3d12_vulkan_device passes here on both base and head.

Not tested: validation layers, clang-cl, other GPUs. Tested with AI assistance (Claude); no game files or data involved.

@zzEmmazz

Copy link
Copy Markdown
Contributor

Tested 78ea5f84, applied alone on main 77444fa0: pass. Windows 11 (26200), MSVC 14.50 (VS 2026), Ninja RelWithDebInfo. Two GPUs: Ryzen 7 9700X iGPU (RDNA2, AMD 32.0.21042.62) and RTX 3070 (NVIDIA 610.74), picked with LEONIDA_VK_DEVICE.

  • main compiles d3d12_compute_test.cpp with one C4456 warning; with this change it compiles with none.
  • d3d12_compute_test: exit 0 on both GPUs.

@FaKL-Code

Copy link
Copy Markdown
Contributor

Tested 78ea5f8 (merged onto main 77444fa) on NVIDIA GeForce RTX 4060 Ti, driver 610.88 (32.0.16.1088), Windows 11 26200, MSVC 14.51.36231 (VS 2026), Vulkan SDK 1.4.363.0: pass

  • Clean merge; RelWithDebInfo build.
  • Warnings, line numbers aside: main has exactly one C4456, which is d3d12_compute_test.cpp's bytes hiding the outer bytes. With this PR that warning is gone and nothing new appears.
  • ctest -j 4 (all but loader): 120/120 pass, including d3d12_compute, with the same 8 skips as main.
  • loader run on its own: pass.
  • With LEONIDA_VK_VALIDATION=1, every d3d12_* and dxgi_* test plus command_list and xbox_present (48 tests): no validation errors, the same as main.
  • This conflicts textually with TEST-465: give four D3D12 fixtures a --pc-tail-ubo variant #2752 (d3d12_compute_test.cpp). TEST-465: give four D3D12 fixtures a --pc-tail-ubo variant #2752 re-indents the same pipeline-cache block and keeps the inner name bytes, so its build still shows this C4456. Whichever lands second needs a small rebase that keeps the rename blob_bytes.

AI-assisted (Claude).

@etcetera-yt

Copy link
Copy Markdown
Contributor Author

Thanks @Kam471 for the review, @tupacfan04 for the code read, and @iurysf, @zzEmmazz and @FaKL-Code for the test runs. AI-assisted (Claude Code).

@JRamos1993

Copy link
Copy Markdown
Contributor

Tested 78ea5f8 merged onto main 1628210 on an RTX 5090 (driver 616.92), Windows 11, MSVC 19.44, Vulkan SDK 1.4.363, RelWithDebInfo:

  • Full ctest: 130/130.
  • d3d12_compute: passes 20 of 20 runs, and passes under LEONIDA_VK_VALIDATION=1 with 0 validation messages.
  • Warnings: none new in the files this PR changes.

AI-assisted (Claude Code).

@etcetera-yt

Copy link
Copy Markdown
Contributor Author

Thanks @JRamos1993 for the run on the RTX 5090. AI-assisted (Claude Code).

@ItsNotRexed
ItsNotRexed merged commit a3c60ba into ItsNotRexed:main Nov 22, 2026
2 of 4 checks passed
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.

8 participants