forked from Dynamitos/Seele
Delete invasive font atlas tests
This commit is contained in:
1 parent
22a90fe07c
commit
1bc73b6d2f
9 files changed
+37
-263
No files matched your search
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
#include "Asset.h"
|
||||
#include "FontAssetTestHooks.h"
|
||||
#include "Containers/Map.h"
|
||||
#include "Graphics/Texture.h"
|
||||
#include "Math/Math.h"
|
||||
@@ -38,33 +37,6 @@ class FontAsset : public Asset {
|
||||
// packs every glyph of `fontSize` into one atlas (created lazily on first use by
|
||||
// shapeText); public so the unit test can drive the real packer
|
||||
void loadGlyphs(uint32 fontSize);
|
||||
// test seam, mirrors exactly what FontLoader::import does (the only other path that
|
||||
// sets ttfFile/graphics): a unit test uses it to drive loadGlyphs() and read the
|
||||
// produced atlas back for validation against FreeType ground truth
|
||||
void importForTest(const char* ttfBytes, uint64 size, Gfx::PGraphics graphics) {
|
||||
this->ttfFile = Array<char>(size);
|
||||
std::memcpy(this->ttfFile.data(), ttfBytes, size);
|
||||
this->graphics = graphics;
|
||||
loadFace();
|
||||
}
|
||||
// unit test: reads the packed atlas + UV rects back for validation (friend)
|
||||
FontAssetGlyphRects exportForTest(uint32 fontSize) const {
|
||||
const FontData& data = fontSizes.at(fontSize);
|
||||
FontAssetGlyphRects out;
|
||||
out.atlasWidth = data.atlas->getWidth();
|
||||
out.atlasHeight = data.atlas->getHeight();
|
||||
out.atlas = data.atlas;
|
||||
for (auto& [id, glyph] : data.glyphs) {
|
||||
FontAssetGlyphRects::Rect r;
|
||||
r.uvOffset = glyph.uvOffset;
|
||||
r.uvSize = glyph.uvSize;
|
||||
r.width = glyph.size.x;
|
||||
r.height = glyph.size.y;
|
||||
out.glyphs[id] = r;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
struct RenderGlyph {
|
||||
Gfx::PTexture2D texture; // the font's atlas for this size (shared by all its glyphs)
|
||||
Vector2 uvOffset;
|
||||
@@ -84,8 +56,6 @@ class FontAsset : public Asset {
|
||||
Array<char> ttfFile;
|
||||
Map<uint32, FontData> fontSizes;
|
||||
friend class FontLoader;
|
||||
// unit test: drives the packer and reads the resulting atlas back for validation
|
||||
friend class FontAssetAtlasProbe;
|
||||
};
|
||||
DECLARE_REF(FontAsset)
|
||||
} // namespace Seele
|
||||
@@ -1,19 +0,0 @@
|
||||
#pragma once
|
||||
#include "Containers/Map.h"
|
||||
#include "Graphics/Texture.h"
|
||||
#include "Math/Math.h"
|
||||
|
||||
namespace Seele {
|
||||
struct FontAssetGlyphRects {
|
||||
struct Rect {
|
||||
Vector2 uvOffset = Vector2(0);
|
||||
Vector2 uvSize = Vector2(0);
|
||||
uint32 width = 0;
|
||||
uint32 height = 0;
|
||||
};
|
||||
uint32 atlasWidth = 0;
|
||||
uint32 atlasHeight = 0;
|
||||
Map<uint32, Rect> glyphs; // glyphId -> packed rect (same order as the atlas upload)
|
||||
Gfx::PTexture2D atlas = nullptr; // the packed atlas (for readback via download)
|
||||
};
|
||||
} // namespace Seele
|
||||
@@ -12,14 +12,14 @@ UIPass::UIPass(Gfx::PGraphics graphics, UI::PSystem system) : RenderPass(graphic
|
||||
elementBuffer = graphics->createShaderBuffer(ShaderBufferCreateInfo{.name = "RenderStyleElements"});
|
||||
|
||||
uiDescriptorLayout = graphics->createDescriptorLayout("pParams");
|
||||
uiDescriptorLayout->addDescriptorBinding(Gfx::DescriptorBinding{
|
||||
.name = ELEMENT_NAME,
|
||||
.descriptorType = Gfx::SE_DESCRIPTOR_TYPE_STORAGE_BUFFER,
|
||||
});
|
||||
uiDescriptorLayout->addDescriptorBinding(Gfx::DescriptorBinding{
|
||||
.name = GLYPHSAMPLER_NAME,
|
||||
.descriptorType = Gfx::SE_DESCRIPTOR_TYPE_SAMPLER,
|
||||
});
|
||||
uiDescriptorLayout->addDescriptorBinding(Gfx::DescriptorBinding{
|
||||
.name = ELEMENT_NAME,
|
||||
.descriptorType = Gfx::SE_DESCRIPTOR_TYPE_STORAGE_BUFFER,
|
||||
});
|
||||
uiDescriptorLayout->addDescriptorBinding(Gfx::DescriptorBinding{
|
||||
.name = TEXTURES_NAME,
|
||||
.descriptorType = Gfx::SE_DESCRIPTOR_TYPE_SAMPLED_IMAGE,
|
||||
|
||||
@@ -99,7 +99,7 @@ DescriptorPool::DescriptorPool(PGraphics graphics, PDescriptorLayout layout)
|
||||
Map<VkDescriptorType, uint32> perTypeSizes;
|
||||
for (uint32 i = 0; i < layout->bindings.size(); ++i) {
|
||||
auto& binding = layout->bindings[i];
|
||||
perTypeSizes[binding.descriptorType] += 512;
|
||||
perTypeSizes[binding.descriptorType] += 2048;
|
||||
}
|
||||
Array<VkDescriptorPoolSize> poolSizes;
|
||||
for (const auto& [type, num] : perTypeSizes) {
|
||||
|
||||
@@ -933,6 +933,7 @@ void Graphics::pickPhysicalDevice() {
|
||||
features.get<VkPhysicalDeviceVulkan12Features>().storageBuffer8BitAccess = true;
|
||||
features.get<VkPhysicalDeviceVulkan12Features>().shaderInt8 = true;
|
||||
features.get<VkPhysicalDeviceVulkan12Features>().uniformAndStorageBuffer8BitAccess = true;
|
||||
features.get<VkPhysicalDeviceVulkan12Features>().runtimeDescriptorArray = true;
|
||||
|
||||
rayTracingFeatures.get<VkPhysicalDeviceAccelerationStructureFeaturesKHR>().accelerationStructure = true;
|
||||
|
||||
|
||||
Reference in new issue
Block a user