- flush the commands for every 1000th Apply call

This commit is contained in:
Magnus Norddahl 2019-04-19 21:08:15 +02:00
parent 8fadf3d9bd
commit 3957a19bd0
2 changed files with 11 additions and 0 deletions

View file

@ -160,6 +160,14 @@ void VkRenderState::EnableLineSmooth(bool on)
void VkRenderState::Apply(int dt)
{
mApplyCount++;
if (mApplyCount == 1000)
{
EndRenderPass();
GetVulkanFrameBuffer()->FlushCommands();
mApplyCount = 0;
}
ApplyRenderPass(dt);
ApplyScissor();
ApplyViewport();
@ -548,6 +556,7 @@ void VkRenderState::Bind(int bindingpoint, uint32_t offset)
void VkRenderState::BeginFrame()
{
mMaterial.Reset();
mApplyCount = 0;
}
void VkRenderState::EndRenderPass()

View file

@ -113,6 +113,8 @@ protected:
bool mLastModelMatrixEnabled = true;
bool mLastTextureMatrixEnabled = true;
int mApplyCount = 0;
struct RenderTarget
{
VulkanImageView *View = nullptr;