From da7a4ceb34b11178a4f81045edccd5f12dec6349 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sat, 20 Apr 2019 00:38:38 +0200 Subject: [PATCH] - change drawcalls to measure the Apply time rather than the individual draw calls (Apply is what costs something on vulkan while the draw call queuing is so cheap its an uninteresting thing to measure) --- src/rendering/vulkan/renderer/vk_renderstate.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/rendering/vulkan/renderer/vk_renderstate.cpp b/src/rendering/vulkan/renderer/vk_renderstate.cpp index 3e5ee1b80..e76459c9f 100644 --- a/src/rendering/vulkan/renderer/vk_renderstate.cpp +++ b/src/rendering/vulkan/renderer/vk_renderstate.cpp @@ -38,9 +38,7 @@ void VkRenderState::Draw(int dt, int index, int count, bool apply) if (apply || mNeedApply) Apply(dt); - drawcalls.Clock(); mCommandBuffer->draw(count, 1, index, 0); - drawcalls.Unclock(); } void VkRenderState::DrawIndexed(int dt, int index, int count, bool apply) @@ -48,9 +46,7 @@ void VkRenderState::DrawIndexed(int dt, int index, int count, bool apply) if (apply || mNeedApply) Apply(dt); - drawcalls.Clock(); mCommandBuffer->drawIndexed(count, 1, index, 0, 0); - drawcalls.Unclock(); } bool VkRenderState::SetDepthClamp(bool on) @@ -162,6 +158,8 @@ void VkRenderState::EnableLineSmooth(bool on) void VkRenderState::Apply(int dt) { + drawcalls.Clock(); + mApplyCount++; if (mApplyCount >= vk_submit_size) { @@ -182,6 +180,8 @@ void VkRenderState::Apply(int dt) ApplyDynamicSet(); ApplyMaterial(); mNeedApply = false; + + drawcalls.Unclock(); } void VkRenderState::ApplyDepthBias() @@ -661,9 +661,7 @@ void VkRenderStateMolten::Draw(int dt, int index, int count, bool apply) else ApplyVertexBuffers(); - drawcalls.Clock(); mCommandBuffer->drawIndexed((count - 2) * 3, 1, 0, index, 0); - drawcalls.Unclock(); mIndexBuffer = oldIndexBuffer; } @@ -672,8 +670,6 @@ void VkRenderStateMolten::Draw(int dt, int index, int count, bool apply) if (apply || mNeedApply) Apply(dt); - drawcalls.Clock(); mCommandBuffer->draw(count, 1, index, 0); - drawcalls.Unclock(); } }