Skip to content

Commit

Permalink
tracy profiling: fix clang warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkautarch committed Aug 6, 2024
1 parent b54324b commit 1a64c02
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/steamcompmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5990,7 +5990,7 @@ bool handle_done_commit( steamcompmgr_win_t *w, xwayland_ctx_t *ctx, uint64_t co
{
gpuvis_trace_printf( "commit %lu done", w->commit_queue[ j ]->commitID );
static constinit char msg[12 + sizeof(uint64_t)+1];
int msgSz = sprintf(msg, "commit %lu done\n", w->commit_queue[ j ]->commitID);
[[maybe_unused]] int msgSz = sprintf(msg, "commit %lu done\n", w->commit_queue[ j ]->commitID);
TracyMessageC(msg, msgSz, TRACY_COLOR(LightSteelBlue));
w->commit_queue[ j ]->done = true;
w->commit_queue[ j ]->earliest_present_time = earliestPresentTime;
Expand Down
31 changes: 25 additions & 6 deletions src/tracy_include.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#ifndef __TRACYAPI_H__
# define __TRACYAPI_H__
# define TRACY_API
#endif

#ifndef __TRACYSCOPED_GAMESCOPE__
#define __TRACYSCOPED_HPP__
#endif
Expand All @@ -6,18 +11,32 @@
#include <exception>
#include <optional>

#ifdef TracyIsStarted
# undef TracyIsStarted
#endif

#include "tracy/Tracy.hpp"
#include "tracy/TracyC.h"


// Hacky workaround for a compiler error that seems to happen when using tracy::ScopedZone::TextFmt
// due to gcc being angry that a variadic function (the va_args kind) has the __attribute__((always_inline)) attribute on it
#ifndef __TRACYSCOPED_GAMESCOPE__
#undef tracy_force_inline
#define tracy_force_inline inline
#undef __TRACYSCOPED_HPP__
#include "client/TracyScoped.hpp"
#define __TRACYSCOPED_GAMESCOPE__
#if !defined(__TRACYSCOPED_GAMESCOPE__) && defined(TRACY_ENABLE)
# ifdef tracy_force_inline
# undef tracy_force_inline
# endif

# define tracy_force_inline inline
# define tracy_no_inline __attribute__((noinline))
# define __TRACYFORCEINLINE_HPP__
# undef __TRACYSCOPED_HPP__

# include "client/TracyScoped.hpp"

# undef tracy_force_inline
# define tracy_force_inline __attribute__((always_inline)) inline
# define __TRACYSCOPED_GAMESCOPE__
# define __TRACYSCOPED_HPP__
#endif
//************************************************************************//

Expand Down
4 changes: 2 additions & 2 deletions src/vblankmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ namespace gamescope
// Majority of backends fall down this optimal
// timerfd path, vs nudge thread.
g_VBlankLog.infof( "Using timerfd." );
static constexpr char msg[] = "Using timerfd.";
[[maybe_unused]] static constexpr char msg[] = "Using timerfd.";
TracyAppInfo(const_cast<const char *>(msg), sizeof(msg));
}
else
{
g_VBlankLog.infof( "Using nudge thread." );
static constexpr char msg[] = "Using nudge thread.";
[[maybe_unused]] static constexpr char msg[] = "Using nudge thread.";
TracyAppInfo(const_cast<const char *>(msg), sizeof(msg));

if ( pipe2( m_nNudgePipe, O_CLOEXEC | O_NONBLOCK ) != 0 )
Expand Down
9 changes: 8 additions & 1 deletion src/vulkan_include.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#pragma once
#ifndef __TRACYAPI_H__
# define __TRACYAPI_H__
# define TRACY_API
#endif

#define VK_NO_PROTOTYPES
#include <vulkan/vulkan_core.h>
Expand All @@ -11,7 +15,10 @@
# endif

# define tracy_force_inline inline
# define tracy_no_inline __attribute__((noinline))
# ifndef tracy_no_inline
# define tracy_no_inline __attribute__((noinline))
# endif

# define __TRACYFORCEINLINE_HPP__
# include "client/TracyScoped.hpp"
# undef tracy_force_inline
Expand Down

0 comments on commit 1a64c02

Please sign in to comment.