7#include "pipeline_image_texture_map.hpp"
8#include "pipeline_image_vertex.hpp"
9#include "paged_image.hpp"
10#include "../utility/module.hpp"
11#include "../image/module.hpp"
12#include "../geometry/module.hpp"
13#include "../vector_span.hpp"
14#include <vma/vk_mem_alloc.h>
15#include <vulkan/vulkan.hpp>
18namespace hi::inline
v1 {
19class gfx_device_vulkan;
21namespace pipeline_image {
24 static constexpr std::size_t atlas_num_pages_per_axis = 8;
25 static constexpr std::size_t atlas_num_pages_per_image = atlas_num_pages_per_axis * atlas_num_pages_per_axis;
26 static constexpr std::size_t atlas_image_axis_size = atlas_num_pages_per_axis * (paged_image::page_size + 2);
27 static constexpr std::size_t atlas_maximum_num_images = 64;
28 static constexpr std::size_t staging_image_width = 1024;
29 static constexpr std::size_t staging_image_height = 1024;
33 vk::ShaderModule vertex_shader_module;
34 vk::ShaderModule fragment_shader_module;
41 vk::Sampler atlas_sampler;
42 vk::DescriptorImageInfo atlas_sampler_descriptor_image_info;
66 void draw_in_command_buffer(vk::CommandBuffer
const &commandBuffer);
88 aarectangle
const &clipping_rectangle,
99 return get_staging_pixmap().subimage(0, 0, width, height);
106 void make_staging_border_transparent(aarectangle border_rectangle)
noexcept;
113 void clear_staging_between_border_and_upload(aarectangle border_rectangle, aarectangle upload_rectangle)
noexcept;
125 void prepare_staging_for_upload(
paged_image const &image)
noexcept;
129 void update_atlas_with_staging_pixmap(
paged_image const &image)
noexcept;
131 void build_shaders();
133 void add_atlas_image();
DOXYGEN BUG.
Definition algorithm.hpp:13
Definition gfx_device_vulkan.hpp:21
This is a image that is uploaded into the texture atlas.
Definition paged_image.hpp:22
Definition pipeline_image_device_shared.hpp:23
void place_vertices(vector_span< vertex > &vertices, aarectangle const &clipping_rectangle, quad const &box, paged_image const &image) noexcept
Place vertices for a single image.
void destroy(gfx_device_vulkan const *vulkanDevice)
void free_pages(std::vector< std::size_t > const &pages) noexcept
Deallocate pages back to the atlas.
std::vector< std::size_t > allocate_pages(std::size_t num_pages) noexcept
Allocate pages from the atlas.
hi::pixmap_span< sfloat_rgba16 > get_staging_pixmap()
Get the full staging pixel map excluding border.
void prepare_atlas_for_rendering()
Prepare the atlas so that it can be used as a texture map by the shaders.
Definition pipeline_image_texture_map.hpp:16
A non-owning 2D pixel-based image.
Definition pixmap_span.hpp:31
Definition vector_span.hpp:133