When no pipelines are used in a pass, CmdClearAttachments has no effect.
This is because RenderPassCache::CreateRenderPass will flag color attachment as VK_ATTACHMENT_UNUSED when no pipelines are used.
One possible solution (may not be the best)
- Add code to CmdClearAttachments, to signal use of output attachments
StreamEncoder::CmdClearAttachments
// Add input attachment index to current subpass.
auto& subpass = m_renderPasses.back().subpasses.back();
for(auto index = 0U; index < attachmentCount; ++index)
{ subpass.outputAttachments.emplace(pAttachments[index].colorAttachment); }
- This somewhat works, but because render passes are cached and hashed, empty passes and empty passes with clear get the same hash.
So we'd need to update the hash
static RenderPassHash GetHash(const RenderPassDesc* pDesc)
struct SubpassDescriptionBitField
{
uint8_t pipelineCount : 8;
uint8_t outputAttachments : 8; // fix for CmdClearAttachments
};
// SubpassDescriptionBitField
subpassDescriptions[i].pipelineCount = static_cast<uint8_t>(pDesc->subpasses[i].pipelineBindings.size());
subpassDescriptions[i].outputAttachments = static_cast<uint8_t>(pDesc->subpasses[i].outputAttachments.size()); // fix for CmdClearAttachments
It is undesirable to increase the size and complexity of the hash, so any better solution is welcome.
When no pipelines are used in a pass,
CmdClearAttachmentshas no effect.This is because
RenderPassCache::CreateRenderPasswill flag color attachment asVK_ATTACHMENT_UNUSEDwhen no pipelines are used.One possible solution (may not be the best)
So we'd need to update the hash
It is undesirable to increase the size and complexity of the hash, so any better solution is welcome.