diff --git a/src/dawn/native/vulkan/DeviceVk.cpp b/src/dawn/native/vulkan/DeviceVk.cpp index 9c99b62e2c..26d638e008 100644 --- a/src/dawn/native/vulkan/DeviceVk.cpp +++ b/src/dawn/native/vulkan/DeviceVk.cpp @@ -304,6 +304,9 @@ MaybeError Device::SubmitPendingCommands() { // Transition eagerly all used external textures for export. for (auto* texture : mRecordingContext.externalTexturesForEagerTransition) { texture->TransitionEagerlyForExport(&mRecordingContext); + std::vector waitRequirements = texture->AcquireWaitRequirements(); + mRecordingContext.waitSemaphores.insert(mRecordingContext.waitSemaphores.end(), + waitRequirements.begin(), waitRequirements.end()); } DAWN_TRY( diff --git a/src/dawn/native/vulkan/TextureVk.cpp b/src/dawn/native/vulkan/TextureVk.cpp index 8fbc0552e7..1d0ba84adb 100644 --- a/src/dawn/native/vulkan/TextureVk.cpp +++ b/src/dawn/native/vulkan/TextureVk.cpp @@ -867,6 +867,10 @@ void Texture::TransitionEagerlyForExport(CommandRecordingContext* recordingConte nullptr, 0, nullptr, 1, &barrier); } +std::vector Texture::AcquireWaitRequirements() { + return std::move(mWaitRequirements); +} + MaybeError Texture::ExportExternalTexture(VkImageLayout desiredLayout, ExternalSemaphoreHandle* handle, VkImageLayout* releasedOldLayout, @@ -1051,10 +1055,6 @@ void Texture::TweakTransitionForExternalUsage(CommandRecordingContext* recording } mLastExternalState = mExternalState; - - recordingContext->waitSemaphores.insert(recordingContext->waitSemaphores.end(), - mWaitRequirements.begin(), mWaitRequirements.end()); - mWaitRequirements.clear(); } bool Texture::CanReuseWithoutBarrier(wgpu::TextureUsage lastUsage, wgpu::TextureUsage usage) { diff --git a/src/dawn/native/vulkan/TextureVk.h b/src/dawn/native/vulkan/TextureVk.h index 3ddd7d27f0..b0a2c00fa3 100644 --- a/src/dawn/native/vulkan/TextureVk.h +++ b/src/dawn/native/vulkan/TextureVk.h @@ -82,6 +82,7 @@ class Texture final : public TextureBase { // Eagerly transition the texture for export. void TransitionEagerlyForExport(CommandRecordingContext* recordingContext); + std::vector AcquireWaitRequirements(); void EnsureSubresourceContentInitialized(CommandRecordingContext* recordingContext, const SubresourceRange& range);