D3D12.X: sanitize display target desc/clear/state and committed console heap flags #3376

Closed
Kalmarv wants to merge 1 commit from upstream-pr/3376 into main
Kalmarv commented 2026-11-29 11:14:02 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-29T11:14:02Z.


What is in it
Sanitize console resource, clear-value, initial-state, heap-flag, and heap-property arguments on the PC CreateCommittedResource paths in crates/xcl/src/hle/d3d12x/real.rs:

  • create_display_target now converts the console resource description with pc_resource_desc_for_device(this, &x) (matching dev_create_committed_resource_x and create_placed_resource_x), aligns any optimized D3D12_CLEAR_VALUE format via pc_clear_for_desc, strips console-only initial state bits and dropped-UAV states via pc_initial_state_for_desc, and maps console-only heap types (!(1..=5)) to D3D12_HEAP_TYPE_DEFAULT via pc_heap_properties.
  • dev_create_committed_resource_x now sanitizes console D3D12_HEAP_FLAGS via pc_committed_heap_flags (dropping ALLOW_DISPLAY, tier-1 DENY_* flags, and console-only bits that PC CreateCommittedResource rejects with E_INVALIDARG) and console-only heap types via pc_heap_properties on its PC committed-resource fallback path.
  • Added unit and child-process WARP tests in hle::d3d12x::real::committed_display_target_sanitize_tests covering pc_committed_heap_flags, pc_heap_properties, display targets with promoted console formats (116 -> R16G16B16A16_FLOAT, B8G8R8X8_UNORM + UAV -> B8G8R8A8_UNORM) and optimized clear values, stripped-UAV sRGB display targets in UNORDERED_ACCESS, console state bit 0x10_0000, and dev_create_committed_resource_x with console heap flags and heap type.

