HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Member Functions | Data Fields | Static Public Attributes
hi::v1::gfx_pipeline_SDF::device_shared Struct Reference

Public Member Functions

 device_shared (gfx_device const &device)
 
 device_shared (device_shared const &)=delete
 
device_sharedoperator= (device_shared const &)=delete
 
 device_shared (device_shared &&)=delete
 
device_sharedoperator= (device_shared &&)=delete
 
void destroy (gfx_device 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 glyph, quad_color colors) noexcept
 Place vertices for a single glyph.
 

Data Fields

gfx_device 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
 
static constexpr float scaledDrawBorder = drawBorder / drawfontSize
 

Member Function Documentation

◆ allocate_rect()

glyph_atlas_info hi::v1::gfx_pipeline_SDF::device_shared::allocate_rect ( extent2 draw_extent,
scale2 draw_scale )
inlinenoexcept

Allocate an glyph in the atlas.

This may allocate an atlas texture, up to atlasMaximumNrImages.

◆ destroy()

void hi::v1::gfx_pipeline_SDF::device_shared::destroy ( gfx_device const * vulkanDevice)
inline

Deallocate vulkan resources. This is called in the destructor of gfx_device, therefor we can not use our gfx_device from this point on.

◆ place_vertices()

bool hi::v1::gfx_pipeline_SDF::device_shared::place_vertices ( vector_span< vertex > & vertices,
aarectangle const & clipping_rectangle,
quad const & box,
hi::font const & font,
glyph_id glyph,
quad_color colors )
inlinenoexcept

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.
glyphsThe font-id, composed-glyphs to render
colorsThe color of each corner of the glyph.
Returns
True is atlas was updated.

◆ prepare_atlas_for_rendering()

void hi::v1::gfx_pipeline_SDF::device_shared::prepare_atlas_for_rendering ( )
inline

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

◆ prepareStagingPixmapForDrawing()

void hi::v1::gfx_pipeline_SDF::device_shared::prepareStagingPixmapForDrawing ( )
inline

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

◆ uploadStagingPixmapToAtlas()

void hi::v1::gfx_pipeline_SDF::device_shared::uploadStagingPixmapToAtlas ( glyph_atlas_info const & location)
inline

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 hi::v1::gfx_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 files: