Renderer: Refactor transient resources (allow access at any time)

This commit is contained in:
SirLynix
2023-07-21 08:51:39 +02:00
committed by Jérôme Leclercq
parent de68033a0e
commit 4db5b59ec9
21 changed files with 265 additions and 240 deletions

View File

@@ -21,22 +21,6 @@ namespace Nz
{
VulkanDevice::~VulkanDevice() = default;
void VulkanDevice::Execute(const FunctionRef<void(CommandBufferBuilder& builder)>& callback, QueueType queueType)
{
Vk::AutoCommandBuffer commandBuffer = AllocateCommandBuffer(queueType);
if (!commandBuffer->Begin(VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT))
throw std::runtime_error("failed to begin command buffer: " + TranslateVulkanError(commandBuffer->GetLastErrorCode()));
VulkanCommandBufferBuilder builder(commandBuffer);
callback(builder);
if (!commandBuffer->End())
throw std::runtime_error("failed to build command buffer: " + TranslateVulkanError(commandBuffer->GetLastErrorCode()));
GetQueue(GetDefaultFamilyIndex(queueType), 0).Submit(commandBuffer);
GetQueue(GetDefaultFamilyIndex(queueType), 0).WaitIdle();
}
const RenderDeviceInfo& VulkanDevice::GetDeviceInfo() const
{
return m_renderDeviceInfo;

View File

@@ -332,6 +332,11 @@ namespace Nz
}
}
TransientResources& VulkanSwapchain::Transient()
{
return *m_concurrentImageData[m_currentFrame];
}
bool VulkanSwapchain::SetupDepthBuffer()
{
VkImageCreateInfo imageCreateInfo = {