15 #include <vsg/app/CompileManager.h>
16 #include <vsg/app/Presentation.h>
17 #include <vsg/app/RecordAndSubmitTask.h>
18 #include <vsg/app/UpdateOperations.h>
19 #include <vsg/app/Window.h>
20 #include <vsg/threading/Barrier.h>
21 #include <vsg/threading/FrameBlock.h>
41 Windows& windows() {
return _windows; }
42 const Windows& windows()
const {
return _windows; }
44 clock::time_point& start_point() {
return _start_point; }
45 const clock::time_point& start_point()
const {
return _start_point; }
47 FrameStamp* getFrameStamp() {
return _frameStamp; }
48 const FrameStamp* getFrameStamp()
const {
return _frameStamp; }
57 virtual bool pollEvents(
bool discardPreviousEvents =
true);
63 const UIEvents&
getEvents()
const {
return _events; }
68 void addEventHandlers(EventHandlers&& eventHandlers) { _eventHandlers.splice(_eventHandlers.end(), eventHandlers); }
82 updateOperations->add(op, runBehavior);
98 virtual bool acquireNextFrame();
102 virtual VkResult
waitForFences(
size_t relativeFrameIndex, uint64_t timeout);
105 RecordAndSubmitTasks recordAndSubmitTasks;
108 using Presentations = std::vector<ref_ptr<Presentation>>;
109 Presentations presentations;
115 std::list<std::thread> threads;
117 void setupThreading();
118 void stopThreading();
120 virtual void update();
122 virtual void recordAndSubmit();
124 virtual void present();
138 clock::time_point _start_point;
140 EventHandlers _eventHandlers;
142 bool _threading =
false;
RunBehavior
specification of whether update operation should be invoked once or on all frames
Definition: UpdateOperations.h:31
virtual void deviceWaitIdle() const
Call vkDeviceWaitIdle on all the devices associated with this Viewer.
const EventHandlers & getEventHandlers() const
get the const list of EventHandlers
Definition: Viewer.h:74
virtual void handleEvents()
pass the Events into the any register EventHandlers
virtual VkResult waitForFences(size_t relativeFrameIndex, uint64_t timeout)
ref_ptr< UpdateOperations > updateOperations
thread safe container for update operations
Definition: Viewer.h:77
virtual void assignRecordAndSubmitTaskAndPresentation(CommandGraphs commandGraphs)
create a RecordAndSubmitTask configured to manage specified commandGraphs and assign it to the viewer...
void addUpdateOperation(ref_ptr< Operation > op, UpdateOperations::RunBehavior runBehavior=UpdateOperations::ONE_TIME)
add an update operation
Definition: Viewer.h:80
void addEventHandler(ref_ptr< Visitor > eventHandler)
add event handler
Definition: Viewer.h:66
bool active() const
return true if viewer is valid and active
virtual bool advanceToNextFrame()
const UIEvents & getEvents() const
get the const current set of Events that are filled in by prior calls to pollEvents
Definition: Viewer.h:63
virtual bool pollEvents(bool discardPreviousEvents=true)
poll the events for all attached windows, return true if new events are available
virtual void close()
schedule closure of the viewer and associated windows, after a call to Viewer::close() the Viewer::ac...
UIEvents & getEvents()
get the current set of Events that are filled in by prior calls to pollEvents
Definition: Viewer.h:60
EventHandlers & getEventHandlers()
get the const list of EventHandlers
Definition: Viewer.h:71
virtual void addWindow(ref_ptr< Window > window)
add Window to Viewer
ref_ptr< CompileManager > compileManager
compile manager provides thread safe support for compiling subgraph
Definition: Viewer.h:86
Definition: CompileManager.h:24