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) {
55 GPUError(
"Requested renderer not available");
70#ifdef GPUCA_BUILD_EVENT_DISPLAY_FONTCONFIG
72 FcConfig* config = FcInitLoadConfigAndFonts();
73 FcPattern* pat = FcNameParse((
const FcChar8*)
fontName.c_str());
74 FcConfigSubstitute(config, pat, FcMatchPattern);
75 FcDefaultSubstitute(pat);
77 FcPattern* font = FcFontMatch(config, pat, &
result);
79 FcChar8*
file =
nullptr;
80 if (FcPatternGetString(font, FC_FILE, 0, &
file) == FcResultMatch) {
84 GPUError(
"Coult not find font for pattern %s",
fontName.c_str());
86 FcPatternDestroy(font);
87 FcPatternDestroy(pat);
88 FcConfigDestroy(config);
92#ifdef GPUCA_BUILD_EVENT_DISPLAY_FREETYPE
95 if (FT_Init_FreeType(&ft)) {
96 GPUError(
"Error initializing freetype");
100 GPUError(
"Error loading freetypoe font");
111 for (uint32_t
i = 0;
i < 128;
i++) {
112 if (FT_Load_Char(
face,
i, FT_LOAD_RENDER)) {
113 GPUError(
"Error loading freetype symbol");
116 const auto& glyph =
face->glyph;
117 addFontSymbol(
i, glyph->bitmap.width, glyph->bitmap.rows, glyph->bitmap_left, glyph->bitmap_top, glyph->advance.x, glyph->bitmap.buffer);
121 FT_Done_FreeType(ft);
155 int32_t fsaa =
mDisplay->
cfgR().drawQualityDownsampleFSAA;
156 int32_t screenshotScale =
mDisplay->
cfgR().screenshotScaleFactor;
160 if (screenshotScale && screenshot) {
161 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