Fix validation error reported by VulkanSDK 1.4.313.0 (#3471)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -99,15 +99,13 @@ void Context::initFrameResources() {
|
||||
|
||||
for (uint32_t index = 0; index < frameCount; ++index) {
|
||||
frameResources.emplace_back(commandBuffers[index],
|
||||
device->createSemaphoreUnique({}),
|
||||
device->createSemaphoreUnique({}),
|
||||
device->createFenceUnique(vk::FenceCreateInfo(vk::FenceCreateFlagBits::eSignaled)));
|
||||
|
||||
const auto& frame = frameResources.back();
|
||||
|
||||
backend.setDebugName(frame.commandBuffer.get(), "FrameCommandBuffer_" + std::to_string(index));
|
||||
backend.setDebugName(frame.frameSemaphore.get(), "FrameSemaphore_" + std::to_string(index));
|
||||
backend.setDebugName(frame.surfaceSemaphore.get(), "SurfaceSemaphore_" + std::to_string(index));
|
||||
backend.setDebugName(frame.acquireSurfaceSemaphore.get(), "AcquireSurfaceSemaphore_" + std::to_string(index));
|
||||
backend.setDebugName(frame.flightFrameFence.get(), "FrameFence_" + std::to_string(index));
|
||||
}
|
||||
|
||||
@@ -259,7 +257,7 @@ void Context::beginFrame() {
|
||||
MLN_TRACE_ZONE(acquireNextImageKHR);
|
||||
try {
|
||||
const vk::ResultValue acquireImageResult = device->acquireNextImageKHR(
|
||||
renderableResource.getSwapchain().get(), timeout, frame.surfaceSemaphore.get(), nullptr);
|
||||
renderableResource.getSwapchain().get(), timeout, frame.acquireSurfaceSemaphore.get(), nullptr);
|
||||
|
||||
if (acquireImageResult.result == vk::Result::eSuccess) {
|
||||
renderableResource.setAcquiredImageIndex(acquireImageResult.value);
|
||||
@@ -303,8 +301,8 @@ void Context::submitFrame() {
|
||||
auto submitInfo = vk::SubmitInfo().setCommandBuffers(frame.commandBuffer.get());
|
||||
|
||||
if (platformSurface) {
|
||||
submitInfo.setSignalSemaphores(frame.frameSemaphore.get())
|
||||
.setWaitSemaphores(frame.surfaceSemaphore.get())
|
||||
submitInfo.setSignalSemaphores(renderableResource.getAcquiredSemaphore())
|
||||
.setWaitSemaphores(frame.acquireSurfaceSemaphore.get())
|
||||
.setWaitDstStageMask(waitStageMask);
|
||||
}
|
||||
|
||||
@@ -320,7 +318,7 @@ void Context::submitFrame() {
|
||||
const auto acquiredImage = renderableResource.getAcquiredImageIndex();
|
||||
const auto presentInfo = vk::PresentInfoKHR()
|
||||
.setSwapchains(renderableResource.getSwapchain().get())
|
||||
.setWaitSemaphores(frame.frameSemaphore.get())
|
||||
.setWaitSemaphores(renderableResource.getAcquiredSemaphore())
|
||||
.setImageIndices(acquiredImage);
|
||||
|
||||
try {
|
||||
|
||||
@@ -159,6 +159,12 @@ void SurfaceRenderableResource::initSwapchain(uint32_t w, uint32_t h) {
|
||||
|
||||
colorFormat = swapchainCreateInfo.imageFormat;
|
||||
extent = swapchainCreateInfo.imageExtent;
|
||||
|
||||
swapchainSemaphores.reserve(swapchainImageCount);
|
||||
for (uint32_t index = 0; index < swapchainImageCount; ++index) {
|
||||
swapchainSemaphores.emplace_back(device->createSemaphoreUnique({}));
|
||||
backend.setDebugName(swapchainSemaphores.back().get(), "SurfaceSemaphore_" + std::to_string(index));
|
||||
}
|
||||
}
|
||||
|
||||
void SurfaceRenderableResource::initDepthStencil() {
|
||||
@@ -241,6 +247,10 @@ const vk::Image SurfaceRenderableResource::getAcquiredImage() const {
|
||||
return colorAllocations[acquiredImageIndex]->image;
|
||||
}
|
||||
|
||||
const vk::Semaphore& SurfaceRenderableResource::getAcquiredSemaphore() const {
|
||||
return swapchainSemaphores[acquiredImageIndex].get();
|
||||
}
|
||||
|
||||
bool SurfaceRenderableResource::hasSurfaceTransformSupport() const {
|
||||
#ifdef __ANDROID__
|
||||
return surface && capabilities.supportedTransforms != vk::SurfaceTransformFlagBitsKHR::eIdentity;
|
||||
@@ -391,6 +401,7 @@ void SurfaceRenderableResource::recreateSwapchain() {
|
||||
renderPass.reset();
|
||||
swapchainImageViews.clear();
|
||||
swapchainImages.clear();
|
||||
swapchainSemaphores.clear();
|
||||
|
||||
init(extent.width, extent.height);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user