mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-12 07:03:34 +00:00
fixing issue with fonts vulkan descriptor destroyed
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/07 16:36:33 by maldavid #+# #+# */
|
||||
/* Updated: 2023/12/23 18:49:25 by kbz_8 ### ########.fr */
|
||||
/* Updated: 2024/01/08 21:42:31 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -31,12 +31,15 @@ namespace mlx
|
||||
|
||||
inline void setDescriptor(DescriptorSet&& set) noexcept { _set = set; }
|
||||
inline VkDescriptorSet getSet() noexcept { return _set.isInit() ? _set.get() : VK_NULL_HANDLE; }
|
||||
inline void updateSet(int binding) const noexcept { _set.writeDescriptor(binding, *this); }
|
||||
inline void updateSet(int binding) noexcept { _set.writeDescriptor(binding, *this); _has_been_updated = true; }
|
||||
inline bool hasBeenUpdated() const noexcept { return _has_been_updated; }
|
||||
inline constexpr void resetUpdate() noexcept { _has_been_updated = false; }
|
||||
|
||||
~TextureAtlas() = default;
|
||||
|
||||
private:
|
||||
DescriptorSet _set;
|
||||
bool _has_been_updated = false;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/06 16:41:13 by maldavid #+# #+# */
|
||||
/* Updated: 2023/12/14 17:49:37 by maldavid ### ########.fr */
|
||||
/* Updated: 2024/01/08 21:42:15 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace mlx
|
||||
|
||||
for(char c : text)
|
||||
{
|
||||
if(c < 32)
|
||||
if(c < 32 && c != '\n')
|
||||
continue;
|
||||
|
||||
stbtt_aligned_quad q;
|
||||
@@ -110,13 +110,23 @@ namespace mlx
|
||||
for(auto& draw : _drawlist)
|
||||
{
|
||||
std::shared_ptr<TextData> draw_data = _library.getTextData(draw.id);
|
||||
const TextureAtlas& atlas = draw_data->getFontInUse().getAtlas();
|
||||
TextureAtlas& atlas = const_cast<TextureAtlas&>(draw_data->getFontInUse().getAtlas());
|
||||
draw_data->bind(*_renderer);
|
||||
atlas.updateSet(0);
|
||||
if(atlas.getSet() == VK_NULL_HANDLE)
|
||||
atlas.setDescriptor(_renderer->getFragDescriptorSet().duplicate());
|
||||
if(!atlas.hasBeenUpdated())
|
||||
atlas.updateSet(0);
|
||||
sets[1] = const_cast<TextureAtlas&>(atlas).getSet();
|
||||
vkCmdBindDescriptorSets(_renderer->getActiveCmdBuffer().get(), VK_PIPELINE_BIND_POINT_GRAPHICS, _renderer->getPipeline().getPipelineLayout(), 0, sets.size(), sets.data(), 0, nullptr);
|
||||
atlas.render(*_renderer, draw.x, draw.y, draw_data->getIBOsize());
|
||||
}
|
||||
|
||||
for(auto& draw : _drawlist)
|
||||
{
|
||||
std::shared_ptr<TextData> draw_data = _library.getTextData(draw.id);
|
||||
TextureAtlas& atlas = const_cast<TextureAtlas&>(draw_data->getFontInUse().getAtlas());
|
||||
atlas.resetUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
void TextPutPipeline::destroy() noexcept
|
||||
|
||||
Reference in New Issue
Block a user