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;
48 static constexpr float scaledDrawBorder = drawBorder / drawfontSize;
52 vk::ShaderModule vertexShaderModule;
53 vk::ShaderModule fragmentShaderModule;
57 vk::SpecializationInfo fragmentShaderSpecializationInfo;
64 vk::Sampler atlasSampler;
65 vk::DescriptorImageInfo atlasSamplerDescriptorImageInfo;
67 point3 atlas_allocation_position = {};
69 int atlasAllocationMaxHeight = 0;
90 void drawInCommandBuffer(vk::CommandBuffer
const &commandBuffer);
121 aarectangle
const &clipping_rectangle,
124 quad_color colors)
noexcept;
129 void addAtlasImage();
139 auto &info = glyph.atlas_info();
141 if (info) [[likely]] {
142 return {&info,
false};
145 add_glyph_to_atlas(glyph, info);
146 return {&info,
true};
DOXYGEN BUG.
Definition algorithm.hpp:13
Definition glyph_atlas_info.hpp:12
A set of glyph-ids of a font which composites into a single glyph.
Definition glyph_ids.hpp:134
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.
aarectangle get_bounding_box(glyph_ids const &glyphs) const noexcept
Get the bounding box, including draw border of a glyph.
bool place_vertices(vector_span< vertex > &vertices, aarectangle const &clipping_rectangle, quad const &box, glyph_ids const &glyphs, quad_color colors) noexcept
Place vertices for a single glyph.
void uploadStagingPixmapToAtlas(glyph_atlas_info const &location)
Once drawing in the staging pixmap is completed, you can upload it to the atlas.
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 vector_span.hpp:133