Repository navigation
D3D12.X: a title's TEXTURECUBE view is the cube array of its one cube - #149
Merged
ivall merged 1 commit intoNov 23, 2026
Merged
Conversation
Since xcl-dev#117 translated shaders declare every cube T# as a TextureCubeArray, but dev_create_srv_x forwarded a title's own SRV description unchanged: a D3D12_SRV_DIMENSION_TEXTURECUBE view was bound to a shader that declares a cube array, a dimension mismatch D3D12 leaves undefined (the risk noted on xcl-dev#117). It now becomes TEXTURECUBEARRAY { First2DArrayFace 0, NumCubes 1 } with the view's mips and LOD clamp; format, mapping and every other view dimension are forwarded as before. Device xcl-dev#70 (views of memory) goes through the same path. Test srv_tests::a_cube_view_becomes_the_cube_array_of_one_cube. Co-Authored-By: Claude Code <[email protected]>
Collaborator
|
Merged (main 6da33fa). Checked on an RX 9070 (RDNA4) with the 22 PRs merged together on main eaa36b6: |
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.
Follow-up to the risk @Foniass noted on #117 (#105 item 2).
Since #117, translated shaders declare every cube T# as a
TextureCubeArray. Butdev_create_srv_x(hle/d3d12x/real.rs) still forwarded a title's own SRV description unchanged. So a title that makes aD3D12_SRV_DIMENSION_TEXTURECUBEview had it bound to a shader declaring a cube array, a dimension mismatch that D3D12 leaves undefined.This is the cheap guard suggested there. Before the view is forwarded, a
TEXTURECUBEdescription is rewritten into:TEXTURECUBEARRAYand every other dimension are forwarded unchanged.dev_create_srv_at_x, views of memory) callsdev_create_srv_x, so it gets the same rewrite.view_shapealready maps dimensions 9 and 10 toImageType::Cubewith 6 layers for one cube.Test:
srv_tests::a_cube_view_becomes_the_cube_array_of_one_cubecovers the rewrite: mips, clamp, format and mapping are kept, and cube arrays and other dimensions are left alone.This test doesn't prove the mismatch was harmful. As Foniass found, a plain
TEXTURECUBESRV sampled correctly on NVIDIA. A GPU test can't fail reliably on undefined behaviour, and the debug layer (d3d12SDKLayers.dll, from the Windows "Graphics Tools" feature) isn't installed on this machine, so I couldn't confirm the validation message goes away. AMD hasn't been checked.Tested on an NVIDIA RTX 3090 (32-lane waves, driver 32.0.16.1714), Windows 11 26200, DXC from SDK 10.0.26100. I ran
cargo test --workspace --no-fail-fastwithout the retail samples:gpu_cube_array_slicespasses. The only 2 skips are by design (no wave64):gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware.console_dlls_e2e,console_shaders,disasm_e2e,gpu_compute_e2e,gpu_pso_e2e,rpf_e2e,xg_oracle: all pass.e2e::test_title_runs_and_game_folder_is_untouchedfails onmaintoo. This PC has noSystem32\xgameruntime.dll, and the test treats the launcher's resultingWARNINGas a failure, the same reason CI: build and tests on a Windows runner (no GPU) #143 skips it on CI. The test title's 50 checks all print[PASS].🤖 Generated with Claude Code