MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-ValidationLayers / EnqueueWait

Method EnqueueWait

layers/state_tracker/semaphore_state.cpp:133–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133void vvl::Semaphore::EnqueueWait(const SubmissionReference& wait_submit, uint64_t& payload) {
134 auto guard = WriteLock();
135 if (type == VK_SEMAPHORE_TYPE_BINARY) {
136 // Update the swapchain image acquire state if the semaphore was used by the acquire operation
137 if (acquired_image_swapchain_ && !acquired_image_swapchain_->Destroyed()) {
138 assert(acquired_image_index_ != vvl::kNoIndex32);
139 acquired_image_swapchain_->images[acquired_image_index_].acquire_semaphore_status = AcquireSyncStatus::WasWaitedOn;
140 acquired_image_swapchain_.reset();
141 acquired_image_index_ = vvl::kNoIndex32;
142 }
143 // Get payload value
144 if (timeline_.empty()) {
145 if (scope_ != vvl::Semaphore::kInternal) {
146 // for external semaphore mark wait as completed, no guarantee of signal visibility
147 completed_ = SemOp(kWait, wait_submit.queue, 0);
148 current_payload_ = 0;
149 return;
150 } else {
151 // generate binary payload value from the last completed signals
152 assert(completed_.op_type == kSignal);
153 payload = completed_.payload;
154 }
155 } else {
156 // generate binary payload value from the most recent pending binary signal
157 assert(timeline_.rbegin()->second.HasSignaler());
158 payload = timeline_.rbegin()->first;
159 }
160 }
161
162 if (payload <= completed_.payload) {
163 // Signal is already retired and its timepoint removed. Mark wait as completed.
164 // NOTE: wait's submission can still be pending, but timepoint lifetime logic
165 // is determined by the signal. completed_ is updated when signal is retired.
166 // The matching waits should be resolved against completed_ in this case.
167 assert(!vvl::Contains(timeline_, payload));
168 completed_.op_type = kWait;
169 completed_.queue = wait_submit.queue;
170 return;
171 }
172
173 timeline_[payload].wait_submits.emplace_back(wait_submit);
174}
175
176void vvl::Semaphore::EnqueueAcquire(vvl::Func acquire_command) {
177 assert(type == VK_SEMAPHORE_TYPE_BINARY);

Callers 2

PreSubmitMethod · 0.80

Calls 9

WriteLockClass · 0.85
SemOpClass · 0.85
ContainsFunction · 0.85
DestroyedMethod · 0.80
HasSignalerMethod · 0.80
emplace_backMethod · 0.80
resetMethod · 0.45
emptyMethod · 0.45
rbeginMethod · 0.45

Tested by

no test coverage detected