vk oit: limit drawer swap chain to 2, same as non-oit

Fixes flashing during partial redraws (south park rally)
This commit is contained in:
Flyinghead 2022-09-14 17:48:57 +02:00
parent 73adbc660b
commit 4a4fa7792f
2 changed files with 5 additions and 4 deletions

View File

@ -483,7 +483,7 @@ void OITScreenDrawer::MakeFramebuffers(const vk::Extent2D& viewport)
finalColorAttachments.clear();
transitionNeeded.clear();
clearNeeded.clear();
while (finalColorAttachments.size() < GetContext()->GetSwapChainSize())
while (finalColorAttachments.size() < GetSwapChainSize())
{
finalColorAttachments.push_back(std::unique_ptr<FramebufferAttachment>(
new FramebufferAttachment(GetContext()->GetPhysicalDevice(), GetContext()->GetDevice())));
@ -588,7 +588,7 @@ vk::CommandBuffer OITTextureDrawer::NewFrame()
depthAttachments[0]->GetImageView(),
depthAttachments[1]->GetImageView(),
};
framebuffers.resize(GetContext()->GetSwapChainSize());
framebuffers.resize(GetSwapChainSize());
framebuffers[GetCurrentImage()] = device.createFramebufferUnique(vk::FramebufferCreateInfo(vk::FramebufferCreateFlags(),
rttPipelineManager->GetRenderPass(true, true), ARRAY_SIZE(imageViews), imageViews, widthPow2, heightPow2, 1));

View File

@ -45,6 +45,7 @@ public:
virtual void EndFrame() { renderPass++; };
protected:
u32 GetSwapChainSize() { return 2; }
void Init(SamplerManager *samplerManager, OITPipelineManager *pipelineManager, OITBuffers *oitBuffers)
{
this->pipelineManager = pipelineManager;
@ -76,13 +77,13 @@ protected:
void NewImage()
{
descriptorSets.nextFrame();
imageIndex = (imageIndex + 1) % GetContext()->GetSwapChainSize();
imageIndex = (imageIndex + 1) % GetSwapChainSize();
renderPass = 0;
}
BufferData* GetMainBuffer(u32 size)
{
u32 bufferIndex = imageIndex + renderPass * GetContext()->GetSwapChainSize();
u32 bufferIndex = imageIndex + renderPass * GetSwapChainSize();
while (mainBuffers.size() <= bufferIndex)
{
mainBuffers.push_back(std::unique_ptr<BufferData>(new BufferData(std::max(512 * 1024u, size),