vulkan: Move handling texture wait requirements to SubmitPendingCommands
This moves handling the wait semaphores to the same place that the signal semaphores are handled. It fixes a bug where the semaphores are never waited on and never deleted if a texture is imported and then exported without being used. Bug: chromium:1359106 Change-Id: If226a38946d4a16598d78841e7b204ea91f8bbea Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104541 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Loko Kung <lokokung@google.com>
This commit is contained in:
parent
5a687b084e
commit
70c3a4d605
|
@ -304,6 +304,9 @@ MaybeError Device::SubmitPendingCommands() {
|
||||||
// Transition eagerly all used external textures for export.
|
// Transition eagerly all used external textures for export.
|
||||||
for (auto* texture : mRecordingContext.externalTexturesForEagerTransition) {
|
for (auto* texture : mRecordingContext.externalTexturesForEagerTransition) {
|
||||||
texture->TransitionEagerlyForExport(&mRecordingContext);
|
texture->TransitionEagerlyForExport(&mRecordingContext);
|
||||||
|
std::vector<VkSemaphore> waitRequirements = texture->AcquireWaitRequirements();
|
||||||
|
mRecordingContext.waitSemaphores.insert(mRecordingContext.waitSemaphores.end(),
|
||||||
|
waitRequirements.begin(), waitRequirements.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
DAWN_TRY(
|
DAWN_TRY(
|
||||||
|
|
|
@ -867,6 +867,10 @@ void Texture::TransitionEagerlyForExport(CommandRecordingContext* recordingConte
|
||||||
nullptr, 0, nullptr, 1, &barrier);
|
nullptr, 0, nullptr, 1, &barrier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<VkSemaphore> Texture::AcquireWaitRequirements() {
|
||||||
|
return std::move(mWaitRequirements);
|
||||||
|
}
|
||||||
|
|
||||||
MaybeError Texture::ExportExternalTexture(VkImageLayout desiredLayout,
|
MaybeError Texture::ExportExternalTexture(VkImageLayout desiredLayout,
|
||||||
ExternalSemaphoreHandle* handle,
|
ExternalSemaphoreHandle* handle,
|
||||||
VkImageLayout* releasedOldLayout,
|
VkImageLayout* releasedOldLayout,
|
||||||
|
@ -1051,10 +1055,6 @@ void Texture::TweakTransitionForExternalUsage(CommandRecordingContext* recording
|
||||||
}
|
}
|
||||||
|
|
||||||
mLastExternalState = mExternalState;
|
mLastExternalState = mExternalState;
|
||||||
|
|
||||||
recordingContext->waitSemaphores.insert(recordingContext->waitSemaphores.end(),
|
|
||||||
mWaitRequirements.begin(), mWaitRequirements.end());
|
|
||||||
mWaitRequirements.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Texture::CanReuseWithoutBarrier(wgpu::TextureUsage lastUsage, wgpu::TextureUsage usage) {
|
bool Texture::CanReuseWithoutBarrier(wgpu::TextureUsage lastUsage, wgpu::TextureUsage usage) {
|
||||||
|
|
|
@ -82,6 +82,7 @@ class Texture final : public TextureBase {
|
||||||
|
|
||||||
// Eagerly transition the texture for export.
|
// Eagerly transition the texture for export.
|
||||||
void TransitionEagerlyForExport(CommandRecordingContext* recordingContext);
|
void TransitionEagerlyForExport(CommandRecordingContext* recordingContext);
|
||||||
|
std::vector<VkSemaphore> AcquireWaitRequirements();
|
||||||
|
|
||||||
void EnsureSubresourceContentInitialized(CommandRecordingContext* recordingContext,
|
void EnsureSubresourceContentInitialized(CommandRecordingContext* recordingContext,
|
||||||
const SubresourceRange& range);
|
const SubresourceRange& range);
|
||||||
|
|
Loading…
Reference in New Issue