GPU: the two 2560x1440 targets a boot asks for are refused by the host, and the log does not say why #1600

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

@⁠fiestorra on GitHub · 2026-11-24 19:41 UTC · original

What's wrong

A windowed boot asks the host for two 2560×1440 textures and never gets them. Both CreateCommittedResource calls fail with E_INVALIDARG, in both of my 900-second runs, at the same two descriptions:

WARN victory_gpu::resource: no host texture error=The parameter is incorrect. (0x80070057)
  desc=ResourceDesc { dimension: 3, width: 2560, height: 1440, depth_or_array_size: 1,
  mip_levels: 1, format: 86, sample_count: 1, sample_quality: 0, layout: 0, flags: 5 }
WARN victory_gpu::resource: no host texture error=The parameter is incorrect. (0x80070057)
  desc=ResourceDesc { dimension: 3, width: 2560, height: 1440, depth_or_array_size: 1,
  mip_levels: 1, format: 115, sample_count: 1, sample_quality: 0, layout: 0, flags: 1 }

Format 86 is DXGI_FORMAT_B5G5R5A1_UNORM, 115 is DXGI_FORMAT_B4G4R4A4_UNORM; flags 5 is render-target and unordered-access, flags 1 is render-target. 2560×1440 is the title's internal render size, and both appear 6 and 11 seconds into a run that presents, right after presenting to a window width=3840 height=2160 — never in a run that cannot present (mine could not, today). A texture with no host copy cannot be an RTV, an SRV or a UAV, so every draw that names one is lost, and nothing in the log says which argument the host refused.

What the host actually accepts

An ignored GPU test asks for exactly those descriptions on the hardware adapter (cargo test --release -p victory-gpu -- --ignored --nocapture packed_formats). Three findings:

  • The descriptions themselves are legal. Formats 86 and 115 are accepted with every flag combination tried (0, ALLOW_RENDER_TARGET 1, ALLOW_UNORDERED_ACCESS 4, both 5, and the neighbours 87 and 28 too). Only ALLOW_RENDER_TARGET | ALLOW_DEPTH_STENCIL (3) is refused, as documented.
  • A colour clear value must name the resource's own format: format 86 with a clear naming 86 works, naming 0 or 28 gives E_INVALIDARG.
  • A depth clear value must name the pair's other format, and the rule is inverted from the colour one: a resource made as D32_FLOAT_S8X24_UINT (19) is refused with a clear naming 19 and accepted with a clear naming R32_FLOAT_X8X24_TYPELESS (20); R16_TYPELESS (53) is accepted with a clear naming D16_UNORM (55) and refused with 53. Victory passes the title's clear through untouched, which is exactly what the host wants here: those depth textures have always been created, and a first version of this patch that dropped every clear whose format differed from the resource's silently dropped 358 legitimate depth clears in a 60-second boot. That version is not what is below.
  • Some initial states are refused: for format 86 with flags 5, states 0xC (render target and unordered access together), 0x1, 0x2 and 0x200 (buffer-only states) fail, while 0x4, 0x8, 0x40, 0x80 and 0xC0 pass.

So the description is fine, and one of the two other arguments — the initial state, or the clear value's format — is what the host refuses on those two colour targets. Neither was in the log, which is the defect worth fixing first: a failure that cannot be diagnosed from the run.

The patch

crates/victory-gpu/src/resource.rs:

  • The failure log now names state (what the host was asked for), title_state (what the title named) and clear.
  • host_texture tries a short ladder of descriptions, most faithful first: what the title asked for; then in the common state; then without the clear value; then without unordered access; and last as plain memory. The state and the permission the title asked for are kept as long as the host takes them, the first description the host accepts is used, and a warning names what was given up (flags_asked/flags_made, state_asked/state_made, clear_asked/clear_dropped), once per texture.
  • It returns the state the texture was really made in, so the transitions that follow start from the truth (HostTexture::state used to assume the asked state).
  • A depth target keeps its depth permission through the ladder, nothing is tried twice, and permissions only ever go down.

Verification

  • cargo test -p victory-gpu --locked → 56 passed, 0 failed (2 ignored: an existing benchmark and the new GPU probe), including a test of the ladder's order and of its first attempt being exactly what the title asked.
  • cargo clippy -p victory-gpu --all-targets --locked -- -D warnings → clean, with and without --features diagnostics.
  • A 60-second boot with the debug layer on and this patch: 1,024 frames, the same 11 programs, no no host texture, no fallback taken — identical to unpatched ffe310e in the same state, so nothing that worked before changes.

