From 41c1b5ce97c24782a9d21735554310ca33f7ea41 Mon Sep 17 00:00:00 2001 From: M4xw Date: Sat, 29 Sep 2018 02:59:31 +0200 Subject: [PATCH 1/2] [LIBNX] Add freetype --- Makefile.libnx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile.libnx b/Makefile.libnx index 881af56617..547f8d3060 100644 --- a/Makefile.libnx +++ b/Makefile.libnx @@ -40,7 +40,7 @@ HAVE_NETWORKING = 1 # RetroArch libnx useful flags HAVE_THREADS = 1 HAVE_PTHREADS = 1 -HAVE_FREETYPE = 0 +HAVE_FREETYPE = 1 HAVE_SWITCH = 1 HAVE_LIBNX = 1 HAVE_OPENGL = 1 @@ -110,9 +110,9 @@ NO_ICON := 1 ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE -mcpu=cortex-a57+crc+fp+simd CFLAGS := -g -Wall -O3 -ffast-math -ffunction-sections \ - $(ARCH) $(DEFINES) -Ideps -Ideps/libz -Ilibretro-common/include -Ideps/stb -I$(LIBNX)/include -I$(PORTLIBS)/include/ -include $(LIBNX)/include/switch.h #$(shell $(DEVKITPRO)/portlibs/switch/bin/freetype-config --cflags) + $(ARCH) $(DEFINES) -Ideps -Ideps/libz -Ilibretro-common/include -Ideps/stb -I$(LIBNX)/include -I$(PORTLIBS)/include/ -include $(LIBNX)/include/switch.h $(shell $(DEVKITPRO)/portlibs/switch/bin/freetype-config --cflags) -CFLAGS += $(INCLUDE) -DSWITCH=1 -DHAVE_LIBNX=1 -DNXLINK=1 +CFLAGS += $(INCLUDE) -DSWITCH=1 -DHAVE_LIBNX=1 -DNXLINK=1 -DHAVE_SHADERPIPELINE -DHAVE_FREETYPE # The following line works around an issue in newlib that produces a compilation # error in glm. It will be removed as soon as this issue is resolved. @@ -123,7 +123,7 @@ CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11 ASFLAGS := -g $(ARCH) LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs $(ARCH) -Wl,--allow-multiple-definition -Wl,-Map,$(notdir $*.map) -LIBS := -lstdc++ -lbz2 -lpng -lz -lnx -lm +LIBS := -lfreetype -lstdc++ -lbz2 -lpng -lz -lnx -lm ifeq ($(HAVE_OPENGL), 1) LIBS := -lEGL -lglapi -ldrm_nouveau $(LIBS) From b4ae829b3fb97a515f7674ad0bf9a5cdd17f245b Mon Sep 17 00:00:00 2001 From: M4xw Date: Sat, 29 Sep 2018 03:01:41 +0200 Subject: [PATCH 2/2] [LIBNX] Workaround for freezes caused by freetype with video threaded, revert later --- gfx/font_driver.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gfx/font_driver.c b/gfx/font_driver.c index 9081c721bb..1f7edce0aa 100644 --- a/gfx/font_driver.c +++ b/gfx/font_driver.c @@ -56,6 +56,14 @@ int font_renderer_create_default( for (i = 0; font_backends[i]; i++) { const char *path = font_path; + /* + Switch libnx freetype is bugged on thread, skip + TODO: remove when fixed + */ +#if defined(HAVE_LIBNX) && defined(HAVE_FREETYPE) + if(font_backends[i] == &freetype_font_renderer && *video_driver_get_threaded()) // freetype + continue; +#endif if (!path) path = font_backends[i]->get_default_font();