vsg  1.1.0
VulkanSceneGraph library
CommandGraph.h
1 #pragma once
2 
3 /* <editor-fold desc="MIT License">
4 
5 Copyright(c) 2018 Robert Osfield
6 
7 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8 
9 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10 
11 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12 
13 </editor-fold> */
14 
15 #include <vsg/app/Camera.h>
16 #include <vsg/app/Window.h>
17 #include <vsg/core/Export.h>
18 #include <vsg/nodes/Bin.h>
19 #include <vsg/nodes/Group.h>
20 #include <vsg/vk/CommandBuffer.h>
21 
22 namespace vsg
23 {
24 
26  class VSG_DECLSPEC CommandGraph : public Inherit<Group, CommandGraph>
27  {
28  public:
29  CommandGraph();
30  CommandGraph(ref_ptr<Device> in_device, int family);
31  explicit CommandGraph(ref_ptr<Window> in_window, ref_ptr<Node> child = {});
32 
33  // Settings, configure at construction time.
34  // When either window or framebuffer is assigned, if framebuffer is set then it takes precedence, if not the appropriate window's framebuffer is used.
35  ref_ptr<Framebuffer> framebuffer;
36  ref_ptr<Window> window;
37  ref_ptr<Device> device;
38 
39  int queueFamily = -1;
40  int presentFamily = -1;
41  uint32_t maxSlot = 2;
42  int submitOrder = 0;
43 
44  inline ref_ptr<RecordTraversal> getOrCreateRecordTraversal()
45  {
46  if (!recordTraversal) recordTraversal = RecordTraversal::create(maxSlot);
47  return recordTraversal;
48  }
49 
50  ref_ptr<RecordTraversal> recordTraversal;
51 
52  virtual VkCommandBufferLevel level() const;
53  virtual void reset();
54  virtual void record(ref_ptr<RecordedCommandBuffers> recordedCommandBuffers, ref_ptr<FrameStamp> frameStamp = {}, ref_ptr<DatabasePager> databasePager = {});
55 
56  protected:
57  virtual ~CommandGraph();
58 
59  CommandBuffers _commandBuffers; // assign one per index? Or just use round robin, each has a CommandPool
60  };
61  VSG_type_name(vsg::CommandGraph);
62 
63  using CommandGraphs = std::vector<ref_ptr<CommandGraph>>;
64 
66  extern VSG_DECLSPEC ref_ptr<CommandGraph> createCommandGraphForView(ref_ptr<Window> window, ref_ptr<Camera> camera, ref_ptr<Node> scenegraph, VkSubpassContents contents = VK_SUBPASS_CONTENTS_INLINE, bool assignHeadlight = true);
67 
68 } // namespace vsg
CommandGraph is a group node that sits at the top of the scene graph and manages the recording of its...
Definition: CommandGraph.h:27
Definition: Inherit.h:28
Definition: ref_ptr.h:22