Tested

  • Verified the new WARP test failed before the fix (display target format 116 with clear value failed: 0x80070057) and passed after (2 passed, 0 failed, including verifying case 5 exercises the PC CreateCommittedResource fallback rather than UMA placement).
  • cargo test -p xcl --lib -j 4 -- hle::d3d12x::real:: --skip failed_binding_keeps_indirect_commands_until_allocator_reset --test-threads=4: 167 passed, 0 failed.
  • Full workspace (cargo test --workspace -j 2 -- --test-threads=4 --skip test_title_runs_and_game_folder_is_untouched --skip uma_driver::tests:: with DXC 1.9 on NVIDIA GeForce RTX 5070 Ti, wave32): 2611 passed, 0 failed, 49 ignored across 41 test suites (26 runtime SKIPPED messages: 21 wave64-only checks on wave32 hardware, 3 per-lane-form #1426 refusals for V_MUL_F16/V_PK_MUL_F16/V_CVT_F16_F32, and 2 XCL_HEAP_WINDOWS=1 opt-in checks).

Regression run

xcl-smoke v1
commit: f0e8fdd5c3942ddd399d5ee11384c8595c5aacff
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 150
exit: 0x0
frames shown: 1695 (PresentX 1695)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 31546 MB
xcl-smoke v1
commit: 3ba24ec54168192856c057471265779af59a66b3
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 150
exit: 0x0
frames shown: 1975 (PresentX 1975)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 33596 MB

Not tested

  • Retail titles creating HDR/console-format display targets or committed resources with console heap flags on AMD/Intel drivers (verified on WARP and RTX 5070 Ti only).
  • test_title_runs_and_game_folder_is_untouched and uma_driver::tests:: were skipped in the workspace run; wave64 GPU tests were skipped on this wave32 RTX 5070 Ti.

AI use
Assisted with auditing the unsanitized create_display_target and dev_create_committed_resource_x PC fallback paths, writing the helpers and synthetic unit/WARP tests, and running the workspace and smoke verification; all diffs and results were reviewed directly.

<!-- greyfinch-sync:ivall/xcl:issue:5550154349 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3376). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-29T11:14:02Z. --- **What is in it** Sanitize console resource, clear-value, initial-state, heap-flag, and heap-property arguments on the PC `CreateCommittedResource` paths in `crates/xcl/src/hle/d3d12x/real.rs`: - `create_display_target` now converts the console resource description with `pc_resource_desc_for_device(this, &x)` (matching `dev_create_committed_resource_x` and `create_placed_resource_x`), aligns any optimized `D3D12_CLEAR_VALUE` format via `pc_clear_for_desc`, strips console-only initial state bits and dropped-UAV states via `pc_initial_state_for_desc`, and maps console-only heap types (`!(1..=5)`) to `D3D12_HEAP_TYPE_DEFAULT` via `pc_heap_properties`. - `dev_create_committed_resource_x` now sanitizes console `D3D12_HEAP_FLAGS` via `pc_committed_heap_flags` (dropping `ALLOW_DISPLAY`, tier-1 `DENY_*` flags, and console-only bits that PC `CreateCommittedResource` rejects with `E_INVALIDARG`) and console-only heap types via `pc_heap_properties` on its PC committed-resource fallback path. - Added unit and child-process WARP tests in `hle::d3d12x::real::committed_display_target_sanitize_tests` covering `pc_committed_heap_flags`, `pc_heap_properties`, display targets with promoted console formats (`116` -> `R16G16B16A16_FLOAT`, `B8G8R8X8_UNORM + UAV` -> `B8G8R8A8_UNORM`) and optimized clear values, stripped-UAV sRGB display targets in `UNORDERED_ACCESS`, console state bit `0x10_0000`, and `dev_create_committed_resource_x` with console heap flags and heap type. **Tested** - Verified the new WARP test failed before the fix (`display target format 116 with clear value failed: 0x80070057`) and passed after (`2 passed, 0 failed`, including verifying case 5 exercises the PC `CreateCommittedResource` fallback rather than UMA placement). - `cargo test -p xcl --lib -j 4 -- hle::d3d12x::real:: --skip failed_binding_keeps_indirect_commands_until_allocator_reset --test-threads=4`: `167 passed, 0 failed`. - Full workspace (`cargo test --workspace -j 2 -- --test-threads=4 --skip test_title_runs_and_game_folder_is_untouched --skip uma_driver::tests::` with DXC 1.9 on NVIDIA GeForce RTX 5070 Ti, wave32): `2611 passed, 0 failed, 49 ignored` across 41 test suites (`26` runtime `SKIPPED` messages: `21` wave64-only checks on wave32 hardware, `3` per-lane-form `#1426` refusals for `V_MUL_F16`/`V_PK_MUL_F16`/`V_CVT_F16_F32`, and `2` `XCL_HEAP_WINDOWS=1` opt-in checks). **Regression run** ``` xcl-smoke v1 commit: f0e8fdd5c3942ddd399d5ee11384c8595c5aacff gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 150 exit: 0x0 frames shown: 1695 (PresentX 1695) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 31546 MB ``` ``` xcl-smoke v1 commit: 3ba24ec54168192856c057471265779af59a66b3 gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 150 exit: 0x0 frames shown: 1975 (PresentX 1975) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 33596 MB ``` **Not tested** - Retail titles creating HDR/console-format display targets or committed resources with console heap flags on AMD/Intel drivers (verified on WARP and RTX 5070 Ti only). - `test_title_runs_and_game_folder_is_untouched` and `uma_driver::tests::` were skipped in the workspace run; wave64 GPU tests were skipped on this wave32 RTX 5070 Ti. **AI use** Assisted with auditing the unsanitized `create_display_target` and `dev_create_committed_resource_x` PC fallback paths, writing the helpers and synthetic unit/WARP tests, and running the workspace and smoke verification; all diffs and results were reviewed directly.
Foniass commented 2026-12-01 05:15:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:15:09Z.


