diff --git a/include/vkRenderMessages.h b/include/vkRenderMessages.h index 7d07e9a3f..07d31458f 100644 --- a/include/vkRenderMessages.h +++ b/include/vkRenderMessages.h @@ -3,5 +3,8 @@ enum VulkanRendererMessage : uint32_t { /** Export, if ready */ - exportRender = 0 + exportRender = 0, + + /** Update the renderer */ + updateRenderer = 1 }; \ No newline at end of file diff --git a/include/vkrender.h b/include/vkrender.h index a10bde18c..b5701ddcd 100644 --- a/include/vkrender.h +++ b/include/vkrender.h @@ -947,6 +947,7 @@ class AsyVkRender static void exportHandler(int=0); void Export(int imageIndex); bool readyForExport=false; + bool readyForUpdate=false; void quit(); double spinStep(); diff --git a/src/vkrender.cc b/src/vkrender.cc index 328a88b25..8619a5e32 100644 --- a/src/vkrender.cc +++ b/src/vkrender.cc @@ -360,7 +360,7 @@ void AsyVkRender::framebufferResizeCallback(GLFWwindow* window, int width, int h static bool initialize=true; if(initialize) { initialize=false; - Signal(SIGUSR1,updateHandler); + app->readyForUpdate=true; } } } @@ -646,11 +646,8 @@ void AsyVkRender::vkrender(const string& prefix, const picture* pic, const strin #ifdef HAVE_PTHREAD if(vkthread && initializedView) { if(View) { -#ifdef __MSDOS__ // Signals are unreliable in MSWindows - vkupdate=true; -#else - pthread_kill(mainthread,SIGUSR1); -#endif + // called from asymain thread, main thread handles vulkan rendering + messageQueue.enqueue(updateRenderer); } else readyAfterExport=queueExport=true; return; } @@ -3893,6 +3890,13 @@ void AsyVkRender::processMessages(VulkanRendererMessage const& msg) } } break; + case updateRenderer: { + if (readyForUpdate) + { + readyForUpdate=false; + updateHandler(0); + } + } default: break; }