Skip to content

Preserve record counts on scalar SRV descriptors - #42

Open
gmankab wants to merge 1 commit into
spidercraft:linux-native-runtimefrom
gmankab:contrib/linux-native-scalar-descriptor-use
Open

gmankab wants to merge 1 commit into
spidercraft:linux-native-runtimefrom
gmankab:contrib/linux-native-scalar-descriptor-use

Conversation

@gmankab

@gmankab gmankab commented Nov 26, 2026

Copy link
Copy Markdown

A scalar buffer load can consume a descriptor whose record count is also used as shader data. The Linux native translator refused the program at that use, leaving the affected draw or dispatch without a host pipeline.

Use the scalar load's raw SRV view to query the buffer size. DXIL returns bytes for that view. Divide by the declared stride for structured descriptors so the shader still sees the guest record count. The lowering requires SRV metadata and preserves the refusal for CBVs.

A synthetic compute shader used a 32-byte input and verified both its loaded value and the descriptor count. It returned 32 for a raw view and 8 for a four-byte stride on RX 6800 and Lavapipe. In a separate Linux native integration build, six of 20 previously refused shaders from a world-loading profile passed DXIL validation and created host pipelines on RX 6800. The largest skipped pixel-shader group still fails at a later descriptor merge. Gameplay output and FPS remain unmeasured with this patch.

Based-on: Marvisak#953
Based-on: https://github.com/fxceless/victory-fork/blob/52ac4ec0f8a03f103c146e60228e53612759d435/crates/victory-shader/src/emit/lower.rs
Tested-on: RX 6800 and Lavapipe, Fedora Linux 45, Linux native
Assisted-by: gpt-6.2 sol xhigh

A scalar buffer load can use a descriptor whose record-count dword is
also read as shader data. The translator previously rejected the whole
program when it classified that descriptor through a scalar memory
instruction. That left the host without pipelines for affected shaders.

Recognize scalar buffer SRVs using the same raw view as the load. DXIL
reports that view's size in bytes, so divide by the declared stride for
structured descriptors to preserve the guest's bounds calculations.
Require SRV metadata and continue to reject constant-buffer descriptors.

Verify by dispatching a synthetic shader with a 32-byte input and checking
the load and descriptor counts for both raw and four-byte-stride views.

Based-on: Marvisak#953
Based-on: https://github.com/fxceless/victory-fork/blob/52ac4ec0f8a03f103c146e60228e53612759d435/crates/victory-shader/src/emit/lower.rs
Tested-on: RX 6800 and Lavapipe, Fedora Linux 45, Linux native
Assisted-by: gpt-6.2 sol xhigh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant