Indirect draws drain the queue-0 draw pipeline (#1202) #1895

Closed
opened 2026-10-08 22:55:15 +00:00 by fisherjoey · 2 comments
fisherjoey commented 2026-10-08 22:55:15 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-08T22:55:15Z.


With #1201/#1202, a direct draw on queue 0 becomes a commit item and the packet worker moves on. An indirect draw (DRAW_INDIRECT, DRAW_INDEX_INDIRECT, DRAW_INDEX_INDIRECT_MULTI) drains the pipeline first and then records Graphics::Draw inline on the worker, under the GPU mutex (Draw.cpp, the DrainReason::Indirect drain at the top of Driver::draw).

Most of Demon's Souls' draws are indirect, so most of its draw recording stays on the worker. Tutorial level, debug start menu route, APS5_PROFILE_DRAW=1, per 10 s on the #1202 stack:

  • DRAW_INDEX_INDIRECT: ~223k packets, 4.6 s of queue-0 time. Direct draw packets (DRAW_INDEX_OFFSET_2): ~19k.
  • Committer: 27k commits at 18 us, 5 % busy.
  • Graphics::Draw on the worker: 1.8-1.9 s.
  • Queue 0 is 96-97 % of the frame (470 of 490 ms).

All of these indirect draws take the GPU-side path ([indirect] gpu-side, cpu-side 0), so the drain does not protect a CPU read of the arguments.

A fix is ready on https://github.com/fisherjoey/AnyPS5/tree/perf/pipeline-indirect-draws: APS5_PIPELINE_INDIRECT=1 (off by default) enqueues indirect draws as commit items. It drains only when the argument range, or the count dword, overlaps a pending write. Measured: 490 -> 441 ms per frame (-10 %).

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5770067069 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1895). Originally posted by [fisherjoey](https://github.com/fisherjoey) on 2026-10-08T22:55:15Z. --- With #1201/#1202, a direct draw on queue 0 becomes a commit item and the packet worker moves on. An indirect draw (`DRAW_INDIRECT`, `DRAW_INDEX_INDIRECT`, `DRAW_INDEX_INDIRECT_MULTI`) drains the pipeline first and then records `Graphics::Draw` inline on the worker, under the GPU mutex (`Draw.cpp`, the `DrainReason::Indirect` drain at the top of `Driver::draw`). Most of Demon's Souls' draws are indirect, so most of its draw recording stays on the worker. Tutorial level, debug start menu route, `APS5_PROFILE_DRAW=1`, per 10 s on the #1202 stack: - `DRAW_INDEX_INDIRECT`: ~223k packets, 4.6 s of queue-0 time. Direct draw packets (`DRAW_INDEX_OFFSET_2`): ~19k. - Committer: 27k commits at 18 us, 5 % busy. - `Graphics::Draw` on the worker: 1.8-1.9 s. - Queue 0 is 96-97 % of the frame (470 of 490 ms). All of these indirect draws take the GPU-side path (`[indirect] gpu-side`, cpu-side 0), so the drain does not protect a CPU read of the arguments. A fix is ready on https://github.com/fisherjoey/AnyPS5/tree/perf/pipeline-indirect-draws: `APS5_PIPELINE_INDIRECT=1` (off by default) enqueues indirect draws as commit items. It drains only when the argument range, or the count dword, overlaps a pending write. Measured: 490 -> 441 ms per frame (-10 %). AI-assisted: yes
oneandonlydean commented 2026-10-14 00:09:56 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T00:09:56Z.


The queue-0 draw pipeline only exists with #1201/#1202, which aren't on main, so this belongs on #1202. Please post it there; this can close then.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6157885376 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1895#issuecomment-6157885376). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T00:09:56Z. --- The queue-0 draw pipeline only exists with #1201/#1202, which aren't on main, so this belongs on #1202. Please post it there; this can close then.
fisherjoey commented 2026-10-14 00:42:07 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-14T00:42:07Z.


Moved to #1202 (https://github.com/boykopovar/AnyPS5/pull/1202). Closing.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6158278871 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1895#issuecomment-6158278871). Originally posted by [fisherjoey](https://github.com/fisherjoey) on 2026-10-14T00:42:07Z. --- Moved to #1202 (https://github.com/boykopovar/AnyPS5/pull/1202). Closing. AI-assisted: yes
Sign in to join this conversation.
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
boykopovar/AnyPS5#1895
No description provided.