MCPcopy Create free account
hub / github.com/3Shain/dxmt / WaitForFinishThread

Method WaitForFinishThread

src/dxmt/dxmt_command_queue.cpp:167–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165}
166
167uint32_t
168CommandQueue::WaitForFinishThread() {
169 env::setThreadName("dxmt-finish-thread");
170 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
171 uint64_t internal_seq = 1;
172 while (!stopped.load()) {
173 ready_for_commit.wait(internal_seq, std::memory_order_acquire);
174 if (stopped.load())
175 break;
176 auto &chunk = chunks[internal_seq % kCommandChunkCount];
177 if (chunk.attached_cmdbuf.status() <= WMTCommandBufferStatusScheduled) {
178 chunk.attached_cmdbuf.waitUntilCompleted();
179 }
180 if (chunk.attached_cmdbuf.status() == WMTCommandBufferStatusError) {
181 ERR("Device error at frame ", chunk.frame_, ": ", chunk.attached_cmdbuf.error().description().getUTF8String());
182 }
183 if (auto logs = chunk.attached_cmdbuf.logs()) {
184 for (auto &log : logs.elements()) {
185 ERR("Frame ", chunk.frame_, ": ", log.description().getUTF8String());
186 }
187 }
188
189 if (chunk.signal_frame_latency_fence_ != ~0ull)
190 frame_latency_fence_.signal(chunk.signal_frame_latency_fence_);
191
192 chunk.reset();
193 cpu_coherent.signal(internal_seq);
194 chunk_ongoing.fetch_sub(1, std::memory_order_release);
195 chunk_ongoing.notify_one();
196
197 staging_allocator.free_blocks(internal_seq);
198 copy_temp_allocator.free_blocks(internal_seq);
199 argbuf_allocator.free_blocks(internal_seq);
200
201 internal_seq++;
202 }
203 TRACE("finishing thread gracefully terminates");
204 return 0;
205}
206
207void CommandQueue::Retain(uint64_t seq, Allocation* allocation) {
208 auto &chunk = chunks[seq % kCommandChunkCount];

Callers 1

CommandQueueMethod · 0.95

Calls 15

setThreadNameFunction · 0.85
SetThreadPriorityFunction · 0.85
GetCurrentThreadFunction · 0.85
statusMethod · 0.80
waitUntilCompletedMethod · 0.80
getUTF8StringMethod · 0.80
descriptionMethod · 0.80
errorMethod · 0.80
logsMethod · 0.80
elementsMethod · 0.80
signalMethod · 0.80
notify_oneMethod · 0.80

Tested by

no test coverage detected