HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
v1::pipeline_SDF::device_shared Struct Reference

Public Member Functions

 device_shared (gfx_device_vulkan const &device)
 device_shared (device_shared const &)=delete
device_shared & operator= (device_shared const &)=delete
 device_shared (device_shared &&)=delete
device_shared & operator= (device_shared &&)=delete
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 drawInCommandBuffer (vk::CommandBuffer const &commandBuffer)
void uploadStagingPixmapToAtlas (glyph_atlas_info const &location)
 Once drawing in the staging pixmap is completed, you can upload it to the atlas.
void prepareStagingPixmapForDrawing ()
 This will transition the staging texture to 'general' for writing by the CPU.
void prepare_atlas_for_rendering ()
 This will transition the atlas to 'shader-read'.
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.

Data Fields

gfx_device_vulkan const & device
vk::ShaderModule vertexShaderModule
vk::ShaderModule fragmentShaderModule
specialization_constants specializationConstants
std::vector< vk::SpecializationMapEntry > fragmentShaderSpecializationMapEntries
vk::SpecializationInfo fragmentShaderSpecializationInfo
std::vector< vk::PipelineShaderStageCreateInfo > shaderStages
texture_map stagingTexture
std::vector< texture_mapatlasTextures
std::array< vk::DescriptorImageInfo, atlasMaximumNrImages > atlasDescriptorImageInfos
vk::Sampler atlasSampler
vk::DescriptorImageInfo atlasSamplerDescriptorImageInfo
point3 atlas_allocation_position = {}
int atlasAllocationMaxHeight = 0
 During allocation on a row, we keep track of the tallest glyph.

Static Public Attributes

static constexpr int atlasImageWidth = 256
static constexpr int atlasImageHeight = 256
static constexpr int atlasMaximumNrImages = 128
static constexpr int stagingImageWidth = 64
static constexpr int stagingImageHeight = 64
static constexpr float atlasTextureCoordinateMultiplier = 1.0f / atlasImageWidth
static constexpr float drawfontSize = 28.0f
static constexpr float drawBorder = sdf_r8::max_distance

Member Function Documentation

◆ allocate_rect()

glyph_atlas_info v1::pipeline_SDF::device_shared::allocate_rect ( extent2 draw_extent,
scale2 draw_scale )
nodiscardnoexcept

Allocate an glyph in the atlas.

This may allocate an atlas texture, up to atlasMaximumNrImages.

◆ destroy()

void v1::pipeline_SDF::device_shared::destroy ( gfx_device_vulkan const * vulkanDevice)

Deallocate vulkan resources. This is called in the destructor of gfx_device_vulkan, therefor we can not use our std::weak_ptr<gfx_device_vulkan> device.

◆ place_vertices()

bool v1::pipeline_SDF::device_shared::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.

Parameters
verticesThe list of vertices to add to.
clipping_rectangleThe rectangle to clip the glyph.
boxThe rectangle of the glyph in window coordinates. The box's size must be the size of the glyph's bounding box times glyph_size.
fontThe font to render the glyph from.
glyphThe glyph to render.
colorsThe color of each corner of the glyph.
Returns
True is atlas was updated.

◆ prepare_atlas_for_rendering()

void v1::pipeline_SDF::device_shared::prepare_atlas_for_rendering ( )

This will transition the atlas to 'shader-read'.

◆ prepareStagingPixmapForDrawing()

void v1::pipeline_SDF::device_shared::prepareStagingPixmapForDrawing ( )

This will transition the staging texture to 'general' for writing by the CPU.

◆ uploadStagingPixmapToAtlas()

void v1::pipeline_SDF::device_shared::uploadStagingPixmapToAtlas ( glyph_atlas_info const & location)

Once drawing in the staging pixmap is completed, you can upload it to the atlas.

This will transition the stating texture to 'source' and the atlas to 'destination'.

Field Documentation

◆ atlasAllocationMaxHeight

int v1::pipeline_SDF::device_shared::atlasAllocationMaxHeight = 0

During allocation on a row, we keep track of the tallest glyph.


The documentation for this struct was generated from the following file: