20#ifdef GPUCA_BUILD_EVENT_DISPLAY_VULKAN
24#ifdef GPUCA_BUILD_EVENT_DISPLAY_FREETYPE
27#ifdef GPUCA_BUILD_EVENT_DISPLAY_FONTCONFIG
28#if !__has_include(<fontconfig/fontconfig.h>)
29#undef GPUCA_BUILD_EVENT_DISPLAY_FONTCONFIG
31#include <fontconfig/fontconfig.h>
47#ifdef GPUCA_BUILD_EVENT_DISPLAY_VULKAN
48 if (strcmp(
type,
"vulkan") == 0 || strcmp(
type,
"auto") == 0) {
52 if (strcmp(
type,
"opengl") == 0 || strcmp(
type,
"auto") == 0) {
54 }
else if (strcmp(
type,
"none") == 0) {
57 GPUError(
"Requested renderer not available");
72#ifdef GPUCA_BUILD_EVENT_DISPLAY_FONTCONFIG
74 FcConfig* config = FcInitLoadConfigAndFonts();
75 FcPattern* pat = FcNameParse((
const FcChar8*)
fontName.c_str());
76 FcConfigSubstitute(config, pat, FcMatchPattern);
77 FcDefaultSubstitute(pat);
79 FcPattern* font = FcFontMatch(config, pat, &
result);
81 FcChar8*
file =
nullptr;
82 if (FcPatternGetString(font, FC_FILE, 0, &
file) == FcResultMatch) {
86 GPUError(
"Coult not find font for pattern %s",
fontName.c_str());
88 FcPatternDestroy(font);
89 FcPatternDestroy(pat);
90 FcConfigDestroy(config);
94#ifdef GPUCA_BUILD_EVENT_DISPLAY_FREETYPE
97 if (FT_Init_FreeType(&ft)) {
98 GPUError(
"Error initializing freetype");
102 GPUError(
"Error loading freetypoe font");
113 for (uint32_t
i = 0;
i < 128;
i++) {
114 if (FT_Load_Char(
face,
i, FT_LOAD_RENDER)) {
115 GPUError(
"Error loading freetype symbol");
118 const auto& glyph =
face->glyph;
119 addFontSymbol(
i, glyph->bitmap.width, glyph->bitmap.rows, glyph->bitmap_left, glyph->bitmap_top, glyph->advance.x, glyph->bitmap.buffer);
123 FT_Done_FreeType(ft);
157 int32_t fsaa =
mDisplay->
cfgR().drawQualityDownsampleFSAA;
158 int32_t screenshotScale =
mDisplay->
cfgR().screenshotScaleFactor;
162 if (screenshotScale && screenshot) {
163 factor *= screenshotScale;
virtual void addFontSymbol(int32_t symbol, int32_t sizex, int32_t sizey, int32_t offsetx, int32_t offsety, int32_t advance, void *data)=0
std::vector< char > getPixels()
vecpod< DrawArraysIndirectCommand > mCmdBuffer
std::vector< int32_t > mIndirectSectorOffset
void fillIndirectCmdBuffer()
bool mFreetypeInitialized
static GPUDisplayBackend * getBackend(const char *type)
std::vector< char > mScreenshotPixels
virtual void ExitBackendA()=0
virtual void initializeTextDrawing()=0
virtual int32_t InitBackendA()=0
virtual ~GPUDisplayBackend()
float getDownsampleFactor(bool screenshot=false)
const GPUSettingsDisplayRenderer & cfgR() const
int32_t & drawTextFontSize()
const vecpod< uint32_t > * vertexBufferCount() const
const GPUSettingsDisplay & cfg() const
vecpod< int32_t > * vertexBufferStart()
GLenum GLuint GLint GLenum face
GLint GLint GLsizei GLint GLenum GLenum type
GLenum GLsizeiptr fontSize
GLenum const void * fontName