Fix some Vulkan errors

Depth buffers were not tagged as output on passes writing on it
Handle holes in clear values
This commit is contained in:
SirLynix
2023-10-08 13:47:15 +02:00
parent 078542e44b
commit 98fe974fc8
6 changed files with 42 additions and 24 deletions

View File

@@ -285,7 +285,7 @@ namespace Nz
std::array enabledFeatures = {
//VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT,
//VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT,
VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT,
//VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT,
VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT
};

View File

@@ -36,23 +36,28 @@ namespace Nz
std::size_t attachmentCount = vkRenderPass.GetAttachmentCount();
StackArray<VkClearValue> vkClearValues = NazaraStackArray(VkClearValue, attachmentCount);
for (std::size_t i = 0; i < attachmentCount; ++i)
{
const auto& values = (i < clearValueCount) ? clearValues[i] : CommandBufferBuilder::ClearValues{};
auto& vkValues = vkClearValues[i];
StackArray<VkClearValue> vkClearValues;
if (PixelFormatInfo::GetContent(vkRenderPass.GetAttachment(i).format) == PixelFormatContent::ColorRGBA)
if (clearValueCount > 0)
{
vkClearValues = NazaraStackArray(VkClearValue, attachmentCount);
for (std::size_t i = 0; i < attachmentCount; ++i)
{
vkValues.color.float32[0] = values.color.r;
vkValues.color.float32[1] = values.color.g;
vkValues.color.float32[2] = values.color.b;
vkValues.color.float32[3] = values.color.a;
}
else
{
vkValues.depthStencil.depth = values.depth;
vkValues.depthStencil.stencil = values.stencil;
const auto& values = (i < clearValueCount) ? clearValues[i] : CommandBufferBuilder::ClearValues{};
auto& vkValues = vkClearValues[i];
if (PixelFormatInfo::GetContent(vkRenderPass.GetAttachment(i).format) == PixelFormatContent::ColorRGBA)
{
vkValues.color.float32[0] = values.color.r;
vkValues.color.float32[1] = values.color.g;
vkValues.color.float32[2] = values.color.b;
vkValues.color.float32[3] = values.color.a;
}
else
{
vkValues.depthStencil.depth = values.depth;
vkValues.depthStencil.stencil = values.stencil;
}
}
}