From 3562d3b57a90d627639cdbcc6d6a0740e5efcb4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Mora?= Date: Wed, 16 Jan 2019 23:51:48 +0100 Subject: [PATCH] Draw Fence is not always mendatory --- .../org/sheepy/vulkan/sand/VSandMainLoop.java | 17 ++++++++--------- .../sand/buffer/ModificationsManager.java | 3 +-- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/org.sheepy.vulkan.sand/src/main/java/org/sheepy/vulkan/sand/VSandMainLoop.java b/org.sheepy.vulkan.sand/src/main/java/org/sheepy/vulkan/sand/VSandMainLoop.java index f1366fd8..07640815 100644 --- a/org.sheepy.vulkan.sand/src/main/java/org/sheepy/vulkan/sand/VSandMainLoop.java +++ b/org.sheepy.vulkan.sand/src/main/java/org/sheepy/vulkan/sand/VSandMainLoop.java @@ -33,6 +33,8 @@ public class VSandMainLoop implements IMainLoop { + private static final long FENCE_TIMEOUT_NS = (long) (500 * 1e6); + private IVulkanEngineAdapter engineAdapter; private DrawManager mainDrawManager; @@ -126,8 +128,6 @@ else if (process instanceof GraphicProcess) } } - private static final long FENCE_TIMEOUT_NS = (long) (500 * 1e6); - @Override public void step(Application _application) { @@ -141,11 +141,6 @@ public void step(Application _application) boardProcessAdapter.prepare(); boardProcessAdapter.execute(drawFence); - if (drawFence.waitForSignal(FENCE_TIMEOUT_NS) == false) - { - System.err.println("Frame too long"); - } - if (application.isNextMode() == true) { application.setNextMode(false); @@ -154,7 +149,7 @@ public void step(Application _application) renderProcessAdapter.prepare(); renderProcessAdapter.execute(); - + vsyncGuard.step(); } @@ -175,7 +170,11 @@ private void updateDrawManager() { drawPipeline.setEnabled(true); } - modificationsManager.update(drawFence); + if (drawFence.waitForSignal(FENCE_TIMEOUT_NS) == false) + { + System.err.println("Frame too long"); + } + modificationsManager.update(); } // disable drawManager else if (drawPipeline.isEnabled()) diff --git a/org.sheepy.vulkan.sand/src/main/java/org/sheepy/vulkan/sand/buffer/ModificationsManager.java b/org.sheepy.vulkan.sand/src/main/java/org/sheepy/vulkan/sand/buffer/ModificationsManager.java index 0147ee82..14cfe867 100644 --- a/org.sheepy.vulkan.sand/src/main/java/org/sheepy/vulkan/sand/buffer/ModificationsManager.java +++ b/org.sheepy.vulkan.sand/src/main/java/org/sheepy/vulkan/sand/buffer/ModificationsManager.java @@ -6,7 +6,6 @@ import org.lwjgl.system.MemoryUtil; import org.sheepy.common.api.types.SVector2i; -import org.sheepy.vulkan.api.concurrent.IFence; import org.sheepy.vulkan.model.enumeration.EBufferUsage; import org.sheepy.vulkan.model.enumeration.EDescriptorType; import org.sheepy.vulkan.model.enumeration.EShaderStage; @@ -60,7 +59,7 @@ public void pushModification(DrawData data) oldY = y; } - public void update(IFence waitFence) + public void update() { copyBuffer.clear(); BoardModification modif = modificationQueue.pop();