mirror of
https://github.com/wolfpld/tracy.git
synced 2026-09-17 15:54:23 +00:00
Merge pull request #1289 from slomp/slomp/windows-on-arm
Support for Windows on ARM
This commit is contained in:
@@ -368,7 +368,7 @@ Note that these binary releases require AVX2 instruction set support on the proc
|
||||
Tracy Profiler supports MSVC, GCC, and clang. You will need to use a reasonably recent version of the compiler due to the C++11 requirement. The following platforms are confirmed to be working (this is not a complete list):
|
||||
|
||||
\begin{itemize}
|
||||
\item Windows (x86, x64, ARM64)
|
||||
\item Windows (x86, x64, ARM64\footnote{Requires \textbf{"OpenCL, OpenGL, and Vulkan Compatibility Pack"} from Microsoft Store.})
|
||||
\item Linux (x86, x64, ARM, ARM64)
|
||||
\item Android (ARM, ARM64, x86)
|
||||
\item FreeBSD (x64)
|
||||
@@ -876,6 +876,12 @@ logo=\bcbombe
|
||||
Please don't ask about window decorations in Gnome. The current behavior is the intended behavior. Gnome does not want windows to have decorations, and Tracy respects that choice. If you find this problematic, use a desktop environment that actually listens to its users.
|
||||
\end{bclogo}
|
||||
|
||||
\subsubsection{Windows on ARM}
|
||||
|
||||
Special considerations must be taken to run the Tracy server/profiler GUI on Windows on ARM.
|
||||
|
||||
Ensure that the \textbf{"OpenCL, OpenGL, and Vulkan Compatibility Pack"} is installed (from the Microsoft Store), otherwise the GUI will fail to open.
|
||||
|
||||
\subsubsection{Using an IDE}
|
||||
|
||||
The recommended development environment is Visual Studio Code\footnote{\url{https://code.visualstudio.com/}}. This is a cross-platform solution, so you always get the same experience, no matter what OS you are using.
|
||||
|
||||
@@ -134,7 +134,18 @@ Backend::Backend( const char* title, const std::function<void()>& redraw, const
|
||||
# endif
|
||||
#endif
|
||||
s_window = glfwCreateWindow( m_winPos.w, m_winPos.h, title, NULL, NULL );
|
||||
if( !s_window ) exit( 1 );
|
||||
if( !s_window ) {
|
||||
const char* description;
|
||||
int code = glfwGetError( &description );
|
||||
if( description ) {
|
||||
fprintf( stderr, "ERROR: Tracy (GLFW): %s\n", description );
|
||||
#ifdef _WIN32
|
||||
MessageBoxA( NULL, description, "ERROR: Tracy (GLFW)", MB_OK );
|
||||
OutputDebugStringA( description );
|
||||
#endif
|
||||
}
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
glfwSetWindowPos( s_window, m_winPos.x, m_winPos.y );
|
||||
#if GLFW_VERSION_MAJOR > 3 || ( GLFW_VERSION_MAJOR == 3 && GLFW_VERSION_MINOR >= 2 )
|
||||
|
||||
@@ -282,6 +282,7 @@ static bool EnsureReadable( uintptr_t address )
|
||||
return mapping && EnsureReadable( *mapping );
|
||||
}
|
||||
#elif defined WIN32
|
||||
static_assert( TRACY_WINARM64_CNTVCT_EL0 == ARM64_CNTVCT_EL0, "ARM64_CNTVCT_EL0 mismatch" );
|
||||
static bool EnsureReadable( uintptr_t address )
|
||||
{
|
||||
MEMORY_BASIC_INFORMATION memInfo;
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
|
||||
#if ( defined __i386 || defined _M_IX86 || defined __x86_64__ || defined _M_X64 )
|
||||
# define TRACY_HAS_RDTSC
|
||||
#elif defined _WIN32 && defined _M_ARM64
|
||||
# define TRACY_HAS_CNTVCT
|
||||
#elif defined __APPLE__ && defined __MACH__ && TARGET_CPU_ARM64 // For now only supported on Apple devices
|
||||
# define TRACY_HAS_CNTVCT
|
||||
#endif
|
||||
@@ -172,6 +174,27 @@ struct LuaZoneState
|
||||
typedef void(*ParameterCallback)( void* data, uint32_t idx, int32_t val );
|
||||
typedef char*(*SourceContentsCallback)( void* data, const char* filename, size_t& size );
|
||||
|
||||
#if defined _WIN32 && defined TRACY_HAS_CNTVCT
|
||||
// NOTE: implementing timestamp_win_arm64_cntvct_el0() requires ARM64_CNTVCT_EL0,
|
||||
// which in turn would require including "Windows.h" here... instead, just bring
|
||||
// what's needed from "winnt.h"
|
||||
# ifdef ARM64_CNTVCT_EL0
|
||||
# define TRACY_WINARM64_CNTVCT_EL0 ARM64_CNTVCT_EL0
|
||||
# else
|
||||
# define TRACY_WINARM64_SYSREG( op0, op1, crn, crm, op2 ) \
|
||||
( ( ( op0 & 1 ) << 14 ) | \
|
||||
( ( op1 & 7 ) << 11 ) | \
|
||||
( ( crn & 15 ) << 7 ) | \
|
||||
( ( crm & 15 ) << 3 ) | \
|
||||
( ( op2 & 7 ) << 0 ) )
|
||||
# define TRACY_WINARM64_CNTVCT_EL0 TRACY_WINARM64_SYSREG( 3, 3, 14, 0, 2 )
|
||||
# endif
|
||||
tracy_force_inline int64_t timestamp_win_arm64_cntvct_el0()
|
||||
{
|
||||
return _ReadStatusReg( TRACY_WINARM64_CNTVCT_EL0 );
|
||||
}
|
||||
#endif
|
||||
|
||||
class Profiler
|
||||
{
|
||||
struct FrameImageQueueItem
|
||||
@@ -227,7 +250,9 @@ public:
|
||||
# elif defined _WIN32
|
||||
# ifdef TRACY_TIMER_QPC
|
||||
return GetTimeQpc();
|
||||
# else
|
||||
# elif defined TRACY_HAS_CNTVCT
|
||||
return timestamp_win_arm64_cntvct_el0();
|
||||
# elif defined TRACY_HAS_RDTSC
|
||||
if( HardwareSupportsInvariantTSC() ) return int64_t( __rdtsc() );
|
||||
# endif
|
||||
# elif defined __i386 || defined _M_IX86
|
||||
|
||||
Reference in New Issue
Block a user