Skip to content

fix(shader): reject typed store offsets and use real strides - #181

Closed
vedantdadhich21 wants to merge 1 commit into
pragyaangaur:mainfrom
vedantdadhich21:fix/typed-store-offsets
Closed

vedantdadhich21 wants to merge 1 commit into
pragyaangaur:mainfrom
vedantdadhich21:fix/typed-store-offsets

Conversation

@vedantdadhich21

Copy link
Copy Markdown
Contributor

Summary

Two typed-store correctness bugs in GFX10 lowering:

  1. buffer_store_format_xyzw accumulated immediate, offen, soffset, and built-descriptor offsets, but only rejected offen and nonzero immediate offset. Register or inline-constant soffset was silently discarded, so stores could hit the wrong element. Until offset folding is implemented, instruction-valued accumulated offsets are now rejected like typed loads.
  2. Typed-store write marks always claimed 16 bytes. Marks now use the runtime view stride, preventing 4-, 8-, and 12-byte elements from dirtying the following page.

mark_view_write now accepts a runtime width and handles zero width without underflow.

Regressions

  • RGBA32 and RGB32 typed stores with register and inline-constant soffset fail translation; inline zero still succeeds.
  • Full typed stores ending exactly at a 64 KiB boundary mark only the touched page for 4-, 8-, 12-, and 16-byte elements.
  • The native offset regression failed against the original lowering.

D3DMetal substitutes R32G32 for RGB32 typed buffers and drops the RGB32 store, so the Wine page-mark test still checks RGB32 marks but skips its byte comparison; WARP would cover the bytes where SM 6.6 is available.

Verification

  • Native victory-shader: 166 passed, 2 ignored.
  • Wine targeted typed-store tests: 2 passed.
  • Strict all-target/all-feature Windows Clippy: passed.
  • cargo xtask policy: 215 files ok.
  • git diff --check: passed.

No game files or proprietary assets were used. AI-assisted.

Signed-off-by: Vedant Dadhich <vedantdadhich21@gmail.com>
@vedantdadhich21
vedantdadhich21 marked this pull request as ready for review November 25, 2026 23:15
@vedantdadhich21

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #196. #196 is rebased on this typed-store offset/stride fix and keeps its regressions green while adding integer typed-buffer overload selection. Consolidating avoids two conflicting changes to the same typed-store lowering.

@vedantdadhich21
vedantdadhich21 deleted the fix/typed-store-offsets branch November 26, 2026 00:37
@pragyaangaur pragyaangaur added area:shader Shader translator bug Something isn't working d3dmetal A difference in Apple's D3DMetal labels Nov 26, 2026
ZebeastSantaCruz83142069 pushed a commit to ZebeastSantaCruz83142069/VIctory-macOS831 that referenced this pull request Nov 26, 2026
…gyaangaur#244)

Fixes pragyaangaur#181.

Concurrent WARP (d3d10warp.dll) usage across threads crashes with
0xC0000005 on Windows 11, both when creating/tearing down separate
WARP devices and when compiling pipelines or executing work concurrently
on a single shared WARP device.

Keep one process-wide WARP ID3D12Device in Host::new (for explicit
warp = true, VICTORY_WARP=1, and systems whose default DXGI adapter
has DXGI_ADAPTER_FLAG_SOFTWARE) and serialize WARP root signature
creation, pipeline compilation, draws, and dispatches behind a
process-wide mutex. Hardware D3D12 devices remain unserialized.

Route diff_tests's direct CreateRootSignature calls through
Host::root_signature_bytes so they share the same serialization, and
add a multi-threaded WARP regression test (parallel_warp_pipelines_and_draws).

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

area:shader Shader translator bug Something isn't working d3dmetal A difference in Apple's D3DMetal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants