Keep constant buffers in placed-copy order #340

Merged
TaynanGT merged 1 commit from upstream-pr/340 into main 2026-11-27 17:55:56 +00:00
TaynanGT commented 2026-11-27 17:49:10 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T17:49:10Z.


Take a GPU snapshot when a draw reads constants written by an earlier placed copy. Reuse it within the command list until another write overlaps the same bytes.

Enable this path with VICTORY_PLACED_CONSTANTS=1.

Windows workspace tests and Clippy passed. Two D3D12 readbacks checked the value between successive copies and the CPU bytes around a partial copy. I also tested the option in a short Series S run at 3840×2160 with DLSS Quality and 2× frame generation.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:issue:5530907010 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/340). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-27T17:49:10Z. --- Take a GPU snapshot when a draw reads constants written by an earlier placed copy. Reuse it within the command list until another write overlaps the same bytes. Enable this path with `VICTORY_PLACED_CONSTANTS=1`. Windows workspace tests and Clippy passed. Two D3D12 readbacks checked the value between successive copies and the CPU bytes around a partial copy. I also tested the option in a short Series S run at 3840×2160 with DLSS Quality and 2× frame generation.
chatgpt-codex-connector[bot] commented 2026-11-27 17:49:23 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by chatgpt-codex-connector[bot] on 2026-11-27T17:49:23Z.


Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-27T17:51:21.063943Z cf2a965 PR opened
🔒 Security Review ✅ Completed 2026-11-27T17:53:02.213969Z cf2a965 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7224823550 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/340#issuecomment-7224823550). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/apps/chatgpt-codex-connector) on 2026-11-27T17:49:23Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"cf2a9655a0214b45a5b4d7cb1c2ec9aee2c34c1d","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":"cf2a9655a0214b45a5b4d7cb1c2ec9aee2c34c1d","has_any_findings":null,"has_unresolved_findings":null,"status":"completed"}} --> <!-- codex-security-review:v1 {"blockingSeverityThreshold":"P0","headSha":"cf2a9655a0214b45a5b4d7cb1c2ec9aee2c34c1d","mergeGateEnabled":false,"pullRequestNumber":340,"repository":"TaynanGT/Vice-Tay","status":"completed"} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-27T17:51:21.063943Z">2026-11-27T17:51:21.063943Z</relative-time> | `cf2a965` | PR opened | | 🔒 **Security Review** | ✅ **Completed** <relative-time datetime="2026-11-27T17:53:02.213969Z">2026-11-27T17:53:02.213969Z</relative-time> | `cf2a965` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review" or "@codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
chatgpt-codex-connector[bot] commented 2026-11-27 17:51:18 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by chatgpt-codex-connector[bot] on 2026-11-27T17:51:18Z.

Review: COMMENTED


💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cf2a9655a0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<!-- greyfinch-sync:TaynanGT/Vice-Tay:review:6091752946 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/340#pullrequestreview-6091752946). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/apps/chatgpt-codex-connector) on 2026-11-27T17:51:18Z. **Review:** COMMENTED --- <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `cf2a9655a0` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". </details>
chatgpt-codex-connector[bot] commented 2026-11-27 17:51:19 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by chatgpt-codex-connector[bot] on 2026-11-27T17:51:19Z.

Code review location: crates/victory-gpu/src/draw.rs; line 4250

@@ -4245,6 +4245,10 @@ impl State {
                                 None => crate::port_cbv::copied(true),
                             }
                         }
+                        if let Some((buffer, gpu)) = list.snapshot_placed_constants(address, size) {
+                            host.constant_at(index, &buffer, gpu, size);
+                            continue;

P2 Badge Invalidate cached descriptor tables when snapshot sources change

With VICTORY_PLACED_CONSTANTS=1, a sequence of placed copy A → draw → overlapping placed copy B → draw using the same descriptor table keeps binding A's GPU snapshot. State::tables caches tables by descriptor words, and its existing-table branch reuses the original slots without processing CBVs again, even when list.epoch() changes. Consequently, invalidating constant_values does not cause this new snapshot path to run for the second draw. Make snapshot-backed table reuse depend on the relevant write version and allocate new descriptor slots after invalidation so earlier draws retain their original snapshots. The added readback tests call snapshot_placed_constants directly, so they do not exercise this binding path.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:review-comment:4722350019 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/340#discussion_r4722350019). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/apps/chatgpt-codex-connector) on 2026-11-27T17:51:19Z. **Code review location:** `crates/victory-gpu/src/draw.rs`; line 4250 ~~~~diff @@ -4245,6 +4245,10 @@ impl State { None => crate::port_cbv::copied(true), } } + if let Some((buffer, gpu)) = list.snapshot_placed_constants(address, size) { + host.constant_at(index, &buffer, gpu, size); + continue; ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Invalidate cached descriptor tables when snapshot sources change** With `VICTORY_PLACED_CONSTANTS=1`, a sequence of placed copy A → draw → overlapping placed copy B → draw using the same descriptor table keeps binding A's GPU snapshot. `State::tables` caches tables by descriptor words, and its existing-table branch reuses the original slots without processing CBVs again, even when `list.epoch()` changes. Consequently, invalidating `constant_values` does not cause this new snapshot path to run for the second draw. Make snapshot-backed table reuse depend on the relevant write version and allocate new descriptor slots after invalidation so earlier draws retain their original snapshots. The added readback tests call `snapshot_placed_constants` directly, so they do not exercise this binding path. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
TaynanGT commented 2026-11-29 19:06:53 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-29T19:06:53Z.

Code review location: crates/victory-gpu/src/draw.rs; line 4250

@@ -4245,6 +4245,10 @@ impl State {
                                 None => crate::port_cbv::copied(true),
                             }
                         }
+                        if let Some((buffer, gpu)) = list.snapshot_placed_constants(address, size) {
+                            host.constant_at(index, &buffer, gpu, size);
+                            continue;

The current table reuse path still needs an end-to-end check with two overlapping placed writes and two draws using the same table. An epoch change alone is not sufficient if the cached CBV slots survive it. Snapshot-backed tables must get new slots without changing descriptors used by earlier draws.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:review-comment:4732744753 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/340#discussion_r4732744753). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-29T19:06:53Z. **Code review location:** `crates/victory-gpu/src/draw.rs`; line 4250 ~~~~diff @@ -4245,6 +4245,10 @@ impl State { None => crate::port_cbv::copied(true), } } + if let Some((buffer, gpu)) = list.snapshot_placed_constants(address, size) { + host.constant_at(index, &buffer, gpu, size); + continue; ~~~~ --- The current table reuse path still needs an end-to-end check with two overlapping placed writes and two draws using the same table. An epoch change alone is not sufficient if the cached CBV slots survive it. Snapshot-backed tables must get new slots without changing descriptors used by earlier draws.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
TaynanGT/Vice-Tay!340
No description provided.