Commit 09a0743
committed
Fix double-pop of the execution tracking queue in Base::CommandQueueTracking, introduced by commit 1184cff ("Fix command list set execution state tracking")
The background execution-waiting thread does:
1. PopNextExecutingCommandListSet() // locks queue, pops front, waits on fence, Complete()
2. CompleteCommandListSetExecution() // locks queue again, pops front if it == the set just completed
The set is already gone from the queue after the first call, so the second pop was meant to be a no-op. But between the two calls the queue mutex is released, and the main thread — which owns the same CommandListSet object for that frame buffer index — can come all the way around the frame ring and re-execute the very same object, pushing it back to the front. CompleteCommandListSetExecution then matched it by address and popped that new execution out of tracking.
From there the failure is deterministic: the set is Executing but untracked, so WaitUntilCompleted(frame_index) finds nothing via IsExecutingOnFrameIndex() and returns without waiting, and the next Reset() on its command lists throws InvalidArgumentException<Rhi::CommandListState> — CommandList.cpp:98.
Heavy CPU load widens the window: the background thread gets descheduled right after PopNextExecutingCommandListSet() returns, while the main thread runs a full 3-frame ring in well under a millisecond.1 parent ff5c1f1 commit 09a0743
2 files changed
Lines changed: 26 additions & 14 deletions
File tree
- Modules/Graphics/RHI/Base
- Include/Methane/Graphics/Base
- Sources/Methane/Graphics/Base
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
| |||
Lines changed: 25 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
146 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
147 | 149 | | |
148 | 150 | | |
149 | 151 | | |
| |||
154 | 156 | | |
155 | 157 | | |
156 | 158 | | |
157 | | - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
158 | 162 | | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
185 | 192 | | |
186 | 193 | | |
187 | 194 | | |
| |||
251 | 258 | | |
252 | 259 | | |
253 | 260 | | |
254 | | - | |
| 261 | + | |
255 | 262 | | |
256 | 263 | | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
263 | 274 | | |
264 | 275 | | |
265 | 276 | | |
| |||
0 commit comments