merge-check
base: d0832e614f
head: 3ba24ec541
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2892 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read the whole diff (real.rs, +237/-3, ~45 lines outside tests). It changes the default path: every display target and every committed resource that falls back to the PC path now has its heap flags masked, and heap types outside 1-5 become DEFAULT. Inputs the PC already accepts look unaffected (SHARED, CREATE_NOT_ZEROED and ALLOW_SHADER_ATOMICS are kept). Findings: (1) the comment at ~3808 says the PC rejects ALLOW_DISPLAY and the DENY_* flags, but no test sets them on their own. Case 5 (~15224) combines them with the console-only 0x2 bit and heap type 6, either of which fails alone, yet they're now stripped unconditionally, unlike dev_create_heap, which strips only after the PC refuses. (2) Case 4 (~15209) tests state 0x100000 in create_display_target, which its only caller can't pass (layout_state never produces it). (3) Case 5's console_buffer(...).is_none() assert (~15238) checks nothing for a texture (only buffers are tracked). (4) Display-target sanitizing and committed heap flags/type are two changes. (5) #3418 switches dev_create_committed_resource_x to a new pc_clear_for_resource_desc, while display targets here keep pc_clear_for_desc; no textual conflict, but they can drift. (6) AI use names no tool or model; no what-and-why paragraph or issue link; the suite run skipped the e2e test and uma_driver::tests::; both of the PR's smoke runs end at 0 presents per 2 s, so they don't show the title reaching these paths. Fine: main already promoted 116 -> 10 and 88 -> 87 for display targets, so presenting and RTV use are unchanged; the helpers match the committed and placed paths; the child test uses skip_test and forwards SKIPPED.
performance: 60 s smoke of a retail title, main d0832e61 vs this merge (2c6b1a00): 1516 -> 1685 frames shown (111 %; last presents per 2 s: 60 60 60), peak commit 18133 -> 16862 MB, 0 device removals, 0 crashes. git diff --check flags a new blank line at the end of real.rs.
verdict: safe to merge (splitting display targets from committed heap flags, and a test that sets ALLOW_DISPLAY / DENY_* alone, would make it stronger)
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5

AI-written and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7301575265 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3376#issuecomment-7301575265). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T05:15:09Z. --- merge-check base: d0832e614fa7d6ae027bb4feb27ccb9121f54a8f head: 3ba24ec54168192856c057471265779af59a66b3 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2892 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none review: read the whole diff (real.rs, +237/-3, ~45 lines outside tests). It changes the default path: every display target and every committed resource that falls back to the PC path now has its heap flags masked, and heap types outside 1-5 become DEFAULT. Inputs the PC already accepts look unaffected (SHARED, CREATE_NOT_ZEROED and ALLOW_SHADER_ATOMICS are kept). Findings: (1) the comment at ~3808 says the PC rejects ALLOW_DISPLAY and the DENY_* flags, but no test sets them on their own. Case 5 (~15224) combines them with the console-only 0x2 bit and heap type 6, either of which fails alone, yet they're now stripped unconditionally, unlike `dev_create_heap`, which strips only after the PC refuses. (2) Case 4 (~15209) tests state 0x100000 in `create_display_target`, which its only caller can't pass (`layout_state` never produces it). (3) Case 5's `console_buffer(...).is_none()` assert (~15238) checks nothing for a texture (only buffers are tracked). (4) Display-target sanitizing and committed heap flags/type are two changes. (5) #3418 switches `dev_create_committed_resource_x` to a new `pc_clear_for_resource_desc`, while display targets here keep `pc_clear_for_desc`; no textual conflict, but they can drift. (6) AI use names no tool or model; no what-and-why paragraph or issue link; the suite run skipped the e2e test and `uma_driver::tests::`; both of the PR's smoke runs end at 0 presents per 2 s, so they don't show the title reaching these paths. Fine: main already promoted 116 -> 10 and 88 -> 87 for display targets, so presenting and RTV use are unchanged; the helpers match the committed and placed paths; the child test uses `skip_test` and forwards SKIPPED. performance: 60 s smoke of a retail title, main d0832e61 vs this merge (2c6b1a00): 1516 -> 1685 frames shown (111 %; last presents per 2 s: 60 60 60), peak commit 18133 -> 16862 MB, 0 device removals, 0 crashes. git diff --check flags a new blank line at the end of real.rs. verdict: safe to merge (splitting display targets from committed heap flags, and a test that sets ALLOW_DISPLAY / DENY_* alone, would make it stronger) hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5 AI-written and posted by Foniass without a human check of each point.
bmjask commented 2026-12-02 02:44:30 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T02:44:30Z.

Code review location: crates/xcl/src/hle/d3d12x/real.rs; line 3926

