Skip to content

fix(dx12): transition render targets explicitly#259

Closed
besmpl wants to merge 1 commit into
gogpu:mainfrom
besmpl:codex/upstream-dx12-render-transitions
Closed

fix(dx12): transition render targets explicitly#259
besmpl wants to merge 1 commit into
gogpu:mainfrom
besmpl:codex/upstream-dx12-render-transitions

Conversation

@besmpl

@besmpl besmpl commented Jul 14, 2026

Copy link
Copy Markdown

Summary

Track DX12 texture resource state consistently and emit required barriers for:

  • render-target and depth/stencil attachments
  • buffer/texture and texture/texture copies
  • MSAA resolve source/destination and resting states
  • external surfaces around PRESENT

Textures created by this backend do not opt into ALLOW_SIMULTANEOUS_ACCESS, so render-target and depth states are not implicit promotions. Resolve transitions now use and update actual tracked states instead of hardcoded before-states. Focused tests capture exact transition sequences without calling native FFI.

This extracts and completes the independent DX12 transition fix identified in #253. It contains no counted-draw or prepared-indexed behavior.

Verification

  • GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go test -c -o /tmp/wgpu-dx12-transitions-windows-amd64.test.exe ./hal/dx12
  • GOOS=windows GOARCH=arm64 CGO_ENABLED=0 go test -c -o /tmp/wgpu-dx12-transitions-windows-arm64.test.exe ./hal/dx12
  • git diff --check

@besmpl besmpl requested a review from kolkov as a code owner July 14, 2026 12:25
@besmpl besmpl force-pushed the codex/upstream-dx12-render-transitions branch from 7028791 to 64443c5 Compare July 14, 2026 12:32
@besmpl besmpl marked this pull request as draft July 14, 2026 12:46
@besmpl

besmpl commented Jul 14, 2026

Copy link
Copy Markdown
Author

Marking this draft while I tighten the state model. Final review found that the current revision still relies on global whole-texture recording-time state, which is not safe for abandoned/reordered command buffers, swapchain PRESENT state, disjoint subresources, or sampled read-only depth. I will either replace it with command-local subresource-aware tracking and focused coverage, or narrow the PR to a correctness shape that can be proven independently. The current branch should not be merged.

@besmpl

besmpl commented Jul 14, 2026

Copy link
Copy Markdown
Author

Superseded by #262, which replaces the recording-time transition patch with submission-ordered state reconciliation and includes the reviewed copy/view/lifetime fixes. Please review #262 instead; this draft remains intentionally unmerged.

@besmpl besmpl closed this Jul 14, 2026
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