7#include "pipeline_image_texture_map.hpp"
8#include "pipeline_image_vertex.hpp"
9#include "paged_image.hpp"
11#include "../rapid/sfloat_rgba16.hpp"
12#include "../geometry/quad.hpp"
13#include "../vspan.hpp"
14#include <vk_mem_alloc.h>
15#include <vulkan/vulkan.hpp>
18namespace hi::inline v1 {
19class gfx_device_vulkan;
23namespace pipeline_image {
26 static constexpr std::size_t atlas_num_pages_per_axis = 8;
27 static constexpr std::size_t atlas_num_pages_per_image = atlas_num_pages_per_axis * atlas_num_pages_per_axis;
28 static constexpr std::size_t atlas_image_axis_size = atlas_num_pages_per_axis * (paged_image::page_size + 2);
29 static constexpr std::size_t atlas_maximum_num_images = 64;
30 static constexpr std::size_t staging_image_width = 1024;
31 static constexpr std::size_t staging_image_height = 1024;
35 vk::ShaderModule vertex_shader_module;
36 vk::ShaderModule fragment_shader_module;
43 vk::Sampler atlas_sampler;
44 vk::DescriptorImageInfo atlas_sampler_descriptor_image_info;
68 void draw_in_command_buffer(vk::CommandBuffer &commandBuffer);
101 return get_staging_pixel_map().submap(0, 0, width, height);
108 void make_staging_border_transparent(
aarectangle border_rectangle)
noexcept;
115 void clear_staging_between_border_and_upload(
aarectangle border_rectangle,
aarectangle upload_rectangle)
noexcept;
127 void prepare_staging_for_upload(
paged_image const &image)
noexcept;
131 void update_atlas_with_staging_pixel_map(
paged_image const &image)
noexcept;
133 void build_shaders();
135 void add_atlas_image();
This file includes required definitions.
Class which represents an axis-aligned rectangle.
Definition axis_aligned_rectangle.hpp:20
Definition gfx_device_vulkan.hpp:20
This is a image that is uploaded into the texture atlas.
Definition paged_image.hpp:25
Definition pipeline_image_device_shared.hpp:25
void place_vertices(vspan< vertex > &vertices, aarectangle const &clipping_rectangle, quad const &box, paged_image const &image) noexcept
Place vertices for a single image.
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::pixel_map< sfloat_rgba16 > get_staging_pixel_map()
Get the full staging pixel map excluding border.
void destroy(gfx_device_vulkan *vulkanDevice)
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:17