7#include "gfx_pipeline_vulkan_intf.hpp"
8#include "../container/container.hpp"
9#include "../geometry/geometry.hpp"
11#include "../image/image.hpp"
12#include "../macros.hpp"
13#include <vulkan/vulkan.hpp>
14#include <vma/vk_mem_alloc.h>
17hi_export_module(hikogui.GFX : gfx_pipeline_box_intf);
19hi_export
namespace hi {
inline namespace v1 {
68 float line_width) noexcept :
75 line_width(line_width)
79 static vk::VertexInputBindingDescription inputBindingDescription()
81 return {0,
sizeof(
vertex), vk::VertexInputRate::eVertex};
87 {0, 0, vk::Format::eR32G32B32A32Sfloat, offsetof(vertex,
position)},
90 {3, 0, vk::Format::eR32G32B32A32Sfloat, offsetof(vertex,
corner_radii)},
91 {4, 0, vk::Format::eR16G16B16A16Sfloat, offsetof(vertex,
fill_color)},
92 {5, 0, vk::Format::eR16G16B16A16Sfloat, offsetof(vertex,
line_color)},
93 {6, 0, vk::Format::eR32Sfloat, offsetof(vertex, line_width)},
99 sfloat_rg32 windowExtent =
extent2{0.0, 0.0};
100 sfloat_rg32 viewportScale =
scale2{0.0, 0.0};
104 return {{vk::ShaderStageFlagBits::eVertex | vk::ShaderStageFlagBits::eFragment, 0,
sizeof(
push_constants)}};
109 gfx_device
const& device;
111 vk::ShaderModule vertexShaderModule;
112 vk::ShaderModule fragmentShaderModule;
126 void destroy(gfx_device
const *vulkanDevice);
128 void drawInCommandBuffer(vk::CommandBuffer
const& commandBuffer);
130 static void place_vertices(
131 vector_span<vertex>& vertices,
141 void teardownShaders(gfx_device
const *vulkanDevice);
144 vector_span<vertex> vertexBufferData;
154 void draw_in_command_buffer(vk::CommandBuffer commandBuffer,
draw_context const& context)
override;
157 push_constants pushConstants;
159 vk::Buffer vertexBuffer;
160 VmaAllocation vertexBufferAllocation;
165 [[nodiscard]]
size_t getDescriptorSetVersion()
const override;
167 [[nodiscard]] vk::VertexInputBindingDescription createVertexInputBindingDescription()
const override;
171 void build_vertex_buffers()
override;
172 void teardown_vertex_buffers()
override;
The HikoGUI namespace.
Definition array_generic.hpp:20
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
A color for each corner of a quad.
Definition quad_color.hpp:22
Class which represents an axis-aligned rectangle.
Definition aarectangle.hpp:33
The 4 radii of the corners of a quad or rectangle.
Definition corner_radii.hpp:26
A high-level geometric extent.
Definition extent2.hpp:32
Draw context for drawing using the HikoGUI shaders.
Definition draw_context_intf.hpp:209
Definition gfx_pipeline_box_vulkan_intf.hpp:23
Definition gfx_pipeline_box_vulkan_intf.hpp:28
sfloat_rgba16 line_color
border color of the box.
Definition gfx_pipeline_box_vulkan_intf.hpp:57
sfloat_rgba32 corner_radii
Shape of each corner, negative values are cut corners, positive values are rounded corners.
Definition gfx_pipeline_box_vulkan_intf.hpp:49
sfloat_rgba32 corner_coordinate
Double 2D coordinates inside the quad, used to determine the distance from the sides and corner insid...
Definition gfx_pipeline_box_vulkan_intf.hpp:45
sfloat_rgba16 fill_color
background color of the box.
Definition gfx_pipeline_box_vulkan_intf.hpp:53
sfloat_rgba32 position
The pixel-coordinates where the origin is located relative to the bottom-left corner of the window.
Definition gfx_pipeline_box_vulkan_intf.hpp:31
sfloat_rgba32 clipping_rectangle
The position in pixels of the clipping rectangle relative to the bottom-left corner of the window,...
Definition gfx_pipeline_box_vulkan_intf.hpp:36
Definition gfx_pipeline_box_vulkan_intf.hpp:98
Definition gfx_pipeline_box_vulkan_intf.hpp:108
void destroy(gfx_device const *vulkanDevice)
Definition gfx_pipeline_box_vulkan_impl.hpp:120