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>
48#ifdef GPUCA_BUILD_EVENT_DISPLAY_VULKAN
49 if (strcmp(
type,
"vulkan") == 0 || strcmp(
type,
"auto") == 0) {
53 if (strcmp(
type,
"opengl") == 0 || strcmp(
type,
"auto") == 0) {
55 }
else if (strcmp(
type,
"none") == 0) {
58 GPUError(
"Requested renderer not available");
73#ifdef GPUCA_BUILD_EVENT_DISPLAY_FONTCONFIG
75 FcConfig* config = FcInitLoadConfigAndFonts();
76 FcPattern* pat = FcNameParse((
const FcChar8*)
fontName.c_str());
77 FcConfigSubstitute(config, pat, FcMatchPattern);
78 FcDefaultSubstitute(pat);
80 FcPattern* font = FcFontMatch(config, pat, &
result);
82 FcChar8* file =
nullptr;
83 if (FcPatternGetString(font, FC_FILE, 0, &file) == FcResultMatch) {
87 GPUError(
"Coult not find font for pattern %s",
fontName.c_str());
89 FcPatternDestroy(font);
90 FcPatternDestroy(pat);
91 FcConfigDestroy(config);
95#ifdef GPUCA_BUILD_EVENT_DISPLAY_FREETYPE
98 if (FT_Init_FreeType(&ft)) {
99 GPUError(
"Error initializing freetype");
103 GPUError(
"Error loading freetypoe font");
114 for (uint32_t
i = 0;
i < 128;
i++) {
115 if (FT_Load_Char(
face,
i, FT_LOAD_RENDER)) {
116 GPUError(
"Error loading freetype symbol");
119 const auto& glyph =
face->glyph;
120 addFontSymbol(
i, glyph->bitmap.width, glyph->bitmap.rows, glyph->bitmap_left, glyph->bitmap_top, glyph->advance.x, glyph->bitmap.buffer);
124 FT_Done_FreeType(ft);
158 int32_t fsaa =
mDisplay->
cfgR().drawQualityDownsampleFSAA;
159 int32_t screenshotScale =
mDisplay->
cfgR().screenshotScaleFactor;
163 if (screenshotScale && screenshot) {
164 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()
static constexpr uint32_t NSECTORS
GLenum GLuint GLint GLenum face
GLint GLint GLsizei GLint GLenum GLenum type
GLenum GLsizeiptr fontSize
GLenum const void * fontName