diff --git a/manual/techdoc.tex b/manual/techdoc.tex index edb1f138..1d6f2e5a 100644 --- a/manual/techdoc.tex +++ b/manual/techdoc.tex @@ -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. diff --git a/profiler/build/unix/build.mk b/profiler/build/unix/build.mk index 1e945445..8df65ae9 100644 --- a/profiler/build/unix/build.mk +++ b/profiler/build/unix/build.mk @@ -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) diff --git a/profiler/src/NativeWindow.cpp b/profiler/src/NativeWindow.cpp index 79ac0f60..94031cdc 100644 --- a/profiler/src/NativeWindow.cpp +++ b/profiler/src/NativeWindow.cpp @@ -6,7 +6,13 @@ # define GLFW_EXPOSE_NATIVE_WIN32 # include #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 #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 diff --git a/profiler/src/main.cpp b/profiler/src/main.cpp index f453defc..43872d0e 100644 --- a/profiler/src/main.cpp +++ b/profiler/src/main.cpp @@ -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);