Skip to content

GPU: cap constant view sizes before rounding - #1206

Open
gmankab wants to merge 1 commit into
fxceless:mainfrom
gmankab:contrib/fxceless-constant-size-overflow
Open

gmankab wants to merge 1 commit into
fxceless:mainfrom
gmankab:contrib/fxceless-constant-size-overflow

Conversation

@gmankab

@gmankab gmankab commented Nov 26, 2026

Copy link
Copy Markdown

The introduced 64 KiB constant-buffer cap rounds the raw size before comparing it to the limit. A release build wraps u32::MAX to a zero-sized view. Checking the cap first prevents this and preserves the existing diagnostic.

The extracted release helper returned 0 bytes before the change and 65,536 bytes afterward. The Windows victory-gpu constant-view regression also passed under Wine with the hardware GPU hidden.

Based-on: #911
Tested-on: Fedora Linux 45, Intel Xeon E5-2670 v3 with Wine and Lavapipe
Assisted-by: gpt-6.2 sol xhigh

The constant-view helper accepts a raw u32 size. Rounding to 256
bytes before comparing with 64 KiB can overflow. The release helper
makes a size of zero for u32::MAX, which defeats the cap and hands
the host an invalid descriptor. A checked build panics there.

Compare the raw size with the 64 KiB cap first. The remaining
rounding then fits, and the existing warning still reports oversized
requests. Extend the regression to cover zero and u32::MAX.

Based-on: fxceless@2ba6e1f
Tested-on: Fedora Linux 45, Intel Xeon E5-2670 v3 with Wine and Lavapipe
Assisted-by: gpt-6.2 sol xhigh
fxceless added a commit that referenced this pull request Nov 26, 2026
A size within 255 of the largest 32-bit number rounded past it: 0 in a release build, a view of no bytes with no line. Three more cases in the test.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
dkdknight pushed a commit to dkdknight/victory-fork that referenced this pull request Nov 26, 2026
…eless#1206)

A size within 255 of the largest 32-bit number rounded past it: 0 in a release build, a view of no bytes with no line. Three more cases in the test.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit a183ea2)
e4glevlr added a commit to e4glevlr/victory-fork that referenced this pull request Nov 26, 2026
…xceless#1206, fxceless#1210, fxceless#1241, fxceless#1214, fxceless#1044, fxceless#1227)

- fxceless#1205: make upload fills wait for flights by default (VICTORY_FILL_WAIT=0 opt-in, fixes fxceless#1025 blurred oval while keeping fxceless#860 per-piece hold)
- fxceless#1147: guard only mapped view memory, never committed private or free memory (fixes structure-builder freeze)
- fxceless#1206 (a183ea2): cap CBV size at 64 KiB before 256-byte rounding
- fxceless#1210 (41f9857): preserve ResourceMinLODClamp in tiles::show_from
- fxceless#1241 (19a45d1): copy aliased GPU-written texture view even if list already uploaded view from title memory
- fxceless#1214 (f9fdf19): log ID3D12DeviceRemovedExtendedData2 device state in removal_data
- fxceless#1044: size DirectStorage worker pool to physical cores (VICTORY_DSTORAGE_WORKERS override)
- fxceless#1227: batch send-and-hash into copies -> 1 barrier -> hash dispatches (VICTORY_CARD_SYNC_BATCH=0 fallback)
DiogoPCastelos pushed a commit to DiogoPCastelos/victory-fork that referenced this pull request Nov 26, 2026
…eless#1206)

A size within 255 of the largest 32-bit number rounded past it: 0 in a release build, a view of no bytes with no line. Three more cases in the test.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit a183ea2)
clquwu added a commit to clquwu/leonida-ultimate that referenced this pull request Nov 26, 2026
…line retire tickets

- Replace staging_queue->idle() (vkQueueWaitIdle under submit_mutex_ + staging_mutex) in Resource::staged_copy with async timeline-ticket staging retirement for writes and lock-free wait_retire_ticket() + host_readable barrier for reads.
- Add DeviceState::staging_pool_retired FIFO + staging_in_flight_bytes backpressure guard (<= kStagingPoolCapBytes) + reclaim_retired_staging() + full teardown cleanup in destroy_staging_pool().
- Propagate cross-queue GPU-side timeline dependency via note_bindless_upload() when multi-queue device performs async staged writes.
- Cap CBV sizes to 64 KiB before 256-byte rounding in write_constant_buffer_view() (fxceless/victory-fork#1206).
- Add Vulkan-validated async WriteToSubresource burst/readback/immediate-destroy test in d3d12_existing_heap_test.cpp and UINT_MAX CBV clamp check in d3d12_xmem_shadow_test.cpp.
grosterr added a commit to grosterr/victory-fork that referenced this pull request Nov 26, 2026
Conflicts resolved with both sides kept:
- descriptor/host.rs: main's constant_view_size (CBV cap, fxceless#1206/fxceless#1260) and made_now
  records; the stack's tiled-slot bookkeeping (5181f96: record_tiled, forget_tiled,
  tiled_stale) with made_now stored after the slot is made and kept.
- drvwatch.rs: fxceless#1101's query (every driver entry, the Display source from warning up)
  kept with its test; main's QUERY (fxceless#1255) dropped as the same filter; its Auto HDR
  note moved into the comment.
- host.rs: main's batched hash passes (CARD_SYNC_BATCH) with the stack's census::sent;
  the view-set line beside main's video memory line.
- pipeline/host.rs: the stack's host_blend and main's integer_targets_do_not_blend both
  stay (main's clears blending when the state is read, the stack's at creation).
- texture.rs: Last keeps fxceless#768's motion and main's ahead; the hash turn honours both.
- watch.rs: known_view asks main's light-refresh bits first, then the stack's view set;
  one title_memory_committed doing both (parked/absent blocks back to unclean, and
  ABSENT_ONCE notes and their hole bits forgotten).
- xmem.rs: main's on_commit with fxceless#1185's caller address.
- tiles.rs: the stack's kept-by-a-list test and main's resident-view LOD test (fxceless#1210).
- emit/mod.rs: the stack's paired-form-first closure and main's WAVE_WIDE=last; its
  result keeps the stack's (shader, groups) return type.
- indirect.rs, resource.rs, lib.rs: main's.
- README.md ours; README-upstream.md from main with fxceless#1057's wording.
Two main watch tests assumed no view set (fxceless#812 parks placeholder holes until the
runtime tells): the ABSENT_ONCE test's silent-mapping expectations depend on view_set(),
and the light-refresh hole test runs with VICTORY_VIEW_SET=0; both pass unchanged there.

NB: fxceless#1014's 64-thread hash is opt-in now (VICTORY_CARD_HASH_WIDE=1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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