7#include "pipeline_SDF_texture_map.hpp"
8#include "pipeline_SDF_vertex.hpp"
9#include "pipeline_SDF_specialization_constants.hpp"
10#include "../font/module.hpp"
11#include "../utility/module.hpp"
13#include "../vector_span.hpp"
14#include "../geometry/module.hpp"
15#include "../color/module.hpp"
16#include <vma/vk_mem_alloc.h>
17#include <vulkan/vulkan.hpp>
19#include <unordered_map>
21namespace hi::inline
v1 {
23class gfx_device_vulkan;
24struct attributed_glyph;
26namespace pipeline_SDF {
37 static constexpr int atlasImageWidth = 256;
38 static constexpr int atlasImageHeight = 256;
39 static_assert(atlasImageWidth == atlasImageHeight,
"needed for fwidth(textureCoord)");
41 static constexpr int atlasMaximumNrImages = 128;
42 static constexpr int stagingImageWidth = 64;
43 static constexpr int stagingImageHeight = 64;
45 static constexpr float atlasTextureCoordinateMultiplier = 1.0f / atlasImageWidth;
46 static constexpr float drawfontSize = 28.0f;
47 static constexpr float drawBorder = sdf_r8::max_distance;
51 vk::ShaderModule vertexShaderModule;
52 vk::ShaderModule fragmentShaderModule;
56 vk::SpecializationInfo fragmentShaderSpecializationInfo;
63 vk::Sampler atlasSampler;
64 vk::DescriptorImageInfo atlasSamplerDescriptorImageInfo;
66 point3 atlas_allocation_position = {};
68 int atlasAllocationMaxHeight = 0;
89 void drawInCommandBuffer(vk::CommandBuffer
const &commandBuffer);
117 aarectangle
const &clipping_rectangle,
119 hi::font
const &
font,
121 quad_color colors)
noexcept;
126 void addAtlasImage();
136 auto &info =
font.atlas_info(glyph);
138 if (info) [[likely]] {
139 return {&info,
false};
142 add_glyph_to_atlas(
font, glyph, info);
143 return {&info,
true};
DOXYGEN BUG.
Definition algorithm.hpp:13
Definition glyph_atlas_info.hpp:12
Definition gfx_device_vulkan.hpp:21
Definition pipeline_SDF_device_shared.hpp:30
void prepareStagingPixmapForDrawing()
This will transition the staging texture to 'general' for writing by the CPU.
void destroy(gfx_device_vulkan const *vulkanDevice)
glyph_atlas_info allocate_rect(extent2 draw_extent, scale2 draw_scale) noexcept
Allocate an glyph in the atlas.
void uploadStagingPixmapToAtlas(glyph_atlas_info const &location)
Once drawing in the staging pixmap is completed, you can upload it to the atlas.
bool place_vertices(vector_span< vertex > &vertices, aarectangle const &clipping_rectangle, quad const &box, hi::font const &font, glyph_id const &glyph, quad_color colors) noexcept
Place vertices for a single glyph.
void prepare_atlas_for_rendering()
This will transition the atlas to 'shader-read'.
Definition pipeline_SDF_specialization_constants.hpp:12
Definition pipeline_SDF_texture_map.hpp:16
Definition tagged_id.hpp:17
Definition vector_span.hpp:133