19#ifdef GPUCA_BUILD_EVENT_DISPLAY_OPENGL
22#ifdef GPUCA_BUILD_EVENT_DISPLAY_VULKAN
26#ifdef GPUCA_BUILD_EVENT_DISPLAY_FREETYPE
29#ifdef GPUCA_BUILD_EVENT_DISPLAY_FONTCONFIG
30#if !__has_include(<fontconfig/fontconfig.h>)
31#undef GPUCA_BUILD_EVENT_DISPLAY_FONTCONFIG
33#include <fontconfig/fontconfig.h>
50#ifdef GPUCA_BUILD_EVENT_DISPLAY_VULKAN
51 if (strcmp(
type,
"vulkan") == 0 || strcmp(
type,
"auto") == 0) {
55#ifdef GPUCA_BUILD_EVENT_DISPLAY_OPENGL
56 if (strcmp(
type,
"opengl") == 0 || strcmp(
type,
"auto") == 0) {
60 if (strcmp(
type,
"none") == 0) {
63 GPUError(
"Requested renderer not available");
92#ifdef GPUCA_BUILD_EVENT_DISPLAY_FONTCONFIG
94 FcConfig* config = FcInitLoadConfigAndFonts();
95 FcPattern* pat = FcNameParse((
const FcChar8*)
fontName.c_str());
96 FcConfigSubstitute(config, pat, FcMatchPattern);
97 FcDefaultSubstitute(pat);
99 FcPattern* font = FcFontMatch(config, pat, &
result);
100 if (font &&
result == 0) {
101 FcChar8* file =
nullptr;
102 if (FcPatternGetString(font, FC_FILE, 0, &file) == FcResultMatch) {
106 GPUError(
"Coult not find font for pattern %s",
fontName.c_str());
108 FcPatternDestroy(font);
109 FcPatternDestroy(pat);
110 FcConfigDestroy(config);
114#ifdef GPUCA_BUILD_EVENT_DISPLAY_FREETYPE
117 if (FT_Init_FreeType(&ft)) {
118 GPUError(
"Error initializing freetype");
122 GPUError(
"Error loading freetype font");
123 FT_Done_FreeType(ft);
135 for (uint32_t
i = 0;
i < 128;
i++) {
136 if (FT_Load_Char(
face,
i, FT_LOAD_RENDER)) {
137 GPUError(
"Error loading freetype symbol");
139 FT_Done_FreeType(ft);
142 const auto& glyph =
face->glyph;
143 addFontSymbol(
i, glyph->bitmap.width, glyph->bitmap.rows, glyph->bitmap_left, glyph->bitmap_top, glyph->advance.x, glyph->bitmap.buffer);
147 FT_Done_FreeType(ft);
189 int32_t fsaa =
mDisplay->
cfgR().drawQualityDownsampleFSAA;
190 int32_t screenshotScale =
mDisplay->
cfgR().screenshotScaleFactor;
194 if (screenshotScale && screenshot) {
195 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()
int32_t fpsLimitMode() const
virtual bool canLimitToVSync() const
vecpod< DrawArraysIndirectCommand > mCmdBuffer
std::vector< int32_t > mIndirectSectorOffset
void fillIndirectCmdBuffer()
bool mFreetypeInitialized
virtual void clearFontSymbols()
void updateFontScale(float scale)
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)
virtual float getDisplayScale() const
const GPUSettingsDisplayRenderer & cfgR() const
int32_t & drawTextFontSize()
GPUDisplayFrontend * frontend()
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