mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 21:11:39 +00:00
- fall back to VK_FORMAT_D32_SFLOAT_S8_UINT if VK_FORMAT_D24_UNORM_S8_UINT is not supported
This commit is contained in:
parent
0a6d77a861
commit
2532e4bba6
3 changed files with 10 additions and 7 deletions
|
@ -40,14 +40,15 @@ void VkRenderPassManager::BeginFrame()
|
|||
builder.setUsage(VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT);
|
||||
SceneColor = builder.create(fb->device);
|
||||
|
||||
builder.setFormat(VK_FORMAT_D24_UNORM_S8_UINT);
|
||||
builder.setFormat(SceneDepthStencilFormat);
|
||||
builder.setUsage(VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT);
|
||||
if (!builder.isFormatSupported(fb->device))
|
||||
{
|
||||
builder.setLinearTiling();
|
||||
SceneDepthStencilFormat = VK_FORMAT_D32_SFLOAT_S8_UINT;
|
||||
builder.setFormat(SceneDepthStencilFormat);
|
||||
if (!builder.isFormatSupported(fb->device))
|
||||
{
|
||||
I_FatalError("This device does not support VK_FORMAT_D24_UNORM_S8_UINT.");
|
||||
I_FatalError("This device does not support any of the required depth stencil image formats.");
|
||||
}
|
||||
}
|
||||
SceneDepthStencil = builder.create(fb->device);
|
||||
|
@ -180,7 +181,7 @@ void VkRenderPassSetup::CreateRenderPass(const VkRenderPassKey &key)
|
|||
RenderPassBuilder builder;
|
||||
builder.addRgba16fAttachment(false, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL);
|
||||
if (key.DepthTest || key.DepthWrite || key.StencilTest)
|
||||
builder.addDepthStencilAttachment(false, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL);
|
||||
builder.addDepthStencilAttachment(false, GetVulkanFrameBuffer()->GetRenderPassManager()->SceneDepthStencilFormat, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL);
|
||||
builder.addSubpass();
|
||||
builder.addSubpassColorAttachmentRef(0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL);
|
||||
if (key.DepthTest || key.DepthWrite || key.StencilTest)
|
||||
|
|
|
@ -80,6 +80,8 @@ public:
|
|||
std::unique_ptr<VulkanImageView> SceneDepthStencilView;
|
||||
std::unique_ptr<VulkanImageView> SceneDepthView;
|
||||
|
||||
VkFormat SceneDepthStencilFormat = VK_FORMAT_D24_UNORM_S8_UINT;
|
||||
|
||||
std::unique_ptr<VulkanDescriptorSet> DynamicSet;
|
||||
|
||||
std::vector<VkVertexFormat> VertexFormats;
|
||||
|
|
|
@ -254,7 +254,7 @@ public:
|
|||
|
||||
void addRgba16fAttachment(bool clear, VkImageLayout layout) { addColorAttachment(clear, VK_FORMAT_R16G16B16A16_SFLOAT, layout); }
|
||||
void addColorAttachment(bool clear, VkFormat format, VkImageLayout layout);
|
||||
void addDepthStencilAttachment(bool clear, VkImageLayout layout);
|
||||
void addDepthStencilAttachment(bool clear, VkFormat format, VkImageLayout layout);
|
||||
|
||||
void addExternalSubpassDependency(VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask);
|
||||
|
||||
|
@ -1000,10 +1000,10 @@ inline void RenderPassBuilder::addColorAttachment(bool clear, VkFormat format, V
|
|||
renderPassInfo.attachmentCount = (uint32_t)attachments.size();
|
||||
}
|
||||
|
||||
inline void RenderPassBuilder::addDepthStencilAttachment(bool clear, VkImageLayout layout)
|
||||
inline void RenderPassBuilder::addDepthStencilAttachment(bool clear, VkFormat format, VkImageLayout layout)
|
||||
{
|
||||
VkAttachmentDescription depthAttachment = {};
|
||||
depthAttachment.format = VK_FORMAT_D24_UNORM_S8_UINT;
|
||||
depthAttachment.format = format;
|
||||
depthAttachment.samples = VK_SAMPLE_COUNT_1_BIT;
|
||||
depthAttachment.loadOp = clear ? VK_ATTACHMENT_LOAD_OP_CLEAR : VK_ATTACHMENT_LOAD_OP_LOAD;
|
||||
depthAttachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE/*VK_ATTACHMENT_STORE_OP_DONT_CARE*/;
|
||||
|
|
Loading…
Reference in a new issue