Merge pull request #7626 from weihuoya/vulkan-oom
Always clean cache on render swap
This commit is contained in:
commit
0da5929226
|
@ -1528,6 +1528,13 @@ void Renderer::SwapImpl(AbstractTexture* texture, const EFBRectangle& xfb_region
|
||||||
ClearEFBCache();
|
ClearEFBCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Renderer::Flush()
|
||||||
|
{
|
||||||
|
// ensure all commands are sent to the GPU.
|
||||||
|
// Otherwise the driver could batch several frames togehter.
|
||||||
|
glFlush();
|
||||||
|
}
|
||||||
|
|
||||||
void Renderer::CheckForSurfaceChange()
|
void Renderer::CheckForSurfaceChange()
|
||||||
{
|
{
|
||||||
if (!m_surface_changed.TestAndClear())
|
if (!m_surface_changed.TestAndClear())
|
||||||
|
|
|
@ -133,6 +133,7 @@ public:
|
||||||
TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) override;
|
TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) override;
|
||||||
|
|
||||||
void SwapImpl(AbstractTexture* texture, const EFBRectangle& rc, u64 ticks) override;
|
void SwapImpl(AbstractTexture* texture, const EFBRectangle& rc, u64 ticks) override;
|
||||||
|
void Flush() override;
|
||||||
|
|
||||||
void ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable,
|
void ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable,
|
||||||
u32 color, u32 z) override;
|
u32 color, u32 z) override;
|
||||||
|
|
|
@ -640,6 +640,11 @@ void Renderer::SwapImpl(AbstractTexture* texture, const EFBRectangle& xfb_region
|
||||||
TextureCache::GetInstance()->Cleanup(frameCount);
|
TextureCache::GetInstance()->Cleanup(frameCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Renderer::Flush()
|
||||||
|
{
|
||||||
|
Util::ExecuteCurrentCommandsAndRestoreState(true, false);
|
||||||
|
}
|
||||||
|
|
||||||
void Renderer::DrawScreen(VKTexture* xfb_texture, const EFBRectangle& xfb_region)
|
void Renderer::DrawScreen(VKTexture* xfb_texture, const EFBRectangle& xfb_region)
|
||||||
{
|
{
|
||||||
VkResult res;
|
VkResult res;
|
||||||
|
|
|
@ -63,6 +63,7 @@ public:
|
||||||
TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) override;
|
TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) override;
|
||||||
|
|
||||||
void SwapImpl(AbstractTexture* texture, const EFBRectangle& rc, u64 ticks) override;
|
void SwapImpl(AbstractTexture* texture, const EFBRectangle& rc, u64 ticks) override;
|
||||||
|
void Flush() override;
|
||||||
|
|
||||||
void ClearScreen(const EFBRectangle& rc, bool color_enable, bool alpha_enable, bool z_enable,
|
void ClearScreen(const EFBRectangle& rc, bool color_enable, bool alpha_enable, bool z_enable,
|
||||||
u32 color, u32 z) override;
|
u32 color, u32 z) override;
|
||||||
|
|
|
@ -747,11 +747,19 @@ void Renderer::Swap(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, const
|
||||||
|
|
||||||
Core::Callback_VideoCopiedToXFB(true);
|
Core::Callback_VideoCopiedToXFB(true);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Flush();
|
||||||
|
}
|
||||||
|
|
||||||
// Update our last xfb values
|
// Update our last xfb values
|
||||||
m_last_xfb_width = (fbStride < 1 || fbStride > MAX_XFB_WIDTH) ? MAX_XFB_WIDTH : fbStride;
|
m_last_xfb_width = (fbStride < 1 || fbStride > MAX_XFB_WIDTH) ? MAX_XFB_WIDTH : fbStride;
|
||||||
m_last_xfb_height = (fbHeight < 1 || fbHeight > MAX_XFB_HEIGHT) ? MAX_XFB_HEIGHT : fbHeight;
|
m_last_xfb_height = (fbHeight < 1 || fbHeight > MAX_XFB_HEIGHT) ? MAX_XFB_HEIGHT : fbHeight;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Flush();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Renderer::IsFrameDumping()
|
bool Renderer::IsFrameDumping()
|
||||||
|
|
|
@ -184,6 +184,7 @@ public:
|
||||||
void Swap(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, const EFBRectangle& rc,
|
void Swap(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, const EFBRectangle& rc,
|
||||||
u64 ticks);
|
u64 ticks);
|
||||||
virtual void SwapImpl(AbstractTexture* texture, const EFBRectangle& rc, u64 ticks) = 0;
|
virtual void SwapImpl(AbstractTexture* texture, const EFBRectangle& rc, u64 ticks) = 0;
|
||||||
|
virtual void Flush() {}
|
||||||
|
|
||||||
PEControl::PixelFormat GetPrevPixelFormat() const { return m_prev_efb_format; }
|
PEControl::PixelFormat GetPrevPixelFormat() const { return m_prev_efb_format; }
|
||||||
void StorePixelFormat(PEControl::PixelFormat new_format) { m_prev_efb_format = new_format; }
|
void StorePixelFormat(PEControl::PixelFormat new_format) { m_prev_efb_format = new_format; }
|
||||||
|
|
Loading…
Reference in New Issue