1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 04:23:51 +00:00

Merge pull request #115 from annacrombie/wayland_fix

Make Tracy run natively on Wayland
This commit is contained in:
Bartosz Taudul 2020-10-02 11:44:05 +02:00 committed by GitHub
commit 06a0d6d7e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 1 deletions

View File

@ -141,6 +141,8 @@ The \texttt{debug.mk} and \texttt{release.mk} files only set a few of the optimi
In the header of the \texttt{build.mk} file you can find definitions of the resulting executable name, list of used libraries, required include paths, etc. Most of the file is boilerplate required to extract build dependencies, or pass the appropriate flags to compiler and linker.
By default, the profiler uses X11 on Linux. If you would like to support Wayland instead, set the environment variable \texttt{TRACY\_USE\_WAYLAND} before running make.
\section{Client part}
The client portion of Tracy is basically a queue. Application threads are producing queue items through the instrumentation macros and a dedicated profiler thread consumes the items to send them over the network, to the server.

View File

@ -3,6 +3,16 @@ CXXFLAGS := $(CFLAGS) -std=c++17
DEFINES += -DIMGUI_IMPL_OPENGL_LOADER_GL3W
INCLUDES := $(shell pkg-config --cflags glfw3 freetype2 capstone) -I../../../imgui -I../../libs/gl3w
LIBS := $(shell pkg-config --libs glfw3 freetype2 capstone) -lpthread -ldl
DISPLAY_SERVER := X11
ifdef TRACY_USE_WAYLAND
DISPLAY_SERVER := WAYLAND
LIBS += $(shell pkg-config --libs wayland-client)
endif
CXXFLAGS += -D"DISPLAY_SERVER_$(DISPLAY_SERVER)"
PROJECT := Tracy
IMAGE := $(PROJECT)-$(BUILD)

View File

@ -6,7 +6,13 @@
# define GLFW_EXPOSE_NATIVE_WIN32
# include <GLFW/glfw3native.h>
#elif defined __linux__
# define GLFW_EXPOSE_NATIVE_X11
# ifdef DISPLAY_SERVER_X11
# define GLFW_EXPOSE_NATIVE_X11
# elif defined DISPLAY_SERVER_WAYLAND
# define GLFW_EXPOSE_NATIVE_WAYLAND
# else
# error "unsupported linux display server"
# endif
# include <GLFW/glfw3native.h>
#endif
@ -17,7 +23,11 @@ void* GetMainWindowNative()
#ifdef _WIN32
return (void*)glfwGetWin32Window( s_glfwWindow );
#elif defined __linux__
# ifdef DISPLAY_SERVER_X11
return (void*)glfwGetX11Window( s_glfwWindow );
# elif defined DISPLAY_SERVER_WAYLAND
return (void*)glfwGetWaylandWindow( s_glfwWindow );
# endif
#else
return nullptr;
#endif

View File

@ -244,7 +244,11 @@ int main( int argc, char** argv )
// Setup window
glfwSetErrorCallback(glfw_error_callback);
if( !glfwInit() ) return 1;
#ifdef DISPLAY_SERVER_WAYLAND
glfwWindowHint(GLFW_ALPHA_BITS, 0);
#else
glfwWindowHint(GLFW_VISIBLE, 0);
#endif
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);