What I could not do: name which argument the host refuses in those two cases. My machine cannot create a swap chain today (CreateSwapChainForHwnd → 0x887A0022, step="swap chain", after the backoff patch in #1591), and these two textures are only asked for once presenting works, so the failure does not reproduce headless. Anyone with a presentable desktop can settle it with one boot of the diagnostics build at VICTORY_LOG=info: the no host texture line now carries state, title_state and clear, and if the ladder took over there is a host texture made only as a fallback line. Please paste either line here.

Patch below (against ffe310e; applies independently of #1591):

crates/victory-gpu/src/resource.rs (+318 −43)
diff --git a/crates/victory-gpu/src/resource.rs b/crates/victory-gpu/src/resource.rs
index 46c5c71..8c9872e 100644
--- a/crates/victory-gpu/src/resource.rs
+++ b/crates/victory-gpu/src/resource.rs
@@ -796,13 +796,13 @@ pub(crate) fn host_copy(this: This) -> Option<std::sync::Arc<HostTexture>> {
 }
 
 /// A host texture like the title's: same description, in GPU memory,
-/// without the console's layout and flags.
+/// without the console's layout and flags, with the state it was made in.
 #[cfg(windows)]
 fn host_texture(
     desc: &ResourceDesc,
     state: u32,
     clear: *const c_void,
-) -> Option<windows::Win32::Graphics::Direct3D12::ID3D12Resource> {
+) -> Option<(windows::Win32::Graphics::Direct3D12::ID3D12Resource, u32)> {
     use windows::Win32::Graphics::Direct3D12::*;
     const PC_FLAGS: u32 = 0xf; // render target, depth, UAV, no shader access
     if desc.dimension == BUFFER {
@@ -835,8 +835,12 @@ fn host_texture(
         d.format = family(d.format);
     }
     // The clear value names the format too: format, then color or depth
-    // and stencil (5 words).
-    let clear_value = (!clear.is_null()).then(|| {
+    // and stencil (5 words). The host takes it only when it names the
+    // resource's own format or, for a depth target, the pair's other one
+    // (a texture made as `D32_FLOAT_S8X24_UINT` clears with `R32_FLOAT_X8X24`
+    // and the reverse is refused), so it is tried and dropped only if
+    // refused: that costs the texture's initial contents, not the texture.
+    let clear_value: Option<[u32; 5]> = (!clear.is_null()).then(|| {
         // SAFETY: the title passes a whole clear value.
         let mut value = unsafe { clear.cast::<[u32; 5]>().read_unaligned() };
         value[0] = pc_format(value[0]);
@@ -846,31 +850,98 @@ fn host_texture(
         Type: D3D12_HEAP_TYPE_DEFAULT,
         ..Default::default()
     };
+    let asked = crate::host::legal_for(d.flags, crate::host::texture_state(state));
+    let tries = attempts(d.flags, asked);
     let mut texture: Option<ID3D12Resource> = None;
-    // SAFETY: the description has the host layout (checked size, same
-    // fields); the out pointer is ours.
-    let made = unsafe {
-        host.device.CreateCommittedResource(
-            &heap,
-            D3D12_HEAP_FLAG_NONE,
-            (&raw const d).cast(),
-            D3D12_RESOURCE_STATES(
-                crate::host::legal_for(d.flags, crate::host::texture_state(state)) as i32,
-            ),
-            // The same layout: format, then color or depth and stencil.
-            clear_value.as_ref().map(|v| std::ptr::from_ref(v).cast()),
-            &mut texture,
-        )
-    };
-    if let Err(e) = made {
-        tracing::warn!(error = %e, desc = ?d, "no host texture");
+    let mut made_in = None;
+    for (i, &(flags, initial, keep_clear)) in tries.iter().enumerate() {
+        let mut trial = d;
+        trial.flags = flags;
+        let try_clear = clear_value.filter(|_| keep_clear);
+        texture = None;
+        // SAFETY: the description has the host layout (checked size, same
+        // fields); the out pointer is ours.
+        let made = unsafe {
+            host.device.CreateCommittedResource(
+                &heap,
+                D3D12_HEAP_FLAG_NONE,
+                (&raw const trial).cast(),
+                D3D12_RESOURCE_STATES(initial as i32),
+                // The same layout: format, then color or depth and stencil.
+                try_clear.as_ref().map(|v| std::ptr::from_ref(v).cast()),
+                &mut texture,
+            )
+        };
+        match made {
+            Ok(()) => {
+                if i > 0 {
+                    // The host refused what the title asked for: name what
+                    // was given up, once for this texture.
+                    tracing::warn!(
+                        flags_asked = d.flags,
+                        flags_made = flags,
+                        state_asked = asked,
+                        state_made = initial,
+                        clear_asked = clear_value.map(|v| v[0]),
+                        clear_dropped = clear_value.is_some() && !keep_clear,
+                        "host texture made only as a fallback"
+                    );
+                }
+                made_in = Some(initial);
+                break;
+            }
+            Err(e) if i + 1 == tries.len() => {
+                tracing::warn!(
+                    error = %e,
+                    desc = ?trial,
+                    state = initial,
+                    title_state = state,
+                    clear = try_clear.map(|v| v[0]),
+                    "no host texture"
+                );
+            }
+            Err(e) => {
+                tracing::debug!(error = %e, attempt = i, "host texture refused; trying a fallback");
+            }
+        }
     }
-    if let Some(t) = &texture {
-        crate::host::name(t, || {
-            format!("texture {}x{} f{} flags {:#x}", d.width, d.height, d.format, d.flags)
-        });
+    let texture = texture?;
+    let initial = made_in?;
+    crate::host::name(&texture, || {
+        format!(
+            "texture {}x{} f{} flags {:#x}",
+            d.width, d.height, d.format, d.flags
+        )
+    });
+    Some((texture, initial))
+}
+
+/// The (flags, state, whether the clear value is kept) triples to try for a
+/// host texture, most faithful first: what the title asked for, then in the
+/// common state, then without the clear value, then without the permissions
+/// the host may refuse. A texture the host cannot make as asked still exists
+/// for the draws that read it; the log names what was lost.
+#[cfg(windows)]
+fn attempts(flags: u32, state: u32) -> Vec<(u32, u32, bool)> {
+    const UNORDERED: u32 = 4;
+    const RENDER_TARGET: u32 = 1;
+    let mut out: Vec<(u32, u32, bool)> = Vec::with_capacity(7);
+    for triple in [
+        (flags, state, true),
+        (flags, 0, true),
+        (flags, state, false),
+        (flags, 0, false),
+        (flags & !UNORDERED, 0, true),
+        (flags & !UNORDERED, 0, false),
+        // A depth target keeps its depth permission; only the permissions
+        // that make the host refuse a description are given up.
+        (flags & !UNORDERED & !RENDER_TARGET, 0, false),
+    ] {
+        if !out.contains(&triple) {
+            out.push(triple);
+        }
     }
-    texture
+    out
 }
 
 /// A texture's console memory and description; `None` for buffers.
@@ -936,8 +1007,7 @@ fn hand_out_resource(
         heap_flags,
         backing,
         #[cfg(windows)]
-        host: host.map(|texture| {
-            let state = crate::host::legal_state(&texture, crate::host::texture_state(state));
+        host: host.map(|(texture, state)| {
             std::sync::Arc::new(HostTexture {
                 texture,
                 state: state.into(),
@@ -1841,4 +1911,194 @@ mod tests {
         assert_eq!(slot::<Release>(heap, 0x10)(heap), 1);
         assert_eq!(slot::<Release>(placed, 0x10)(placed), 0);
     }
+
+    /// The ladder of descriptions a host texture is tried in.
+    #[test]
+    fn the_first_attempt_is_what_the_title_asked_for() {
+        assert_eq!(
+            attempts(5, 4),
+            [
+                (5, 4, true),
+                (5, 0, true),
+                (5, 4, false),
+                (5, 0, false),
+                (1, 0, true),
+                (1, 0, false),
+                (0, 0, false),
+            ]
+        );
+        // Nothing is tried twice.
+        assert_eq!(attempts(0, 0), [(0, 0, true), (0, 0, false)]);
+        // A depth target keeps its depth permission in every attempt.
+        let depth = attempts(3, 0x10);
+        assert!(depth.iter().all(|&(flags, _, _)| flags & 2 != 0));
+        // Permissions only ever go down the ladder.
+        let asked = attempts(7, 0).first().copied().unwrap().0;
+        assert!(attempts(7, 0).iter().all(|&(flags, _, _)| flags & !asked == 0));
+    }
+
+    /// What the host accepts for the descriptions a boot asks for and never
+    /// gets: two 2560x1440 textures, `B5G5R5A1_UNORM` with render-target and
+    /// unordered-access (format 86, flags 5) and `B4G4R4A4_UNORM` with
+    /// render-target (format 115, flags 1), both refused with `E_INVALIDARG`.
+    /// Run with `cargo test --release -p victory-gpu -- --ignored --nocapture packed_formats`.
+    #[test]
+    #[ignore = "needs the host GPU"]
+    fn packed_formats_the_host_refuses() {
+        use windows::Win32::Graphics::Direct3D::D3D_FEATURE_LEVEL_12_0;
+        use windows::Win32::Graphics::Direct3D12::*;
+        use windows::Win32::Graphics::Dxgi::Common::*;
+        let mut made: Option<ID3D12Device> = None;
+        // SAFETY: a plain device for the default adapter.
+        let result =
+            unsafe { D3D12CreateDevice(None, D3D_FEATURE_LEVEL_12_0, &mut made) };
+        let Ok(()) = result else {
+            println!("no D3D12 device: {result:?}");
+            return;
+        };
+        let Some(device) = made else { return };
+        let heap = D3D12_HEAP_PROPERTIES {
+            Type: D3D12_HEAP_TYPE_DEFAULT,
+            ..Default::default()
+        };
+        for format in [86u32, 115, 87, 28] {
+            for flags in [0u32, 1, 4, 5, 3] {
+                let desc = D3D12_RESOURCE_DESC {
+                    Dimension: D3D12_RESOURCE_DIMENSION_TEXTURE2D,
+                    Alignment: 0,
+                    Width: 2560,
+                    Height: 1440,
+                    DepthOrArraySize: 1,
+                    MipLevels: 1,
+                    Format: DXGI_FORMAT(format as i32),
+                    SampleDesc: DXGI_SAMPLE_DESC {
+                        Count: 1,
+                        Quality: 0,
+                    },
+                    Layout: D3D12_TEXTURE_LAYOUT_UNKNOWN,
+                    Flags: D3D12_RESOURCE_FLAGS(flags as i32),
+                };
+                let mut texture: Option<ID3D12Resource> = None;
+                let clear: Option<*const D3D12_CLEAR_VALUE> = None;
+                // SAFETY: plain creation of a 2560x1440 texture.
+                let made = unsafe {
+                    device.CreateCommittedResource(
+                        &heap,
+                        D3D12_HEAP_FLAG_NONE,
+                        &raw const desc,
+                        D3D12_RESOURCE_STATE_COMMON,
+                        clear,
+                        &mut texture,
+                    )
+                };
+                println!(
+                    "format {format} flags {flags:#x}: {}",
+                    match &made {
+                        Ok(()) => "ok".to_owned(),
+                        Err(e) => format!("{e}"),
+                    }
+                );
+            }
+        }
+        // Every state a title may name, for the two descriptions a boot asks
+        // for and never gets.
+        let states = [0x1u32, 0x2, 0x4, 0x8, 0xc, 0x10, 0x20, 0x40, 0x80, 0xc0, 0x200, 0x400, 0x800];
+        for (format, flags) in [(86u32, 5u32), (115, 1)] {
+            let desc = D3D12_RESOURCE_DESC {
+                Dimension: D3D12_RESOURCE_DIMENSION_TEXTURE2D,
+                Alignment: 0,
+                Width: 2560,
+                Height: 1440,
+                DepthOrArraySize: 1,
+                MipLevels: 1,
+                Format: DXGI_FORMAT(format as i32),
+                SampleDesc: DXGI_SAMPLE_DESC {
+                    Count: 1,
+                    Quality: 0,
+                },
+                Layout: D3D12_TEXTURE_LAYOUT_UNKNOWN,
+                Flags: D3D12_RESOURCE_FLAGS(flags as i32),
+            };
+            for state in states {
+                let mut texture: Option<ID3D12Resource> = None;
+                let clear: Option<*const D3D12_CLEAR_VALUE> = None;
+                // SAFETY: plain creation of a 2560x1440 texture.
+                let made = unsafe {
+                    device.CreateCommittedResource(
+                        &heap,
+                        D3D12_HEAP_FLAG_NONE,
+                        &raw const desc,
+                        D3D12_RESOURCE_STATES(state as i32),
+                        clear,
+                        &mut texture,
+                    )
+                };
+                if made.is_err() {
+                    println!(
+                        "format {format} flags {flags} state {state:#x}: {}",
+                        match &made {
+                            Ok(()) => "ok".to_owned(),
+                            Err(e) => format!("{e}"),
+                        }
+                    );
+                }
+            }
+        }
+        // Clear values that do not name the resource's own format, for the
+        // colour pair and for the two depth pairs a boot asks for: the host
+        // copy of a depth texture is made as the pair's second format, and
+        // the title's clear names the first.
+        for (format, clear_format, flags) in [
+            (86u32, 86u32, 5u32),
+            (86, 0, 5),
+            (86, 28, 5),
+            (19, 19, 2),
+            (19, 20, 2),
+            (20, 20, 2),
+            (53, 55, 2),
+            (53, 53, 2),
+            (20, 20, 1),
+        ] {
+            let desc = D3D12_RESOURCE_DESC {
+                Dimension: D3D12_RESOURCE_DIMENSION_TEXTURE2D,
+                Alignment: 0,
+                Width: 2560,
+                Height: 1440,
+                DepthOrArraySize: 1,
+                MipLevels: 1,
+                Format: DXGI_FORMAT(format as i32),
+                SampleDesc: DXGI_SAMPLE_DESC {
+                    Count: 1,
+                    Quality: 0,
+                },
+                Layout: D3D12_TEXTURE_LAYOUT_UNKNOWN,
+                Flags: D3D12_RESOURCE_FLAGS(flags as i32),
+            };
+            let clear = D3D12_CLEAR_VALUE {
+                Format: DXGI_FORMAT(clear_format as i32),
+                Anonymous: D3D12_CLEAR_VALUE_0 {
+                    Color: [0.0; 4],
+                },
+            };
+            let mut texture: Option<ID3D12Resource> = None;
+            // SAFETY: plain creation of a 2560x1440 texture with a clear value.
+            let made = unsafe {
+                device.CreateCommittedResource(
+                    &heap,
+                    D3D12_HEAP_FLAG_NONE,
+                    &raw const desc,
+                    D3D12_RESOURCE_STATE_COMMON,
+                    Some(&raw const clear),
+                    &mut texture,
+                )
+            };
+            println!(
+                "format {format} flags {flags} clear format {clear_format}: {}",
+                match &made {
+                    Ok(()) => "ok".to_owned(),
+                    Err(e) => format!("{e}"),
+                }
+            );
+        }
+    }
 }

No game data is involved: no shaders, textures, keys or package bytes, only descriptions, states and error codes.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-24 19:41 UTC · [original](https://github.com/Marvisak/VIctory/issues/1600) ### What's wrong A windowed boot asks the host for two 2560×1440 textures and never gets them. Both `CreateCommittedResource` calls fail with `E_INVALIDARG`, in both of my 900-second runs, at the same two descriptions: ``` WARN victory_gpu::resource: no host texture error=The parameter is incorrect. (0x80070057) desc=ResourceDesc { dimension: 3, width: 2560, height: 1440, depth_or_array_size: 1, mip_levels: 1, format: 86, sample_count: 1, sample_quality: 0, layout: 0, flags: 5 } WARN victory_gpu::resource: no host texture error=The parameter is incorrect. (0x80070057) desc=ResourceDesc { dimension: 3, width: 2560, height: 1440, depth_or_array_size: 1, mip_levels: 1, format: 115, sample_count: 1, sample_quality: 0, layout: 0, flags: 1 } ``` Format 86 is `DXGI_FORMAT_B5G5R5A1_UNORM`, 115 is `DXGI_FORMAT_B4G4R4A4_UNORM`; flags 5 is render-target and unordered-access, flags 1 is render-target. 2560×1440 is the title's internal render size, and both appear **6 and 11 seconds into a run that presents**, right after `presenting to a window width=3840 height=2160` — never in a run that cannot present (mine could not, today). A texture with no host copy cannot be an RTV, an SRV or a UAV, so every draw that names one is lost, and nothing in the log says *which* argument the host refused. ### What the host actually accepts An ignored GPU test asks for exactly those descriptions on the hardware adapter (`cargo test --release -p victory-gpu -- --ignored --nocapture packed_formats`). Three findings: - **The descriptions themselves are legal.** Formats 86 and 115 are accepted with every flag combination tried (0, `ALLOW_RENDER_TARGET` 1, `ALLOW_UNORDERED_ACCESS` 4, both 5, and the neighbours 87 and 28 too). Only `ALLOW_RENDER_TARGET | ALLOW_DEPTH_STENCIL` (3) is refused, as documented. - **A colour clear value must name the resource's own format**: format 86 with a clear naming 86 works, naming 0 or 28 gives `E_INVALIDARG`. - **A depth clear value must name the pair's *other* format, and the rule is inverted from the colour one**: a resource made as `D32_FLOAT_S8X24_UINT` (19) is **refused** with a clear naming 19 and **accepted** with a clear naming `R32_FLOAT_X8X24_TYPELESS` (20); `R16_TYPELESS` (53) is accepted with a clear naming `D16_UNORM` (55) and refused with 53. Victory passes the title's clear through untouched, which is exactly what the host wants here: those depth textures have always been created, and a first version of this patch that dropped every clear whose format differed from the resource's silently dropped 358 legitimate depth clears in a 60-second boot. That version is not what is below. - **Some initial states are refused**: for format 86 with flags 5, states `0xC` (render target and unordered access together), `0x1`, `0x2` and `0x200` (buffer-only states) fail, while `0x4`, `0x8`, `0x40`, `0x80` and `0xC0` pass. So the description is fine, and one of the two other arguments — the initial state, or the clear value's format — is what the host refuses on those two colour targets. Neither was in the log, which is the defect worth fixing first: a failure that cannot be diagnosed from the run. ### The patch `crates/victory-gpu/src/resource.rs`: - The failure log now names `state` (what the host was asked for), `title_state` (what the title named) and `clear`. - `host_texture` tries a short ladder of descriptions, most faithful first: what the title asked for; then in the common state; then without the clear value; then without unordered access; and last as plain memory. The state and the permission the title asked for are kept as long as the host takes them, the first description the host accepts is used, and a warning names what was given up (`flags_asked`/`flags_made`, `state_asked`/`state_made`, `clear_asked`/`clear_dropped`), once per texture. - It returns the state the texture was really made in, so the transitions that follow start from the truth (`HostTexture::state` used to assume the asked state). - A depth target keeps its depth permission through the ladder, nothing is tried twice, and permissions only ever go down. ### Verification - `cargo test -p victory-gpu --locked` → **56 passed, 0 failed** (2 ignored: an existing benchmark and the new GPU probe), including a test of the ladder's order and of its first attempt being exactly what the title asked. - `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings` → clean, with and without `--features diagnostics`. - A 60-second boot with the debug layer on and this patch: 1,024 frames, the same 11 programs, **no** `no host texture`, **no** fallback taken — identical to unpatched `ffe310e` in the same state, so nothing that worked before changes. **What I could not do:** name which argument the host refuses in those two cases. My machine cannot create a swap chain today (`CreateSwapChainForHwnd` → `0x887A0022`, `step="swap chain"`, after the backoff patch in #1591), and these two textures are only asked for once presenting works, so the failure does not reproduce headless. Anyone with a presentable desktop can settle it with one boot of the diagnostics build at `VICTORY_LOG=info`: the `no host texture` line now carries `state`, `title_state` and `clear`, and if the ladder took over there is a `host texture made only as a fallback` line. Please paste either line here. Patch below (against `ffe310e`; applies independently of #1591): <details> <summary>crates/victory-gpu/src/resource.rs (+318 −43)</summary> ```diff diff --git a/crates/victory-gpu/src/resource.rs b/crates/victory-gpu/src/resource.rs index 46c5c71..8c9872e 100644 --- a/crates/victory-gpu/src/resource.rs +++ b/crates/victory-gpu/src/resource.rs @@ -796,13 +796,13 @@ pub(crate) fn host_copy(this: This) -> Option<std::sync::Arc<HostTexture>> { } /// A host texture like the title's: same description, in GPU memory, -/// without the console's layout and flags. +/// without the console's layout and flags, with the state it was made in. #[cfg(windows)] fn host_texture( desc: &ResourceDesc, state: u32, clear: *const c_void, -) -> Option<windows::Win32::Graphics::Direct3D12::ID3D12Resource> { +) -> Option<(windows::Win32::Graphics::Direct3D12::ID3D12Resource, u32)> { use windows::Win32::Graphics::Direct3D12::*; const PC_FLAGS: u32 = 0xf; // render target, depth, UAV, no shader access if desc.dimension == BUFFER { @@ -835,8 +835,12 @@ fn host_texture( d.format = family(d.format); } // The clear value names the format too: format, then color or depth - // and stencil (5 words). - let clear_value = (!clear.is_null()).then(|| { + // and stencil (5 words). The host takes it only when it names the + // resource's own format or, for a depth target, the pair's other one + // (a texture made as `D32_FLOAT_S8X24_UINT` clears with `R32_FLOAT_X8X24` + // and the reverse is refused), so it is tried and dropped only if + // refused: that costs the texture's initial contents, not the texture. + let clear_value: Option<[u32; 5]> = (!clear.is_null()).then(|| { // SAFETY: the title passes a whole clear value. let mut value = unsafe { clear.cast::<[u32; 5]>().read_unaligned() }; value[0] = pc_format(value[0]); @@ -846,31 +850,98 @@ fn host_texture( Type: D3D12_HEAP_TYPE_DEFAULT, ..Default::default() }; + let asked = crate::host::legal_for(d.flags, crate::host::texture_state(state)); + let tries = attempts(d.flags, asked); let mut texture: Option<ID3D12Resource> = None; - // SAFETY: the description has the host layout (checked size, same - // fields); the out pointer is ours. - let made = unsafe { - host.device.CreateCommittedResource( - &heap, - D3D12_HEAP_FLAG_NONE, - (&raw const d).cast(), - D3D12_RESOURCE_STATES( - crate::host::legal_for(d.flags, crate::host::texture_state(state)) as i32, - ), - // The same layout: format, then color or depth and stencil. - clear_value.as_ref().map(|v| std::ptr::from_ref(v).cast()), - &mut texture, - ) - }; - if let Err(e) = made { - tracing::warn!(error = %e, desc = ?d, "no host texture"); + let mut made_in = None; + for (i, &(flags, initial, keep_clear)) in tries.iter().enumerate() { + let mut trial = d; + trial.flags = flags; + let try_clear = clear_value.filter(|_| keep_clear); + texture = None; + // SAFETY: the description has the host layout (checked size, same + // fields); the out pointer is ours. + let made = unsafe { + host.device.CreateCommittedResource( + &heap, + D3D12_HEAP_FLAG_NONE, + (&raw const trial).cast(), + D3D12_RESOURCE_STATES(initial as i32), + // The same layout: format, then color or depth and stencil. + try_clear.as_ref().map(|v| std::ptr::from_ref(v).cast()), + &mut texture, + ) + }; + match made { + Ok(()) => { + if i > 0 { + // The host refused what the title asked for: name what + // was given up, once for this texture. + tracing::warn!( + flags_asked = d.flags, + flags_made = flags, + state_asked = asked, + state_made = initial, + clear_asked = clear_value.map(|v| v[0]), + clear_dropped = clear_value.is_some() && !keep_clear, + "host texture made only as a fallback" + ); + } + made_in = Some(initial); + break; + } + Err(e) if i + 1 == tries.len() => { + tracing::warn!( + error = %e, + desc = ?trial, + state = initial, + title_state = state, + clear = try_clear.map(|v| v[0]), + "no host texture" + ); + } + Err(e) => { + tracing::debug!(error = %e, attempt = i, "host texture refused; trying a fallback"); + } + } } - if let Some(t) = &texture { - crate::host::name(t, || { - format!("texture {}x{} f{} flags {:#x}", d.width, d.height, d.format, d.flags) - }); + let texture = texture?; + let initial = made_in?; + crate::host::name(&texture, || { + format!( + "texture {}x{} f{} flags {:#x}", + d.width, d.height, d.format, d.flags + ) + }); + Some((texture, initial)) +} + +/// The (flags, state, whether the clear value is kept) triples to try for a +/// host texture, most faithful first: what the title asked for, then in the +/// common state, then without the clear value, then without the permissions +/// the host may refuse. A texture the host cannot make as asked still exists +/// for the draws that read it; the log names what was lost. +#[cfg(windows)] +fn attempts(flags: u32, state: u32) -> Vec<(u32, u32, bool)> { + const UNORDERED: u32 = 4; + const RENDER_TARGET: u32 = 1; + let mut out: Vec<(u32, u32, bool)> = Vec::with_capacity(7); + for triple in [ + (flags, state, true), + (flags, 0, true), + (flags, state, false), + (flags, 0, false), + (flags & !UNORDERED, 0, true), + (flags & !UNORDERED, 0, false), + // A depth target keeps its depth permission; only the permissions + // that make the host refuse a description are given up. + (flags & !UNORDERED & !RENDER_TARGET, 0, false), + ] { + if !out.contains(&triple) { + out.push(triple); + } } - texture + out } /// A texture's console memory and description; `None` for buffers. @@ -936,8 +1007,7 @@ fn hand_out_resource( heap_flags, backing, #[cfg(windows)] - host: host.map(|texture| { - let state = crate::host::legal_state(&texture, crate::host::texture_state(state)); + host: host.map(|(texture, state)| { std::sync::Arc::new(HostTexture { texture, state: state.into(), @@ -1841,4 +1911,194 @@ mod tests { assert_eq!(slot::<Release>(heap, 0x10)(heap), 1); assert_eq!(slot::<Release>(placed, 0x10)(placed), 0); } + + /// The ladder of descriptions a host texture is tried in. + #[test] + fn the_first_attempt_is_what_the_title_asked_for() { + assert_eq!( + attempts(5, 4), + [ + (5, 4, true), + (5, 0, true), + (5, 4, false), + (5, 0, false), + (1, 0, true), + (1, 0, false), + (0, 0, false), + ] + ); + // Nothing is tried twice. + assert_eq!(attempts(0, 0), [(0, 0, true), (0, 0, false)]); + // A depth target keeps its depth permission in every attempt. + let depth = attempts(3, 0x10); + assert!(depth.iter().all(|&(flags, _, _)| flags & 2 != 0)); + // Permissions only ever go down the ladder. + let asked = attempts(7, 0).first().copied().unwrap().0; + assert!(attempts(7, 0).iter().all(|&(flags, _, _)| flags & !asked == 0)); + } + + /// What the host accepts for the descriptions a boot asks for and never + /// gets: two 2560x1440 textures, `B5G5R5A1_UNORM` with render-target and + /// unordered-access (format 86, flags 5) and `B4G4R4A4_UNORM` with + /// render-target (format 115, flags 1), both refused with `E_INVALIDARG`. + /// Run with `cargo test --release -p victory-gpu -- --ignored --nocapture packed_formats`. + #[test] + #[ignore = "needs the host GPU"] + fn packed_formats_the_host_refuses() { + use windows::Win32::Graphics::Direct3D::D3D_FEATURE_LEVEL_12_0; + use windows::Win32::Graphics::Direct3D12::*; + use windows::Win32::Graphics::Dxgi::Common::*; + let mut made: Option<ID3D12Device> = None; + // SAFETY: a plain device for the default adapter. + let result = + unsafe { D3D12CreateDevice(None, D3D_FEATURE_LEVEL_12_0, &mut made) }; + let Ok(()) = result else { + println!("no D3D12 device: {result:?}"); + return; + }; + let Some(device) = made else { return }; + let heap = D3D12_HEAP_PROPERTIES { + Type: D3D12_HEAP_TYPE_DEFAULT, + ..Default::default() + }; + for format in [86u32, 115, 87, 28] { + for flags in [0u32, 1, 4, 5, 3] { + let desc = D3D12_RESOURCE_DESC { + Dimension: D3D12_RESOURCE_DIMENSION_TEXTURE2D, + Alignment: 0, + Width: 2560, + Height: 1440, + DepthOrArraySize: 1, + MipLevels: 1, + Format: DXGI_FORMAT(format as i32), + SampleDesc: DXGI_SAMPLE_DESC { + Count: 1, + Quality: 0, + }, + Layout: D3D12_TEXTURE_LAYOUT_UNKNOWN, + Flags: D3D12_RESOURCE_FLAGS(flags as i32), + }; + let mut texture: Option<ID3D12Resource> = None; + let clear: Option<*const D3D12_CLEAR_VALUE> = None; + // SAFETY: plain creation of a 2560x1440 texture. + let made = unsafe { + device.CreateCommittedResource( + &heap, + D3D12_HEAP_FLAG_NONE, + &raw const desc, + D3D12_RESOURCE_STATE_COMMON, + clear, + &mut texture, + ) + }; + println!( + "format {format} flags {flags:#x}: {}", + match &made { + Ok(()) => "ok".to_owned(), + Err(e) => format!("{e}"), + } + ); + } + } + // Every state a title may name, for the two descriptions a boot asks + // for and never gets. + let states = [0x1u32, 0x2, 0x4, 0x8, 0xc, 0x10, 0x20, 0x40, 0x80, 0xc0, 0x200, 0x400, 0x800]; + for (format, flags) in [(86u32, 5u32), (115, 1)] { + let desc = D3D12_RESOURCE_DESC { + Dimension: D3D12_RESOURCE_DIMENSION_TEXTURE2D, + Alignment: 0, + Width: 2560, + Height: 1440, + DepthOrArraySize: 1, + MipLevels: 1, + Format: DXGI_FORMAT(format as i32), + SampleDesc: DXGI_SAMPLE_DESC { + Count: 1, + Quality: 0, + }, + Layout: D3D12_TEXTURE_LAYOUT_UNKNOWN, + Flags: D3D12_RESOURCE_FLAGS(flags as i32), + }; + for state in states { + let mut texture: Option<ID3D12Resource> = None; + let clear: Option<*const D3D12_CLEAR_VALUE> = None; + // SAFETY: plain creation of a 2560x1440 texture. + let made = unsafe { + device.CreateCommittedResource( + &heap, + D3D12_HEAP_FLAG_NONE, + &raw const desc, + D3D12_RESOURCE_STATES(state as i32), + clear, + &mut texture, + ) + }; + if made.is_err() { + println!( + "format {format} flags {flags} state {state:#x}: {}", + match &made { + Ok(()) => "ok".to_owned(), + Err(e) => format!("{e}"), + } + ); + } + } + } + // Clear values that do not name the resource's own format, for the + // colour pair and for the two depth pairs a boot asks for: the host + // copy of a depth texture is made as the pair's second format, and + // the title's clear names the first. + for (format, clear_format, flags) in [ + (86u32, 86u32, 5u32), + (86, 0, 5), + (86, 28, 5), + (19, 19, 2), + (19, 20, 2), + (20, 20, 2), + (53, 55, 2), + (53, 53, 2), + (20, 20, 1), + ] { + let desc = D3D12_RESOURCE_DESC { + Dimension: D3D12_RESOURCE_DIMENSION_TEXTURE2D, + Alignment: 0, + Width: 2560, + Height: 1440, + DepthOrArraySize: 1, + MipLevels: 1, + Format: DXGI_FORMAT(format as i32), + SampleDesc: DXGI_SAMPLE_DESC { + Count: 1, + Quality: 0, + }, + Layout: D3D12_TEXTURE_LAYOUT_UNKNOWN, + Flags: D3D12_RESOURCE_FLAGS(flags as i32), + }; + let clear = D3D12_CLEAR_VALUE { + Format: DXGI_FORMAT(clear_format as i32), + Anonymous: D3D12_CLEAR_VALUE_0 { + Color: [0.0; 4], + }, + }; + let mut texture: Option<ID3D12Resource> = None; + // SAFETY: plain creation of a 2560x1440 texture with a clear value. + let made = unsafe { + device.CreateCommittedResource( + &heap, + D3D12_HEAP_FLAG_NONE, + &raw const desc, + D3D12_RESOURCE_STATE_COMMON, + Some(&raw const clear), + &mut texture, + ) + }; + println!( + "format {format} flags {flags} clear format {clear_format}: {}", + match &made { + Ok(()) => "ok".to_owned(), + Err(e) => format!("{e}"), + } + ); + } + } } ``` </details> No game data is involved: no shaders, textures, keys or package bytes, only descriptions, states and error codes. Written with an AI assistant.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:37:54 +00:00
Author
Owner

@⁠DrDarkDK on GitHub · 2026-11-24 19:52 UTC · original

Reproduced both 2560×1440 allocation failures in a windowed boot on ffe310e with logging added at CreateCommittedResource. Windows 11 build 26300.9974, RTX 4070 Ti, driver 621.01.

  • Format 86 (B5G5R5A1_UNORM), flags 0x5: D3D12 message 599 identifies ALLOW_UNORDERED_ACCESS as unsupported for this format.
  • Format 115 (B4G4R4A4_UNORM), flags 0x1: message 599 identifies ALLOW_RENDER_TARGET as unsupported for this format.

Both calls had title and host initial state COMMON (0x0) and a clear value whose format matched the resource. Both also returned E_INVALIDARG with the debug layer disabled.

AI-assisted with Codex.

**@⁠DrDarkDK** on GitHub · 2026-11-24 19:52 UTC · [original](https://github.com/Marvisak/VIctory/issues/1600#issuecomment-7142708481) Reproduced both 2560×1440 allocation failures in a windowed boot on `ffe310e` with logging added at `CreateCommittedResource`. Windows 11 build 26300.9974, RTX 4070 Ti, driver 621.01. - Format 86 (`B5G5R5A1_UNORM`), flags `0x5`: D3D12 message 599 identifies `ALLOW_UNORDERED_ACCESS` as unsupported for this format. - Format 115 (`B4G4R4A4_UNORM`), flags `0x1`: message 599 identifies `ALLOW_RENDER_TARGET` as unsupported for this format. Both calls had title and host initial state `COMMON` (`0x0`) and a clear value whose format matched the resource. Both also returned `E_INVALIDARG` with the debug layer disabled. *AI-assisted with Codex.*
Author
Owner

@⁠fiestorra on GitHub · 2026-11-24 20:19 UTC · original

Correction: this measurement ran on the integrated GPU, not on the RTX 4090, and the probe asked that one

The two 900-second boots behind this report, and the packed_formats probe I quoted, all took adapter 0, which on this machine is AMD Radeon(TM) Graphics, the Ryzen's integrated GPU (driver 32.0.21045.29003). The RTX 4090 is adapter 1 (32.0.16.2124, the 621.24 marketing version): D3D12CreateDevice(None, …) takes DXGI's default, the first adapter enumerated. So "the hardware adapter" in the report is that one, not the 4090.

The matrix itself is unaffected — those descriptions are legal on the adapter that was asked — and the two E_INVALIDARG creations are still unexplained and still reproducible only from a session that can present.

A note that came out of this, for anyone reading pipeline verdicts: translate --pipelines builds its own device and, until #1630, had no way to choose the adapter, so its verdicts are the default adapter's. Over the whole archive that difference is large: adapter 0 creates 0 of the title's 8,214 mesh pipelines and all 1,441 compute ones, the RTX 4090 creates 8,214 of 8,214 mesh and refuses 320 of the 1,441 compute ones with E_INVALIDARG.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-24 20:19 UTC · [original](https://github.com/Marvisak/VIctory/issues/1600#issuecomment-7143380089) **Correction: this measurement ran on the integrated GPU, not on the RTX 4090, and the probe asked that one** The two 900-second boots behind this report, and the `packed_formats` probe I quoted, all took **adapter 0**, which on this machine is `AMD Radeon(TM) Graphics`, the Ryzen's integrated GPU (driver `32.0.21045.29003`). The RTX 4090 is adapter 1 (`32.0.16.2124`, the 621.24 marketing version): `D3D12CreateDevice(None, …)` takes DXGI's default, the first adapter enumerated. So "the hardware adapter" in the report is that one, not the 4090. The matrix itself is unaffected — those descriptions are legal on the adapter that was asked — and the two `E_INVALIDARG` creations are still unexplained and still reproducible only from a session that can present. A note that came out of this, for anyone reading pipeline verdicts: `translate --pipelines` builds its own device and, until https://git.gtahub.st/github/Marvisak--VIctory/pulls/1630, had no way to choose the adapter, so its verdicts are the default adapter's. Over the whole archive that difference is large: adapter 0 creates 0 of the title's 8,214 mesh pipelines and all 1,441 compute ones, the RTX 4090 creates 8,214 of 8,214 mesh and refuses 320 of the 1,441 compute ones with `E_INVALIDARG`. Written with an AI assistant.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-24 20:44 UTC · original

One qualification on the probe result, from running the same description on the other adapter

The matrix in the report ("those descriptions are legal with every flag combination tried") was measured on adapter 0, the integrated GPU, because packed_formats builds its device with D3D12CreateDevice(None, …). The regression test now in #1630 runs the same 2560×1440 B5G5R5A1_UNORM description through host_texture with the selector set, and the two adapters disagree:

integrated GPU:  flags 0x5 of the 0x5 asked, state 0x4   (render target and UAV both taken)
RTX 4090:        flags 0x1 of the 0x5 asked, state 0x0   (UAV refused, render target kept)

So on the RTX 4090 ALLOW_UNORDERED_ACCESS on that format is refused, and only the render-target permission survives. That does not change the report's conclusion — the two original failures happened on the integrated GPU, where the description is legal and the refusal therefore comes from the state or the clear value — but the sentence should read "legal on the adapter that was asked", not "legal".

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-24 20:44 UTC · [original](https://github.com/Marvisak/VIctory/issues/1600#issuecomment-7143994028) **One qualification on the probe result, from running the same description on the other adapter** The matrix in the report ("those descriptions are legal with every flag combination tried") was measured on **adapter 0**, the integrated GPU, because `packed_formats` builds its device with `D3D12CreateDevice(None, …)`. The regression test now in https://git.gtahub.st/github/Marvisak--VIctory/pulls/1630 runs the same 2560×1440 `B5G5R5A1_UNORM` description through `host_texture` with the selector set, and the two adapters disagree: ``` integrated GPU: flags 0x5 of the 0x5 asked, state 0x4 (render target and UAV both taken) RTX 4090: flags 0x1 of the 0x5 asked, state 0x0 (UAV refused, render target kept) ``` So on the RTX 4090 `ALLOW_UNORDERED_ACCESS` on that format is refused, and only the render-target permission survives. That does not change the report's conclusion — the two original failures happened on the integrated GPU, where the description is legal and the refusal therefore comes from the state or the clear value — but the sentence should read "legal on the adapter that was asked", not "legal". Written with an AI assistant.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-24 20:46 UTC · original

Update: on the RTX 4090 the same two targets need the fallback, and this is what each loses

I re-ran the same 60-second boot on the other adapter of this machine (adapter 1, NVIDIA GeForce RTX 4090, driver 32.0.16.2124, chosen with VICTORY_D3D12_ADAPTER; the earlier reports were adapter 0, the integrated GPU). With the description ladder of #1630 in place, both 2560×1440 targets appear, and both as fallbacks:

host texture made only as a fallback flags_asked=5 flags_made=1 state_asked=0 state_made=0 clear_asked=86  clear_dropped=false
host texture made only as a fallback flags_asked=1 flags_made=0 state_asked=0 state_made=0 clear_asked=115 clear_dropped=true
  • B5G5R5A1_UNORM (86), asked with ALLOW_RENDER_TARGET | ALLOW_UNORDERED_ACCESS: the RTX 4090 refuses the UAV permission for that format, so the host copy is a render target only (flags 1). The clear value is the one the resource names and is kept, so the UAV permission was the refusal — the same refusal the packed_formats probe reproduces directly.
  • B4G4R4A4_UNORM (115), asked with ALLOW_RENDER_TARGET: the RTX 4090 refuses the render target too, and refuses the creation even with the clear value in the resource's own format (clear_asked=115), so the only description it takes is plain memory (flags 0) with no clear. So on this GPU that target cannot be rendered into at all.

What that means for the boot, honestly: the ladder keeps the textures (without it there is no host copy and every draw that names them is lost), but it cannot keep what the host refuses. A flags 0 texture can still be a shader resource; it can never be a render target, so the draws that render into (115) have nowhere to land, and the UAV writes to (86) go nowhere. Both are logged once, which is the only way anyone would know.

Two things I would like the maintainers' judgement on, because they are policy and not measurements:

  1. Should the ladder go as far as plain memory? It is the difference between "a texture exists" and "nothing exists", but a texture that can never be bound as an RTV is a quiet way for a frame to come out empty. The alternative is to stop at the last description that keeps a permission and report the target as missing.
  2. Should a refused UAV permission on a colour format (86 here) be a warning rather than a once-per-texture line, since a shader writing through it is a silent no-op?

The other refusal in the same run is the one already noted at the top: view the host does not allow unordered=true format=53 flags=2, a UAV view of a typeless depth resource, which is a different case and is correctly refused.

No game data is involved: descriptions, flags, states and counts only.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-24 20:46 UTC · [original](https://github.com/Marvisak/VIctory/issues/1600#issuecomment-7144032260) **Update: on the RTX 4090 the same two targets need the fallback, and this is what each loses** I re-ran the same 60-second boot on the other adapter of this machine (adapter 1, `NVIDIA GeForce RTX 4090`, driver `32.0.16.2124`, chosen with `VICTORY_D3D12_ADAPTER`; the earlier reports were adapter 0, the integrated GPU). With the description ladder of https://git.gtahub.st/github/Marvisak--VIctory/pulls/1630 in place, both 2560×1440 targets appear, and both as fallbacks: ``` host texture made only as a fallback flags_asked=5 flags_made=1 state_asked=0 state_made=0 clear_asked=86 clear_dropped=false host texture made only as a fallback flags_asked=1 flags_made=0 state_asked=0 state_made=0 clear_asked=115 clear_dropped=true ``` - **`B5G5R5A1_UNORM` (86), asked with `ALLOW_RENDER_TARGET | ALLOW_UNORDERED_ACCESS`:** the RTX 4090 refuses the UAV permission for that format, so the host copy is a render target only (`flags 1`). The clear value is the one the resource names and is kept, so the UAV permission was the refusal — the same refusal the `packed_formats` probe reproduces directly. - **`B4G4R4A4_UNORM` (115), asked with `ALLOW_RENDER_TARGET`:** the RTX 4090 refuses the render target too, and refuses the creation even with the clear value in the resource's own format (`clear_asked=115`), so the only description it takes is plain memory (`flags 0`) with no clear. So on this GPU that target cannot be rendered into at all. What that means for the boot, honestly: the ladder keeps the textures (without it there is no host copy and every draw that names them is lost), but it cannot keep what the host refuses. A `flags 0` texture can still be a shader resource; it can never be a render target, so the draws that render into (115) have nowhere to land, and the UAV writes to (86) go nowhere. Both are logged once, which is the only way anyone would know. Two things I would like the maintainers' judgement on, because they are policy and not measurements: 1. Should the ladder go as far as plain memory? It is the difference between "a texture exists" and "nothing exists", but a texture that can never be bound as an RTV is a quiet way for a frame to come out empty. The alternative is to stop at the last description that keeps a permission and report the target as missing. 2. Should a refused UAV permission on a *colour* format (86 here) be a warning rather than a once-per-texture line, since a shader writing through it is a silent no-op? The other refusal in the same run is the one already noted at the top: `view the host does not allow unordered=true format=53 flags=2`, a UAV view of a typeless depth resource, which is a different case and is correctly refused. No game data is involved: descriptions, flags, states and counts only. Written with an AI assistant.
Author
Owner

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

Automated triage for the maintainers.

Still as described on main (940d32f): host_texture in crates/victory-gpu/src/resource.rs makes one CreateCommittedResource attempt and on failure logs only no host texture with the description, not the initial state or the clear value, and the texture then has no host copy.

The comments settle the cause on discrete NVIDIA cards (RTX 4070 Ti, RTX 4090): the host refuses ALLOW_UNORDERED_ACCESS on B5G5R5A1_UNORM (86) and ALLOW_RENDER_TARGET on B4G4R4A4_UNORM (115). The same two textures are reported in #735, #797 and #1753; open PRs #89, #1787 and #1843 address them (#89 makes them in a supported format), and #1763 covers typed UAVs in such formats. The body's ladder patch is carried by open PR #1630 (also adapter selection and presenter backoff). Your policy questions (whether the ladder should go down to plain memory, and how loudly a dropped UAV permission is logged) are for the maintainers and best settled in #1630's review.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 12:48 UTC · [original](https://github.com/Marvisak/VIctory/issues/1600#issuecomment-7162881155) <!-- victory-issue-triage v1 verdict=confirmed seen=2026-11-24T20:46:13Z at=2026-11-25T12:48:05Z --> Automated triage for the maintainers. Still as described on `main` (`940d32f`): `host_texture` in `crates/victory-gpu/src/resource.rs` makes one `CreateCommittedResource` attempt and on failure logs only `no host texture` with the description, not the initial state or the clear value, and the texture then has no host copy. The comments settle the cause on discrete NVIDIA cards (RTX 4070 Ti, RTX 4090): the host refuses `ALLOW_UNORDERED_ACCESS` on `B5G5R5A1_UNORM` (86) and `ALLOW_RENDER_TARGET` on `B4G4R4A4_UNORM` (115). The same two textures are reported in #735, #797 and #1753; open PRs #89, #1787 and #1843 address them (#89 makes them in a supported format), and #1763 covers typed UAVs in such formats. The body's ladder patch is carried by open PR #1630 (also adapter selection and presenter backoff). Your policy questions (whether the ladder should go down to plain memory, and how loudly a dropped UAV permission is logged) are for the maintainers and best settled in #1630's review. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠zdaniukdmitry on GitHub · 2026-11-26 16:20 UTC · original

Same family on an RTX 4060 (driver 610.88), plus one more format. Besides the 2560×1440
E_INVALIDARG above, two calls removed the device outright before the world was reached:

  • CreateCommittedResource3: D3D12_CLEAR_VALUE::Format = B4G4R4A4_UNORM on a resource
    with ALLOW_RENDER_TARGET at FL 12.2 — "must be valid to be used as a render target".
    D3D12_RESOURCE_DESC::Format was B5G5R5A1_UNORM in the next one:
  • GetResourceAllocationInfo: B5G5R5A1_UNORM with ALLOW_UNORDERED_ACCESS — "must be
    created with a format that either can be used as unordered access, or cast to a format
    that could be used as unordered access".

Mapping 85 (B5G6R5_UNORM), 86 (B5G5R5A1_UNORM) and 115 (B4G4R4A4_UNORM) to
B8G8R8A8_UNORM in pc_format (crates/victory-gpu/src/resource.rs) got past both, and
the no host texture ... 0x80070057 lines for formats 86/115 disappeared from my runs.
Channel order is preserved (all of them are B, G, R, A), but such textures now take 4×
the memory and a 4444/565 render target becomes 8888 — whether that is the right mapping
is your call, I only report what unblocked the run.

The world hang that follows on this card is reported in #71.

Assembled with an AI assistant from local logs; I reviewed the text.

**@⁠zdaniukdmitry** on GitHub · 2026-11-26 16:20 UTC · [original](https://github.com/Marvisak/VIctory/issues/1600#issuecomment-7197510649) Same family on an RTX 4060 (driver 610.88), plus one more format. Besides the 2560×1440 `E_INVALIDARG` above, two calls removed the device outright before the world was reached: - `CreateCommittedResource3`: `D3D12_CLEAR_VALUE::Format = B4G4R4A4_UNORM` on a resource with `ALLOW_RENDER_TARGET` at FL 12.2 — "must be valid to be used as a render target". `D3D12_RESOURCE_DESC::Format` was `B5G5R5A1_UNORM` in the next one: - `GetResourceAllocationInfo`: `B5G5R5A1_UNORM` with `ALLOW_UNORDERED_ACCESS` — "must be created with a format that either can be used as unordered access, or cast to a format that could be used as unordered access". Mapping 85 (`B5G6R5_UNORM`), 86 (`B5G5R5A1_UNORM`) and 115 (`B4G4R4A4_UNORM`) to `B8G8R8A8_UNORM` in `pc_format` (`crates/victory-gpu/src/resource.rs`) got past both, and the `no host texture ... 0x80070057` lines for formats 86/115 disappeared from my runs. Channel order is preserved (all of them are B, G, R, A), but such textures now take 4× the memory and a 4444/565 render target becomes 8888 — whether that is the right mapping is your call, I only report what unblocked the run. The world hang that follows on this card is reported in #71. Assembled with an AI assistant from local logs; I reviewed the text.
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#1600
No description provided.