GPU: real 1D textures sampled by 2D image instructions (GPU-based validation id=940) #1714

Open
opened 2026-11-26 04:42:24 +00:00 by github-bot · 6 comments
Owner

@⁠Bullet18x on GitHub · 2026-11-24 21:08 UTC · original

GPU-based validation reports, in pixel shaders during the menus:

GPU-BASED VALIDATION: Draw, SRV resource dimensions differs from that expected by shader:
SRV Dimension Expected: D3D12_SRV_DIMENSION_TEXTURE2D, SRV Dimension In Descriptor: D3D12_SRV_DIMENSION_TEXTURE1D (id=940)

#205 fixed the UAV case of this and noted that this SRV case "is a separate issue and is not addressed here". #568 covers 1D null placeholders in slots a later draw reads as 2D. This issue is about real 1D textures.

Evidence (RTX 5090, driver 621.40, Windows 11 10.0.28000, main ffe310e, diag build, menus; a temporary log in descriptor/host.rs make() for shader views whose title ViewDimension is 2, not part of any PR):

  • Real views with a real resource behind them, ViewDimension 2 (TEXTURE1D) on resources with Dimension 2 (TEXTURE1D), in the first ~55 s:
    • 17× 16×1, format 24 (R10G10B10A2_UNORM)
    • 2× 4096×1, format 41 (R32_FLOAT)
    • 1× 128×1, format 34 (R16G16_FLOAT)
  • Also 1D null placeholders from null_like (#568's case): mostly format 65.
  • With VICTORY_D3D12_GBV=1, 5× id=940 in the menus (Asm Instruction Range 0x46 / 0x4e).

So the title makes 1D textures and 1D views, and at least one of its pixel shaders reads them with an image instruction whose dim is 2D. The console hardware goes by the descriptor's type and ignores the extra coordinate; D3D12 requires the declared resource type to match the view, so the read is undefined on the host (and GBV flags it).

Proposed fix (I'm happy to write it, unless someone already is or you prefer another way):

  1. Host textures: make a title TEXTURE1D (and 1D array) a TEXTURE2D (2D array) with height 1.
  2. Views: turn the title's 1D / 1D-array SRVs and UAVs into 2D / 2D-array views of the same mips and slices (and the null views in null_like / null_for likewise).
  3. Shaders: lower dim 1D / 1D_ARRAY image instructions as 2D / 2D_ARRAY with y = 0 (the slice moving to the third coordinate), and image_get_resinfo keeps reporting the 1D sizes.

Then every 1D read, whichever dim the instruction names, matches a 2D view. Questions before I start: is anyone on this already, and is "1D as 2D, height 1" the direction you want (vs. something narrower)?

No game data, title-content log lines or screenshots attached. AI use: Claude Code (Claude Opus 5.5) traced this and wrote the issue; I checked it.

**@⁠Bullet18x** on GitHub · 2026-11-24 21:08 UTC · [original](https://github.com/Marvisak/VIctory/issues/1714) GPU-based validation reports, in pixel shaders during the menus: ``` GPU-BASED VALIDATION: Draw, SRV resource dimensions differs from that expected by shader: SRV Dimension Expected: D3D12_SRV_DIMENSION_TEXTURE2D, SRV Dimension In Descriptor: D3D12_SRV_DIMENSION_TEXTURE1D (id=940) ``` #205 fixed the UAV case of this and noted that this SRV case "is a separate issue and is not addressed here". #568 covers 1D *null placeholders* in slots a later draw reads as 2D. This issue is about **real** 1D textures. **Evidence** (RTX 5090, driver 621.40, Windows 11 10.0.28000, `main` `ffe310e`, diag build, menus; a temporary log in `descriptor/host.rs` `make()` for shader views whose title `ViewDimension` is 2, not part of any PR): - Real views with a real resource behind them, `ViewDimension` 2 (TEXTURE1D) on resources with `Dimension` 2 (TEXTURE1D), in the first ~55 s: - 17× 16×1, format 24 (R10G10B10A2_UNORM) - 2× 4096×1, format 41 (R32_FLOAT) - 1× 128×1, format 34 (R16G16_FLOAT) - Also 1D null placeholders from `null_like` (#568's case): mostly format 65. - With `VICTORY_D3D12_GBV=1`, 5× id=940 in the menus (Asm Instruction Range 0x46 / 0x4e). So the title makes 1D textures and 1D views, and at least one of its pixel shaders reads them with an image instruction whose `dim` is 2D. The console hardware goes by the descriptor's type and ignores the extra coordinate; D3D12 requires the declared resource type to match the view, so the read is undefined on the host (and GBV flags it). **Proposed fix** (I'm happy to write it, unless someone already is or you prefer another way): 1. Host textures: make a title TEXTURE1D (and 1D array) a TEXTURE2D (2D array) with height 1. 2. Views: turn the title's 1D / 1D-array SRVs and UAVs into 2D / 2D-array views of the same mips and slices (and the null views in `null_like` / `null_for` likewise). 3. Shaders: lower `dim` 1D / 1D_ARRAY image instructions as 2D / 2D_ARRAY with y = 0 (the slice moving to the third coordinate), and `image_get_resinfo` keeps reporting the 1D sizes. Then every 1D read, whichever `dim` the instruction names, matches a 2D view. Questions before I start: is anyone on this already, and is "1D as 2D, height 1" the direction you want (vs. something narrower)? No game data, title-content log lines or screenshots attached. AI use: Claude Code (Claude Opus 5.5) traced this and wrote the issue; I checked it.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:42:24 +00:00
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-24 21:08 UTC · original

No one here is on it (checked #1633/CLAIMS.md and the open PRs), so please go ahead with the proposed 1D-as-2D direction. The three parts (host textures, views including null_like/null_for, and the shader dim lowering with get_resinfo unchanged) read coherently; happy to review the PR or run its synthetic checks on an RX 7800 XT.

**@⁠Calvix2k** on GitHub · 2026-11-24 21:08 UTC · [original](https://github.com/Marvisak/VIctory/issues/1714#issuecomment-7144536261) No one here is on it (checked #1633/CLAIMS.md and the open PRs), so please go ahead with the proposed 1D-as-2D direction. The three parts (host textures, views including null_like/null_for, and the shader dim lowering with get_resinfo unchanged) read coherently; happy to review the PR or run its synthetic checks on an RX 7800 XT.
Author
Owner

@⁠BastienRodz on GitHub · 2026-11-24 21:08 UTC · original

For coordination with #568 (mine): its 4b4d504 already covers the null side of this for annotated reads. A title view the host can't make (an SRV with no resource) takes the typed null the reading draw annotates, Texture2D here, instead of null_for's 1D one. b2a6bd2 keeps that from flipping between kinds while earlier draws are in flight. So your step 2 for null_for/null_like would mostly matter for unannotated (dynamically indexed) reads, and it touches the same lines in descriptor/host.rs. If yours lands first I'll rebase #568 onto it, and if #568 lands first the conflict is small. Steps 1 and 3 (real 1D textures as 2D with height 1, and the dim lowering) don't overlap at all.

**@⁠BastienRodz** on GitHub · 2026-11-24 21:08 UTC · [original](https://github.com/Marvisak/VIctory/issues/1714#issuecomment-7144540492) For coordination with #568 (mine): its `4b4d504` already covers the null side of this for annotated reads. A title view the host can't make (an SRV with no resource) takes the typed null the reading draw annotates, Texture2D here, instead of `null_for`'s 1D one. `b2a6bd2` keeps that from flipping between kinds while earlier draws are in flight. So your step 2 for `null_for`/`null_like` would mostly matter for unannotated (dynamically indexed) reads, and it touches the same lines in `descriptor/host.rs`. If yours lands first I'll rebase #568 onto it, and if #568 lands first the conflict is small. Steps 1 and 3 (real 1D textures as 2D with height 1, and the `dim` lowering) don't overlap at all.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-24 21:15 UTC · original

On the "1D as 2D" direction: one constraint that decides the shape of it

I looked at what the fix meets in the code rather than at the report, and there is one thing worth settling before writing it, because it decides between two very different implementations.

crates/victory-gpu/src/resource.rs::host_texture passes the title's description to CreateCommittedResource almost unchanged (it zeroes layout and alignment, masks the flags, maps the format). So a title 1D texture becomes a D3D12_RESOURCE_DIMENSION_TEXTURE1D copy with Layout: 0 — tiled — while the console's own layout for a 1D texture is linear: resource.rs maps TEXTURE_1D to Dimension::Tex1d and then Swizzle::LINEAR for it, and the upload path in texture.rs writes the console bytes accordingly.

Which means: if the host copy becomes a plain 2D texture, it is a tiled 2D texture of height 1, and the linear bytes the title uploads no longer map onto it — you would need a new linear→tiled conversion for 1D uploads, which is a much bigger change than the report implies.

The way that avoids it: create the host copy as TEXTURE2D with Height = 1 and Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR. Row-major keeps the console's bytes in the same order (GetCopyableFootprints then gives a row pitch that matches), and the crate already uses row-major resources in five places (resource.rs:1713, host.rs:805, host.rs:1411, host.rs:1786, capture.rs:136), so the pattern is established. With that, the SRV description becomes TEXTURE2D with Height 1 and the reading pixel shader's 2D instruction is correct by construction, and get_resinfo still reports the 1D dimensions the console's shader expects (as your proposal says).

Two limits of that route, from D3D12's side rather than from the title:

  1. row-major resources cannot be render targets, depth targets or UAVs, and take exactly one mip and one array slice. If any of those 1D textures is ever written as a UAV, it needs the other branch (keep the 1D resource, and lower the image instruction's dim to 1D instead of making the texture 2D) — which is what #205's case ended up doing for the UAV side, per your report.
  2. The resource state, the clear value and the host_texture ladder stay as they are; only the description changes, so the check The host has no sRGB unordered access and the depth/UAV masking further down do not need to move.

One coordination note, since it is the same function: the fallback ladder in #1630 also edits host_texture's description before creation (it retries a refused description without the clear value, without the UAV permission, and so on). Whichever of the two merges second will rebase in that function; the two changes are independent in intent, but if you want to avoid the conflict entirely, building the 1D-as-2D description first and then handing it to the ladder is the arrangement that keeps both.

I am not claiming this one — it is yours and you already have the evidence — and I cannot test it here: my machine has no presentable desktop (the agent runs in session 0), and the menus in a headless run take about 55 s to reach the point where the 17 16×1 views exist, which is fine, but the GPU-based validation part needs the debug layer to stay clean, and I would rather not send you numbers from a run I cannot fully verify.

No game data is involved: descriptions, layouts and offsets only.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-24 21:15 UTC · [original](https://github.com/Marvisak/VIctory/issues/1714#issuecomment-7144684299) **On the "1D as 2D" direction: one constraint that decides the shape of it** I looked at what the fix meets in the code rather than at the report, and there is one thing worth settling before writing it, because it decides between two very different implementations. `crates/victory-gpu/src/resource.rs::host_texture` passes the title's description to `CreateCommittedResource` almost unchanged (it zeroes `layout` and `alignment`, masks the flags, maps the format). So a title 1D texture becomes a `D3D12_RESOURCE_DIMENSION_TEXTURE1D` copy with `Layout: 0` — *tiled* — while the console's own layout for a 1D texture is **linear**: `resource.rs` maps `TEXTURE_1D` to `Dimension::Tex1d` and then `Swizzle::LINEAR` for it, and the upload path in `texture.rs` writes the console bytes accordingly. Which means: if the host copy becomes a plain 2D texture, it is a **tiled** 2D texture of height 1, and the linear bytes the title uploads no longer map onto it — you would need a new linear→tiled conversion for 1D uploads, which is a much bigger change than the report implies. The way that avoids it: create the host copy as `TEXTURE2D` with `Height = 1` **and** `Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR`. Row-major keeps the console's bytes in the same order (`GetCopyableFootprints` then gives a row pitch that matches), and the crate already uses row-major resources in five places (`resource.rs:1713`, `host.rs:805`, `host.rs:1411`, `host.rs:1786`, `capture.rs:136`), so the pattern is established. With that, the SRV description becomes `TEXTURE2D` with `Height` 1 and the reading pixel shader's 2D instruction is correct by construction, and `get_resinfo` still reports the 1D dimensions the console's shader expects (as your proposal says). Two limits of that route, from D3D12's side rather than from the title: 1. **row-major resources cannot be render targets, depth targets or UAVs**, and take exactly one mip and one array slice. If any of those 1D textures is ever written as a UAV, it needs the other branch (keep the 1D resource, and lower the image instruction's dim to 1D instead of making the texture 2D) — which is what #205's case ended up doing for the UAV side, per your report. 2. The resource state, the clear value and the `host_texture` ladder stay as they are; only the description changes, so the check `The host has no sRGB unordered access` and the depth/UAV masking further down do not need to move. One coordination note, since it is the same function: the fallback ladder in https://git.gtahub.st/github/Marvisak--VIctory/pulls/1630 also edits `host_texture`'s description before creation (it retries a refused description without the clear value, without the UAV permission, and so on). Whichever of the two merges second will rebase in that function; the two changes are independent in intent, but if you want to avoid the conflict entirely, building the 1D-as-2D description *first* and then handing it to the ladder is the arrangement that keeps both. I am not claiming this one — it is yours and you already have the evidence — and I cannot test it here: my machine has no presentable desktop (the agent runs in session 0), and the menus in a headless run take about 55 s to reach the point where the 17 `16×1` views exist, which is fine, but the GPU-based validation part needs the debug layer to stay clean, and I would rather not send you numbers from a run I cannot fully verify. No game data is involved: descriptions, layouts and offsets only. Written with an AI assistant.
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-24 21:24 UTC · original

I checked the upload part of the proposed 1D-as-2D change on WARP at ffe310eb2098e52169f4c44db5ffdabf43a72622. A synthetic guest texture was 16×1 RGBA8 with two mips and two array slices. The guest description and its linear layout stayed the same. The only prototype change was to create the DEFAULT-heap host resource as Texture2D, height 1, with the existing D3D12_TEXTURE_LAYOUT_UNKNOWN.

The existing texture::upload path took the guest layout, populated the placed upload footprints and recorded CopyTextureRegion. All 192 bytes read back exactly across the four host subresources. The original SHA's host resource was Texture1D, as expected. All seven resource::tests passed with the prototype.

This verifies the upload side of the change. The remaining pieces are descriptor conversion and shader sampling. The buffer footprint carries the linear bytes while D3D12 manages the destination texture's layout. Microsoft's upload documentation

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-24 21:24 UTC · [original](https://github.com/Marvisak/VIctory/issues/1714#issuecomment-7144882940) I checked the upload part of the proposed 1D-as-2D change on WARP at `ffe310eb2098e52169f4c44db5ffdabf43a72622`. A synthetic guest texture was 16×1 RGBA8 with two mips and two array slices. The guest description and its linear layout stayed the same. The only prototype change was to create the DEFAULT-heap host resource as Texture2D, height 1, with the existing `D3D12_TEXTURE_LAYOUT_UNKNOWN`. The existing `texture::upload` path took the guest layout, populated the placed upload footprints and recorded `CopyTextureRegion`. All 192 bytes read back exactly across the four host subresources. The original SHA's host resource was Texture1D, as expected. All seven `resource::tests` passed with the prototype. This verifies the upload side of the change. The remaining pieces are descriptor conversion and shader sampling. The buffer footprint carries the linear bytes while D3D12 manages the destination texture's layout. [Microsoft's upload documentation](https://learn.microsoft.com/en-us/windows/win32/direct3d12/upload-and-readback-of-texture-data)
Author
Owner

@⁠DesertGamer on GitHub · 2026-11-24 21:32 UTC · original

Heads-up: VIctory V2, a community integration fork

Hi everyone!

I want to help get community contributions into the project faster, so I've started VIctory V2, an integration fork of this repository:
https://github.com/DesertGamer/VIctory-V2

What it does

  • Merges open community PRs from upstream in batches
  • Screens each PR for suspicious content (binaries, build.rs, git hooks, scripts, new dependencies)
  • Runs tests after every batch
  • Resolves conflicts between PRs and records the reasoning in the commit message

Please note

  • V2 is not an official project and is not endorsed by the original author.
  • Original history and commit authorship are preserved, and V2 is regularly synced with upstream main.
  • Licensed under GPL-3.0-or-later, same as upstream.
  • Current status is the same as upstream: not playable yet. The world loads, but world rendering crashes with a GPU device-removed error (tested on Windows 11 / RX 6700 XT).

If your PR has been sitting unreviewed, feel free to point me to it. Feedback and bug reports are welcome in the V2 repo.

If this post doesn't belong in this section, let me know and I'll remove it.

**@⁠DesertGamer** on GitHub · 2026-11-24 21:32 UTC · [original](https://github.com/Marvisak/VIctory/issues/1714#issuecomment-7145066713) ### Heads-up: VIctory V2, a community integration fork Hi everyone! I want to help get community contributions into the project faster, so I've started **VIctory V2**, an integration fork of this repository: https://github.com/DesertGamer/VIctory-V2 **What it does** - Merges open community PRs from upstream in batches - Screens each PR for suspicious content (binaries, `build.rs`, git hooks, scripts, new dependencies) - Runs tests after every batch - Resolves conflicts between PRs and records the reasoning in the commit message **Please note** - V2 is **not** an official project and is not endorsed by the original author. - Original history and commit authorship are preserved, and V2 is regularly synced with upstream `main`. - Licensed under GPL-3.0-or-later, same as upstream. - Current status is the same as upstream: not playable yet. The world loads, but world rendering crashes with a GPU device-removed error (tested on Windows 11 / RX 6700 XT). If your PR has been sitting unreviewed, feel free to point me to it. Feedback and bug reports are welcome in the V2 repo. If this post doesn't belong in this section, let me know and I'll remove it.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 12:48 UTC · original

Automated triage for the maintainers. Confirmed by reading main (940d32f). A title TEXTURE1D keeps its 1D dimension on the host, because the host copy's description in crates/victory-gpu/src/resource.rs takes the title's Dimension as is. Its shader views keep the title's 1D ViewDimension too: srv_desc in crates/victory-gpu/src/descriptor/host.rs copies the title's view words unchanged apart from the format, and make hands them to CreateShaderResourceView. A pixel shader that reads such a view with a 2D image instruction therefore declares a Texture2D over a 1D view, which GPU-based validation reports as id=940. Nothing changes the 1D case on the shader side either.

Open PR #1727 (1D textures are 2D on the host, one texel high) addresses this. The comments above settle the upload side (andrewpozdnakov7-jpg's WARP check: a 2D height-1 host texture with the existing layout takes the linear upload byte for byte) and the overlap with #568's typed nulls.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 12:48 UTC · [original](https://github.com/Marvisak/VIctory/issues/1714#issuecomment-7162883804) <!-- victory-issue-triage v1 verdict=confirmed seen=2026-11-24T21:32:32Z at=2026-11-25T12:48:03Z --> Automated triage for the maintainers. Confirmed by reading `main` (940d32f). A title TEXTURE1D keeps its 1D dimension on the host, because the host copy's description in `crates/victory-gpu/src/resource.rs` takes the title's `Dimension` as is. Its shader views keep the title's 1D `ViewDimension` too: `srv_desc` in `crates/victory-gpu/src/descriptor/host.rs` copies the title's view words unchanged apart from the format, and `make` hands them to `CreateShaderResourceView`. A pixel shader that reads such a view with a 2D image instruction therefore declares a Texture2D over a 1D view, which GPU-based validation reports as id=940. Nothing changes the 1D case on the shader side either. Open PR #1727 (1D textures are 2D on the host, one texel high) addresses this. The comments above settle the upload side (andrewpozdnakov7-jpg's WARP check: a 2D height-1 host texture with the existing layout takes the linear upload byte for byte) and the overlap with #568's typed nulls. --- _Generated by [Claude Code](https://claude.ai/code)_
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory#1714
No description provided.