GPU: 1D textures are 2D on the host, one texel high (GBV id=940) #1727
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1727
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1727"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Bullet18x on GitHub · 2026-11-24 21:25 UTC · original
Bullet18x:fix/1d-textures-as-2d→main· +231 −18 · 4 files · 1 commits · openFixes #1714 . The SRV case #205 left open: real 1D textures sampled by 2D image instructions.
What changes
victory-gpu/src/resource.rs:host_dimension();host_texturemakes a title TEXTURE1D (1D array) a TEXTURE2D (2D array) of height 1. Uploads already take their footprints from the host texture, so they are unchanged.victory-gpu/src/descriptor/host.rs:srv_desc/uav_descturn the title's 1D and 1D-array views into the 2D forms (the SRV clamp moves pastPlaneSlice; UAVs gainPlaneSlice0);null_uav_desc(#205) makes 1D / 1D-array nulls 2D / 2D array;null_likefollows throughsrv_desc.victory-shader/src/emit/lower.rs:image()declares 1D / 1D-array images as 2D / 2D array and inserts y = 0 into the coordinates (atomics, stores, loads, samples, gradients and offsets get 0 for y); addresses are still read in the console's 1D order, so lod, bias, compare, gradients and offsets are untouched.image_get_resinfoanddescriptor_dataread a 1D array's layers from the third place.Tests
descriptor::host::tests::one_d_shader_views_become_2d_views,one_d_unordered_views_become_2d_views: field-by-field conversion; 2D and buffer views unchanged.descriptor::host::tests::one_d_texture_is_a_2d_host_texture_its_1d_view_fits: a 16x1 2D texture on the device takes the title's 1D view.emit::waterfall_tests::a_1d_sample_reads_the_one_texel_high_2d_texture:WATERFALL_INDEXED_WAVE32with itsimage_sample_lzswitched todim:SQ_RSRC_IMG_1D, validated bydxil.dlland run on hardware and WARP. Without thelower.rschange it fails on the RTX 5090: every lane reads 0.0 (a Texture1D declaration reading a 2D view).null_uavs_keep_the_titles_dimensionupdated (1D → 2D, 1D array → 2D array).Tested (RTX 5090, driver 621.40, Ryzen 9 9950X3D, Windows 11 Pro 10.0.28000, Rust 1.98.1, on
mainffe310e)cargo clippy --workspace --all-targets --locked -- -D warnings: cleancargo clippy --workspace --all-targets --all-features --locked -- -D warnings: cleancargo test --workspace --locked --no-fail-fast: 346 passed, 0 failed, 6 ignored (main: 342)VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_GBV=1, menus, same timeline on both:main5× id=940 (first ~53 s in); this branch 0× id=940, no GPU-based validation message at all in 76 s.Not tested: AMD / Intel GPUs; the world (it hangs on NVIDIA either way, #1586); 1D arrays and 1D UAVs in the title (none were seen; covered by the unit tests only); the console-compiler differential tests (no console SDK here).
No game data in the change or tests. AI use: Claude Code (Claude Opus 5.5) traced the bug, wrote the change and tests and ran them; I reviewed the diff and the results.
The title makes real 1D textures (16x1 R10G10B10A2, 4096x1 R32_FLOAT, 128x1 R16G16_FLOAT in the menus) and samples some of them with 2D image instructions, as the console hardware allows (it goes by the descriptor and ignores the extra coordinate). D3D12 wants the shader's resource type to match the view: GPU-based validation reported id=940 ("SRV Dimension Expected TEXTURE2D, In Descriptor TEXTURE1D") and NVIDIA reads such a mismatch as 0. 1D textures and 1D arrays are now 2D textures and 2D arrays on the host (height 1); the title's 1D views (and the null ones) become 2D views of the same mips and slices; the translation reads every 1D and 1D-array image instruction as 2D with y = 0, the slice moving to the third coordinate, and resinfo and descriptor reads take a 1D array's layers from the 2D array's third place. Co-Authored-By: Claude Opus 5.5 <[email protected]>@Calvix2k on GitHub · 2026-11-24 21:30 UTC · original
Verified head
6cd8375on an AMD RDNA3 machine, which is a useful second vendor next to the RTX 5090 run in the PR description:cargo test -p victory-gpu --locked one_d_ -- --test-threads=1— 3 passed, 0 failed (the view conversions and the 16x1 host texture).cargo test -p victory-shader --locked a_1d_sample_reads_the_one_texel_high_2d_texture -- --test-threads=1— 1 passed on the hardware backend, 0 failed. WARP was skipped (SM 6.2 here), so this confirms the 1D-as-2D read on RDNA3 rather than only on Blackwell.The descriptor mapping and the shader lowering both behave as described; happy to re-run if the branch moves.
@andrewpozdnakov7-jpg on GitHub · 2026-11-24 21:52 UTC · original
The new 2D host copy also needs 2D output views. At
6cd8375a23d5e5065c1a277af582f7a15a10ce13, an explicit 1D-array render-target view still described a 1D resource. The DSV path used the same unconverted dimensions.3d4f1c8 is one commit directly on that SHA. The two new tests failed on the original head at the RTV dimension assertions. With the fix, the descriptor tests preserve mip, layer range and DSV flags. On WARP, the actual clear of layer 1, mip 1 returned four texels of
[255, 128, 64, 255]. All five 1D GPU tests passed, and the full GPU suite had 58 passed and one ignored. Strict GPU Clippy andcargo xtask policypassed.@AlanQiang0418 on GitHub · 2026-11-24 23:13 UTC · original
I checked the promoted 1D sampling path at
6cd8375on an RTX 5080 (621.14) and Microsoft WARP. Setting a linear sampler's V address mode to BORDER exposes a difference that point sampling hides. With a transparent black border, the 32 lanes should read alternating 1.0 and 2.0. Both devices read 0.5 and 1.0 instead. The inserted normalized y = 0 lands on the edge of the single row, so half the filtered value comes from the border.Sampling at y = 0.5 restored all 32 readbacks on both devices. Integer loads, stores, offsets and gradients keep their zero Y component. The existing 1D shader test now exercises linear filtering with a contrasting border. Cherry-pickable fix and regression
cargo test -p victory-shader --locked --lib -- --test-threads=1passed 121 tests with one ignored. DXIL validation passed for the targeted readback. This used a synthetic 1D texture on Windows 11. Game rendering and 1D-array readbacks were outside this run. AI-assisted verification and fix.@Marvisak on GitHub · 2026-11-25 01:35 UTC · original
Automated triage for the maintainers.
Needs rebase. This pull request conflicts with
main(conflicting:crates/victory-shader/src/emit/lower.rs). It will be reviewed once it is rebased onto the currentmain.Generated by Claude Code
@AlanQiang0418 on GitHub · 2026-11-25 02:27 UTC · original
For the rebase requested above, I replayed
6cd8375on upstream940d32fand resolved the conflict in the image-atomic lowering. The merged code keeps the two-register old value and feature flags for 64-bit atomics from main, and uses the promoted host dimension when declaring the UAV handle.At the second commit the 1D linear-border sampler readback and the existing 64-bit image atomic test passed on RTX 5080 (621.14) and WARP. The three 1D resource/view tests and all-targets Clippy for
victory-gpuandvictory-shaderpassed. These two commits are on my fork for you to pick up.@catminou4 on GitHub · 2026-11-24 21:41 UTC · original · approved these changes
Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (
ffe310e), cargo test -p victory-shader --locked → 96 passed, 0 failed. Windows-gated execution/hardware tests only run on Windows.1D textures become 2D host textures one texel high (GBV id=940): srv_words_2d/uav_words_2d rewrite view desc words (dimension, mip levels, array slices), with unit tests pinning the word layout and a waterfall test for the sample path. The GPU-side host texture creation is Windows-only; the shader-side view lowering is what macOS compiles. Please confirm the Windows waterfall run covers the 1D sample case.
@andrewpozdnakov7-jpg on GitHub · 2026-11-26 13:43 UTC · original
I tested the existing reviewer branch combined with current upstream
63bcca4. Integration56c00ccretains both the authored 1D promotion commit and the separate center-sample fix.On the integrated tree, changing only the normalized sample Y back to zero reproduced the linear-border result on WARP across all 32 lanes:
[0.5, 1.0, ...]. With the original center-sample fix restored, the exact same test reads[1.0, 2.0, ...].The integration is available for the existing PR. If you take it, please retain both contributor commits and their Git authors. If you fold the integration work into a different commit, please add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.AI-assisted with Codex.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.