* @brief Sascha Willems base class for use in his ported samples into the framework * * See vkb::VulkanSample for documentation */
| 102 | * See vkb::VulkanSample for documentation |
| 103 | */ |
| 104 | class ApiVulkanSample : public vkb::VulkanSampleC |
| 105 | { |
| 106 | public: |
| 107 | ApiVulkanSample() = default; |
| 108 | |
| 109 | virtual ~ApiVulkanSample(); |
| 110 | |
| 111 | virtual bool prepare(const vkb::ApplicationOptions &options) override; |
| 112 | |
| 113 | virtual void input_event(const vkb::InputEvent &input_event) override; |
| 114 | |
| 115 | virtual void update(float delta_time) override; |
| 116 | |
| 117 | virtual bool resize(const uint32_t width, const uint32_t height) override; |
| 118 | |
| 119 | virtual void render(float delta_time) = 0; |
| 120 | |
| 121 | enum RenderPassCreateFlags |
| 122 | { |
| 123 | ColorAttachmentLoad = 0x00000001 |
| 124 | }; |
| 125 | |
| 126 | protected: |
| 127 | /// Stores the swapchain image buffers |
| 128 | std::vector<SwapchainBuffer> swapchain_buffers; |
| 129 | |
| 130 | virtual void create_render_context() override; |
| 131 | |
| 132 | // Handle to the device graphics queue that command buffers are submitted to |
| 133 | VkQueue queue; |
| 134 | |
| 135 | // Depth buffer format (selected during Vulkan initialization) |
| 136 | VkFormat depth_format; |
| 137 | |
| 138 | // Command buffer pool |
| 139 | VkCommandPool cmd_pool; |
| 140 | |
| 141 | /** @brief Pipeline stages used to wait at for graphics queue submissions */ |
| 142 | VkPipelineStageFlags submit_pipeline_stages = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; |
| 143 | |
| 144 | // Contains command buffers and semaphores to be presented to the queue |
| 145 | VkSubmitInfo submit_info; |
| 146 | |
| 147 | // Command buffers used for rendering |
| 148 | std::vector<VkCommandBuffer> draw_cmd_buffers; |
| 149 | |
| 150 | // Global render pass for frame buffer writes |
| 151 | VkRenderPass render_pass = VK_NULL_HANDLE; |
| 152 | |
| 153 | // Returns true if using dynamic rendering |
| 154 | bool uses_dynamic_rendering() const |
| 155 | { |
| 156 | return render_pass == VK_NULL_HANDLE; |
| 157 | } |
| 158 | |
| 159 | // List of available frame buffers (same as number of swap chain images) |
| 160 | std::vector<VkFramebuffer> framebuffers; |
| 161 |
nothing calls this directly
no outgoing calls
no test coverage detected