@@ -3887,7 +3922,10 @@ unsafe extern "system" fn dev_create_committed_resource_x(this: *mut c_void, pro
         let pc_flags = u32::from_le_bytes(d[0x30..0x34].try_into().unwrap());
         super::device_x::pc_initial_state_for_desc(orig_flags, pc_flags, state as u32)
     });
-    let hr = dev_create_committed_resource(this, props, flags, desc, st as usize, clear, riid, ppv);
+    let mut props_buf = D3D12_HEAP_PROPERTIES::default();
+    let pc_props = pc_heap_properties(props, &mut props_buf);

dev_create_committed_resource_x (slots 27/76) now strips ALLOW_DISPLAY so the call succeeds as a plain PC resource, instead of sending it to create_display_target the way dev_create_committed_resource_layout_x does. Display targets created here never get title memory from runtime_alloc(D3D_DISPLAY_TARGET) or note_title_address. A title that creates its back buffers via CreateCommittedResource with ALLOW_DISPLAY, when UMA placement doesn't take them, used to get a loud E_INVALIDARG. Now it gets S_OK with no title-side allocation, so the title's assert that its back-buffer block is used up fires, or console code reads the target at an address that was never registered. Test case 5 (~15224) asserts the plain-PC result, which locks this in.

<!-- greyfinch-sync:ivall/xcl:review-comment:4764028325 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3376#discussion_r4764028325). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T02:44:30Z. **Code review location:** `crates/xcl/src/hle/d3d12x/real.rs`; line 3926 ~~~~diff @@ -3887,7 +3922,10 @@ unsafe extern "system" fn dev_create_committed_resource_x(this: *mut c_void, pro let pc_flags = u32::from_le_bytes(d[0x30..0x34].try_into().unwrap()); super::device_x::pc_initial_state_for_desc(orig_flags, pc_flags, state as u32) }); - let hr = dev_create_committed_resource(this, props, flags, desc, st as usize, clear, riid, ppv); + let mut props_buf = D3D12_HEAP_PROPERTIES::default(); + let pc_props = pc_heap_properties(props, &mut props_buf); ~~~~ --- `dev_create_committed_resource_x` (slots 27/76) now strips ALLOW_DISPLAY so the call succeeds as a plain PC resource, instead of sending it to `create_display_target` the way `dev_create_committed_resource_layout_x` does. Display targets created here never get title memory from `runtime_alloc(D3D_DISPLAY_TARGET)` or `note_title_address`. A title that creates its back buffers via CreateCommittedResource with ALLOW_DISPLAY, when UMA placement doesn't take them, used to get a loud E_INVALIDARG. Now it gets S_OK with no title-side allocation, so the title's assert that its back-buffer block is used up fires, or console code reads the target at an address that was never registered. Test case 5 (~15224) asserts the plain-PC result, which locks this in.
bmjask commented 2026-12-02 02:44:30 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T02:44:30Z.

Code review location: crates/xcl/src/hle/d3d12x/real.rs; line 3828

@@ -3805,13 +3805,48 @@ unsafe extern "system" fn dev_create_committed_resource_layout_x(
     dev_create_committed_resource_x(this, props, flags as usize, desc, state, clear, riid, ppv)
 }
 
