Repository navigation
xnetworking: stop copying struct padding in default_security_info_bytes - #76
Merged
ivall merged 1 commit intoNov 23, 2026
Conversation
…of copying struct padding
Collaborator
|
Merged. Tested on Windows 11 with an RX 9070 (RDNA4): |
theaustinayers
pushed a commit
that referenced
this pull request
Nov 24, 2026
…ites `pc_resource_desc` takes ALLOW_UNORDERED_ACCESS from a depth buffer the console also lets shaders write (the PC refuses ALLOW_DEPTH_STENCIL with ALLOW_UNORDERED_ACCESS). Only CreatePlacedResourceX (#44) moved such a resource's initial state off UNORDERED_ACCESS as well (to DEPTH_WRITE). The other paths that create a resource of the converted description only masked the state with PC_RESOURCE_STATES: the committed fallback of CreateCommittedResource (#27 / #76 / #127, reached without unified memory or when its coherent window is full), the PC-way retry and the committed fallback of CreatePlacedResource (#29), and its memory-of-its- own path for textures larger on the PC. A console texture with flags DEPTH_STENCIL | UNORDERED_ACCESS created in UNORDERED_ACCESS was then asked for in a state D3D12 refuses for a resource without the UAV flag (E_INVALIDARG; the #29 own-memory path fell back to COMMON). `device_x::pc_initial_state` does both steps; #44 uses it with no change in behaviour, and the four other sites use it with the console flags (or the PC description's, which keep ALLOW_DEPTH_STENCIL). Tests: a unit test of the helper; a GPU test placing a 256x256 D16 depth+UAV texture in UNORDERED_ACCESS as XCL now does (not run here). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the first change requested in
docs/xnetworking-rust-review.md: stop copying uninitialized#[repr(C)]struct padding indefault_security_info_bytes.What changed
default_security_info_bytes(crates/xcl/src/hle/xgameruntime/networking.rs):unsaferaw struct byte copy (which read uninitialized padding bytes betweenenabled_http_security_protocol_flags: u32andthumbprint_count: usize) with a safe zero-initializedVec<u8>sized tosize_of::<XNetworkingSecurityInformation>(), writingDEFAULT_TLS_FLAGS.to_le_bytes()atoffset_of!(XNetworkingSecurityInformation, enabled_http_security_protocol_flags).thumbprint_count == 0, a nullthumbprintspointer, and deterministic zero padding on x86_64 Windows.crates/xcl/src/hle/xgameruntime/networking.rs):security_info_utf8_and_utf16_follow_gdk_arg_orderto use storage properly aligned toXNetworkingSecurityInformation(pre-filled with non-zero sentinels0xAA/0x55) and assert all three fields (enabled_http_security_protocol_flags,thumbprint_count == 0,thumbprints.is_null()) for both UTF-8 and UTF-16.default_security_info_bytes_zeroes_padding_and_fieldsverifying exact byte length,DEFAULT_TLS_FLAGSat the field offset, and zero bytes everywhere else.Verification
rustc 1.100.0(x86_64-pc-windows-msvc), Windows 10 Pro10.0.19045.cargo test -p xcl --lib hle::xgameruntime::networking: 6 passed, 0 failed.