Skip to content

Commit 7d1a097

Browse files
authored
vk: fix readpixels validation error (#9155)
The semaphore stages between command buffer didn't consider the data buffers (UBOS, vertices, indices) being shared across command buffers BUG=436853814
1 parent 05a6198 commit 7d1a097

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

filament/backend/src/vulkan/VulkanCommands.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,9 @@ VkSemaphore VulkanCommandBuffer::submit() {
211211
FVK_LOGI << "Submitting cmdbuffer=" << mBuffer
212212
<< " wait=(";
213213
for (size_t s = 0, count = mWaitSemaphores.size(); s < count; ++s) {
214-
FVK_LOGI << mWaitSemaphores[s] << " ";
214+
FVK_LOGI << "\tsemaphore=" << mWaitSemaphores[s] << "|stage="
215+
<< mWaitSemaphoreStages[s]
216+
<< (s < mWaitSemaphores.size() - 1 ? "\n" : "");
215217
}
216218
FVK_LOGI << ") "
217219
<< " signal=" << mSubmission
@@ -434,10 +436,13 @@ bool VulkanCommands::flush() {
434436
}
435437
if (lastSubmit != VK_NULL_HANDLE) {
436438
// Note that the stage we're waiting on is the fragment shader stage. This assumes
437-
// that the subsequent command buffer will only dependent on the fragment output of the
438-
// previous buffer, allowing for vertex work to proceed (more overlapping
439+
// that the subsequent command buffer will only depend on
440+
// 1) fragment output of the previous command buffer
441+
// 2) reading/writing of buffers (i.e. UBO) of the previous command buffer
442+
// Restricting the wait stages will allow for vertex work to proceed (more overlapping
439443
// vertex/fragment work).
440-
pool->waitFor(lastSubmit, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
444+
pool->waitFor(lastSubmit,
445+
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | VK_PIPELINE_STAGE_TRANSFER_BIT);
441446
lastSubmit = VK_NULL_HANDLE;
442447
}
443448
dependency = pool->flush();

0 commit comments

Comments
 (0)