+/// `D3D12_HEAP_FLAGS` valid on PC `CreateCommittedResource`: known PC heap flags minus
+/// `ALLOW_DISPLAY` (`0x8`) and tier-1 `DENY_*` flags (`0x4`, `0x40`, `0x80`), which PC
+/// `CreateCommittedResource` rejects with `E_INVALIDARG`.
+const PC_COMMITTED_HEAP_FLAGS: u32 = PC_HEAP_FLAGS
+    & !(D3D12_HEAP_FLAG_ALLOW_DISPLAY.0 as u32
+        | D3D12_HEAP_FLAG_DENY_BUFFERS.0 as u32
+        | D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES.0 as u32
+        | D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES.0 as u32);
+
+fn pc_committed_heap_flags(flags: u32) -> u32 {
+    flags & PC_COMMITTED_HEAP_FLAGS
+}
+
+/// Sanitize console-only `D3D12_HEAP_TYPE` values (outside `1..=5`, matching `dev_create_heap`)
+/// to `D3D12_HEAP_TYPE_DEFAULT` for PC `CreateCommittedResource`.
+unsafe fn pc_heap_properties(props: usize, buf: &mut D3D12_HEAP_PROPERTIES) -> usize {
+    if props == 0 || !crate::gpu::shader::readable(props, std::mem::size_of::<D3D12_HEAP_PROPERTIES>()) {
+        return props;
+    }
+    let p: D3D12_HEAP_PROPERTIES = std::ptr::read_unaligned(props as *const D3D12_HEAP_PROPERTIES);
+    if !(1..=5).contains(&p.Type.0) {

pc_heap_properties replaces any console-only heap type (outside 1..=5) with a fresh DEFAULT heap and clears CPUPageProperty, MemoryPoolPreference and both node masks. A committed buffer/texture in a CPU-visible console heap type (e.g. 6), created when UMA placement is off or full, is now GPU-only on the PC. Map() then fails or returns null, and the title's CPU writes or readback crash or are lost, where before the creation failed outright. Mapping CPU-visible console types to a CPU-visible PC heap (or a custom heap with the same CPU page property) would keep access.

<!-- greyfinch-sync:ivall/xcl:review-comment:4764028335 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3376#discussion_r4764028335). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T02:44:30Z. **Code review location:** `crates/xcl/src/hle/d3d12x/real.rs`; line 3828 ~~~~diff @@ -3805,13 +3805,48 @@ unsafe extern "system" fn dev_create_committed_resource_layout_x( dev_create_committed_resource_x(this, props, flags as usize, desc, state, clear, riid, ppv) } +/// `D3D12_HEAP_FLAGS` valid on PC `CreateCommittedResource`: known PC heap flags minus +/// `ALLOW_DISPLAY` (`0x8`) and tier-1 `DENY_*` flags (`0x4`, `0x40`, `0x80`), which PC +/// `CreateCommittedResource` rejects with `E_INVALIDARG`. +const PC_COMMITTED_HEAP_FLAGS: u32 = PC_HEAP_FLAGS + & !(D3D12_HEAP_FLAG_ALLOW_DISPLAY.0 as u32 + | D3D12_HEAP_FLAG_DENY_BUFFERS.0 as u32 + | D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES.0 as u32 + | D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES.0 as u32); + +fn pc_committed_heap_flags(flags: u32) -> u32 { + flags & PC_COMMITTED_HEAP_FLAGS +} + +/// Sanitize console-only `D3D12_HEAP_TYPE` values (outside `1..=5`, matching `dev_create_heap`) +/// to `D3D12_HEAP_TYPE_DEFAULT` for PC `CreateCommittedResource`. +unsafe fn pc_heap_properties(props: usize, buf: &mut D3D12_HEAP_PROPERTIES) -> usize { + if props == 0 || !crate::gpu::shader::readable(props, std::mem::size_of::<D3D12_HEAP_PROPERTIES>()) { + return props; + } + let p: D3D12_HEAP_PROPERTIES = std::ptr::read_unaligned(props as *const D3D12_HEAP_PROPERTIES); + if !(1..=5).contains(&p.Type.0) { ~~~~ --- `pc_heap_properties` replaces any console-only heap type (outside 1..=5) with a fresh DEFAULT heap and clears CPUPageProperty, MemoryPoolPreference and both node masks. A committed buffer/texture in a CPU-visible console heap type (e.g. 6), created when UMA placement is off or full, is now GPU-only on the PC. Map() then fails or returns null, and the title's CPU writes or readback crash or are lost, where before the creation failed outright. Mapping CPU-visible console types to a CPU-visible PC heap (or a custom heap with the same CPU page property) would keep access.
bmjask commented 2026-12-02 02:44:30 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T02:44:30Z.

Code review location: crates/xcl/src/hle/d3d12x/real.rs; line 3815

@@ -3805,13 +3805,48 @@ unsafe extern "system" fn dev_create_committed_resource_layout_x(
     dev_create_committed_resource_x(this, props, flags as usize, desc, state, clear, riid, ppv)
 }
 
+/// `D3D12_HEAP_FLAGS` valid on PC `CreateCommittedResource`: known PC heap flags minus
+/// `ALLOW_DISPLAY` (`0x8`) and tier-1 `DENY_*` flags (`0x4`, `0x40`, `0x80`), which PC
+/// `CreateCommittedResource` rejects with `E_INVALIDARG`.
+const PC_COMMITTED_HEAP_FLAGS: u32 = PC_HEAP_FLAGS
+    & !(D3D12_HEAP_FLAG_ALLOW_DISPLAY.0 as u32
+        | D3D12_HEAP_FLAG_DENY_BUFFERS.0 as u32
+        | D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES.0 as u32
+        | D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES.0 as u32);

PC_COMMITTED_HEAP_FLAGS keeps ALLOW_WRITE_WATCH (0x200), HARDWARE_PROTECTED (0x100) and ALLOW_SHADER_ATOMICS, which are invalid on plain CreateCommittedResource once the type has been rewritten to DEFAULT, or without a protected session. Console flags 0x2C2 with console heap type 6 become DEFAULT + 0x200, which PC D3D12 rejects with E_INVALIDARG, so the cleanup only half-fixes the failure it targets. The failure log (~3934) also still prints the console's raw flags and type, not the cleaned-up values actually rejected.

<!-- greyfinch-sync:ivall/xcl:review-comment:4764028344 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3376#discussion_r4764028344). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T02:44:30Z. **Code review location:** `crates/xcl/src/hle/d3d12x/real.rs`; line 3815 ~~~~diff @@ -3805,13 +3805,48 @@ unsafe extern "system" fn dev_create_committed_resource_layout_x( dev_create_committed_resource_x(this, props, flags as usize, desc, state, clear, riid, ppv) } +/// `D3D12_HEAP_FLAGS` valid on PC `CreateCommittedResource`: known PC heap flags minus +/// `ALLOW_DISPLAY` (`0x8`) and tier-1 `DENY_*` flags (`0x4`, `0x40`, `0x80`), which PC +/// `CreateCommittedResource` rejects with `E_INVALIDARG`. +const PC_COMMITTED_HEAP_FLAGS: u32 = PC_HEAP_FLAGS + & !(D3D12_HEAP_FLAG_ALLOW_DISPLAY.0 as u32 + | D3D12_HEAP_FLAG_DENY_BUFFERS.0 as u32 + | D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES.0 as u32 + | D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES.0 as u32); ~~~~ --- `PC_COMMITTED_HEAP_FLAGS` keeps ALLOW_WRITE_WATCH (0x200), HARDWARE_PROTECTED (0x100) and ALLOW_SHADER_ATOMICS, which are invalid on plain CreateCommittedResource once the type has been rewritten to DEFAULT, or without a protected session. Console flags 0x2C2 with console heap type 6 become DEFAULT + 0x200, which PC D3D12 rejects with E_INVALIDARG, so the cleanup only half-fixes the failure it targets. The failure log (~3934) also still prints the console's raw flags and type, not the cleaned-up values actually rejected.
bmjask commented 2026-12-02 02:44:30 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T02:44:30Z.

Review: COMMENTED


Review of 3ba24ec5: 3 finding(s). 3 are inline.


These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.

<!-- greyfinch-sync:ivall/xcl:review:6143913699 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3376#pullrequestreview-6143913699). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T02:44:30Z. **Review:** COMMENTED --- Review of `3ba24ec5`: 3 finding(s). 3 are inline. --- _These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it._
Kalmarv commented 2026-12-02 20:49:04 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-12-02T20:49:04Z.


Consolidated into and superseded by #3729 (https://github.com/xcl-dev/xcl/pull/3729), which combines #3291, #3414, #3418, and #3376 and addresses all open review findings in one PR. Closing this one.

<!-- greyfinch-sync:ivall/xcl:comment:7358364163 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3376#issuecomment-7358364163). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-12-02T20:49:04Z. --- Consolidated into and superseded by #3729 (https://github.com/xcl-dev/xcl/pull/3729), which combines #3291, #3414, #3418, and #3376 and addresses all open review findings in one PR. Closing this one.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
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.

Reference
xcl-dev/xcl!3376
No description provided.