Skip to content

fix(gpu): expose original buffer record counts to shaders - #725

Open
GDemay wants to merge 5 commits into
pragyaangaur:mainfrom
GDemay:codex/campaign-descriptor-metadata
Open

GDemay wants to merge 5 commits into
pragyaangaur:mainfrom
GDemay:codex/campaign-descriptor-metadata

Conversation

@GDemay

@GDemay GDemay commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Summary

#620 supports static table record-count-only shaders. Mixed loads that read addresses and counts, and some direct heap loads with computed indices, still refused descriptor dword 2. Carry the original buffer record count in the view metadata table for both ordinary and quick synchronization. Bound direct heap and table lookups separately so a shader cannot read another list's extra table slots. Null or cleared records publish zero.

Verification

The original GPU fixture reaches translated resource-table and heap instructions through ordinary and quick publication, including nonzero table offsets, computed heap indices, raw, structured, typed and placed views, UAV records, nulls, replacements and out-of-range slots. On upstream 27380446e227799438b2c41693426ebb5c5e4420 the translator refused the fixture at offset 92. On Apple M5 with CrossOver Wine 11.0 and D3DMetal 4.0 beta 3, the patch ran 22 dispatches and checked 154 exact output dwords. The full-width record-count unit test passed. Independent review checked the metadata bounds, cache invalidation, synchronized initialization and GPU buffer lifetime.

VICTORY_REQUIRE_META_GPU=1 WINEDLLOVERRIDES='d3d12,d3d12core,dxgi=b' \
  tools/macos/test-wine.sh --release --locked -p victory-gpu --lib \
  gpu_reads_record_counts_from_tables_and_heaps_after_both_sync_modes -- --nocapture --test-threads=1

The original test shader uses no game assets. Coverage of the complete water simulation remains unmeasured.

@GDemay
GDemay marked this pull request as ready for review November 28, 2026 20:44
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