|
@@ -1448,6 +1448,7 @@ void Graphics::pickPhysicalDevice()
|
|
|
deviceApiVersion = properties.apiVersion;
|
|
|
|
|
|
msaaSamples = getMsaaCount(requestedMsaa);
|
|
|
+ depthStencilFormat = findDepthFormat();
|
|
|
}
|
|
|
|
|
|
bool Graphics::checkDeviceExtensionSupport(VkPhysicalDevice device)
|
|
@@ -2181,7 +2182,6 @@ VkRenderPass Graphics::createRenderPass(RenderPassConfiguration &configuration)
|
|
|
return renderPass;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
VkRenderPass Graphics::getRenderPass(RenderPassConfiguration &configuration)
|
|
|
{
|
|
|
VkRenderPass renderPass;
|
|
@@ -2362,7 +2362,7 @@ void Graphics::setDefaultRenderPass()
|
|
|
|
|
|
RenderPassConfiguration renderPassConfiguration{};
|
|
|
renderPassConfiguration.colorAttachments.push_back({ swapChainImageFormat, VK_ATTACHMENT_LOAD_OP_LOAD, msaaSamples });
|
|
|
- renderPassConfiguration.staticData.depthStencilAttachment = { findDepthFormat(), VK_ATTACHMENT_LOAD_OP_LOAD, VK_ATTACHMENT_LOAD_OP_LOAD, msaaSamples };
|
|
|
+ renderPassConfiguration.staticData.depthStencilAttachment = { depthStencilFormat, VK_ATTACHMENT_LOAD_OP_LOAD, VK_ATTACHMENT_LOAD_OP_LOAD, msaaSamples };
|
|
|
if (msaaSamples & VK_SAMPLE_COUNT_1_BIT)
|
|
|
renderPassConfiguration.staticData.resolve = false;
|
|
|
else
|
|
@@ -2384,8 +2384,8 @@ void Graphics::setDefaultRenderPass()
|
|
|
framebufferConfiguration.staticData.resolveView = swapChainImageViews.at(imageIndex);
|
|
|
}
|
|
|
|
|
|
- renderPassState.renderPassConfiguration = renderPassConfiguration;
|
|
|
- renderPassState.framebufferConfiguration = framebufferConfiguration;
|
|
|
+ renderPassState.renderPassConfiguration = std::move(renderPassConfiguration);
|
|
|
+ renderPassState.framebufferConfiguration = std::move(framebufferConfiguration);
|
|
|
|
|
|
if (renderPassState.windowClearRequested)
|
|
|
clear(renderPassState.mainWindowClearColorValue, renderPassState.mainWindowClearStencilValue, renderPassState.mainWindowClearDepthValue);
|
|
@@ -2890,12 +2890,10 @@ VkFormat Graphics::findDepthFormat()
|
|
|
|
|
|
void Graphics::createDepthResources()
|
|
|
{
|
|
|
- VkFormat depthAttachment = findDepthFormat();
|
|
|
-
|
|
|
VkImageCreateInfo imageInfo{};
|
|
|
imageInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
|
|
|
imageInfo.imageType = VK_IMAGE_TYPE_2D;
|
|
|
- imageInfo.format = depthAttachment;
|
|
|
+ imageInfo.format = depthStencilFormat;
|
|
|
imageInfo.extent.width = swapChainExtent.width;
|
|
|
imageInfo.extent.height = swapChainExtent.height;
|
|
|
imageInfo.extent.depth = 1;
|
|
@@ -2918,7 +2916,7 @@ void Graphics::createDepthResources()
|
|
|
imageViewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
|
|
imageViewInfo.image = depthImage;
|
|
|
imageViewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
|
|
- imageViewInfo.format = depthAttachment;
|
|
|
+ imageViewInfo.format = depthStencilFormat;
|
|
|
imageViewInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
|
|
imageViewInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
|
|
imageViewInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY;
|