25#ifndef TGUI_BACKEND_RENDER_TARGET_VULKAN_HPP
26#define TGUI_BACKEND_RENDER_TARGET_VULKAN_HPP
28#include <TGUI/Backend/Renderer/BackendRenderTarget.hpp>
29#include <TGUI/Backend/Renderer/Vulkan/BackendTextureVulkan.hpp>
31#include <vulkan/vulkan.h>
79 void setView(FloatRect view, FloatRect viewport, Vector2f targetSize)
override;
84 void drawGui(
const std::shared_ptr<RootContainer>&)
override
86 TGUI_ASSERT(
false,
"The Vulkan backend requires that you pass a VkCommandBuffer to the draw function");
87 throw Exception(
"The Vulkan backend requires that you pass a VkCommandBuffer to the draw function");
109 VkFormat colorFormat,
110 std::uint32_t maxFramesInFlight,
111 std::uint32_t subpass = 0,
112 VkSampleCountFlagBits samples = VK_SAMPLE_COUNT_1_BIT);
135 std::uint32_t maxFramesInFlight,
136 VkFormat depthFormat = VK_FORMAT_UNDEFINED,
137 VkFormat stencilFormat = VK_FORMAT_UNDEFINED,
138 VkSampleCountFlagBits samples = VK_SAMPLE_COUNT_1_BIT);
156 bool drawGui(
const std::shared_ptr<RootContainer>& root, VkCommandBuffer cmdBuffer);
170 std::size_t vertexCount,
171 const unsigned int* indices,
172 std::size_t indexCount,
173 const std::shared_ptr<BackendTexture>& texture)
override;
191 void retirePipeline();
196 void setMaxFramesInFlight(std::uint32_t maxFramesInFlight);
201 void destroyFrameResources();
208 std::size_t indexCount;
209 std::shared_ptr<BackendTextureVulkan::ImageResources> imageResources;
217 VkBuffer buffer = VK_NULL_HANDLE;
218 VkDeviceMemory memory = VK_NULL_HANDLE;
219 VkDeviceSize bufferSize = 0;
220 void* mappedMemory =
nullptr;
221 std::vector<DrawCommand> drawCommands;
222 std::vector<VkPipeline> retiredPipelines;
225 std::shared_ptr<BackendRendererVulkan> m_renderer;
226 std::unique_ptr<BackendTextureVulkan> m_emptyTexture;
230 VkPipeline m_pipeline = VK_NULL_HANDLE;
231 VkRenderPass m_renderPass = VK_NULL_HANDLE;
232 std::uint32_t m_subpass = 0;
233 VkFormat m_colorFormat = VK_FORMAT_UNDEFINED;
234 VkFormat m_depthFormat = VK_FORMAT_UNDEFINED;
235 VkFormat m_stencilFormat = VK_FORMAT_UNDEFINED;
236 VkSampleCountFlagBits m_samples = VK_SAMPLE_COUNT_1_BIT;
238 std::vector<FrameResources> m_frames;
239 std::size_t m_currentFrame = 0;
242 std::vector<Vertex> m_vertices;
243 std::vector<unsigned int> m_indices;
244 VkRect2D m_clipRect = {};
void drawGui(const std::shared_ptr< RootContainer > &) override
This function is not used by this backend, use drawGui(root, VkCommandBuffer) instead.
Definition BackendRenderTargetVulkan.hpp:84
BackendRenderTargetVulkan(std::shared_ptr< BackendRendererVulkan > renderer)
Constructor.
void setRenderPass(VkRenderPass renderPass, VkFormat colorFormat, std::uint32_t maxFramesInFlight, std::uint32_t subpass=0, VkSampleCountFlagBits samples=VK_SAMPLE_COUNT_1_BIT)
Informs the render target about the render pass in which the gui will be drawn.
void setView(FloatRect view, FloatRect viewport, Vector2f targetSize) override
Informs the render target about which part of the window is used for rendering.
void drawVertexArray(const RenderStates &states, const Vertex *vertices, std::size_t vertexCount, const unsigned int *indices, std::size_t indexCount, const std::shared_ptr< BackendTexture > &texture) override
Draws a vertex array. This is called by the other draw functions.
~BackendRenderTargetVulkan() override
Destructor.
void updateClipping(FloatRect clipRect, FloatRect clipViewport) override
Called from addClippingLayer and removeClippingLayer to apply the clipping.
void setDynamicRenderingFormats(VkFormat colorFormat, std::uint32_t maxFramesInFlight, VkFormat depthFormat=VK_FORMAT_UNDEFINED, VkFormat stencilFormat=VK_FORMAT_UNDEFINED, VkSampleCountFlagBits samples=VK_SAMPLE_COUNT_1_BIT)
Informs the render target that the gui will be drawn with dynamic rendering (vkCmdBeginRendering).
void clearScreen() override
This function isn't used by this backend.
void setClearColor(const Color &color) override
This function isn't used by this backend.
bool drawGui(const std::shared_ptr< RootContainer > &root, VkCommandBuffer cmdBuffer)
Draws the gui and all of its widgets.
Backend renderer that uses Vulkan.
Definition BackendRendererVulkan.hpp:72
Wrapper for colors.
Definition Color.hpp:63
Definition Exception.hpp:46
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:37
Definition BackendRenderTargetVulkan.hpp:207
Definition BackendRenderTargetVulkan.hpp:216
States used for drawing.
Definition RenderStates.hpp:38