Skip to content

GPU: bound constant-buffer views before recording copies - #25

Open
gmankab wants to merge 1 commit into
spidercraft:linux-native-runtimefrom
gmankab:contrib/native-constant-view-limit
Open

gmankab wants to merge 1 commit into
spidercraft:linux-native-runtimefrom
gmankab:contrib/native-constant-view-limit

Conversation

@gmankab

@gmankab gmankab commented Nov 26, 2026

Copy link
Copy Markdown

A title can specify a constant-buffer view larger than the host can address. The dynamic descriptor path allocates and copies the recorded range before creating the host view. A large range wastes scratch memory and copy work, and rounding a near-maximum size to 256 bytes can wrap.

Cap the range at 4,096 16-byte registers when recording the view. Both dynamic and mirrored descriptors now use the same bounded range. Keep zero and smaller lengths as recorded, including lengths that are rounded only when the host view is made.

The regression exercises the descriptor creation API with zero, unaligned, boundary and maximum sizes. The Linux release build passed. The GPU library suite passed 44 tests with one ignored. A separate headless clear readback passed on RADV.

Based-on: fxceless/victory-fork#1206
Based-on: fxceless/victory-fork#1260
Tested-on: Fedora Linux 45, Intel Xeon E5-2670 v3, Lavapipe and AMD Radeon RX 6800 with RADV using native VKD3D-Proton
Assisted-by: gpt-6.2 sol xhigh

A descriptor can name more bytes than the host's 4,096 16-byte
registers can address. The native runtime kept the title's full length,
so a dynamic table could allocate and copy it before sending an invalid
CBV to the host. Aligning a near-u32::MAX size could also wrap.

Cap the recorded range at 64 KiB so the dynamic scratch copy and the
mirrored host view use the same bounded range. Keep the original size
for smaller and zero-byte descriptors. Cover the public creation path
with a regression for unaligned, boundary and overflowing sizes.

Based-on: fxceless/victory-fork#1206
Based-on: fxceless/victory-fork#1260
Tested-on: Fedora Linux 45, Xeon E5-2670 v3, native VKD3D-Proton with Lavapipe (44 tests) and AMD Radeon RX 6800 with RADV (clear readback)
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