mirror of
https://github.com/wolfpld/tracy.git
synced 2026-09-17 15:54:23 +00:00
better comments and messages
This commit is contained in:
@@ -20,7 +20,6 @@ project(gl_spinning_triangle LANGUAGES C CXX)
|
||||
# ---------------------------------------------------------------------------
|
||||
set(TRACY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../..")
|
||||
option(TRACY_ENABLE "Enable Tracy profiling" ON)
|
||||
option(TRACY_OPENGL_AUTO_CALIBRATION "Enable periodic GPU/CPU recalibration" ON)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Platform — RGFW (cross-platform windowing, fetched automatically)
|
||||
@@ -85,9 +84,6 @@ target_compile_features(gl_spinning_triangle PRIVATE cxx_std_17)
|
||||
if(TRACY_ENABLE)
|
||||
target_compile_definitions(gl_spinning_triangle PRIVATE TRACY_ENABLE)
|
||||
endif()
|
||||
if(TRACY_OPENGL_AUTO_CALIBRATION)
|
||||
target_compile_definitions(gl_spinning_triangle PRIVATE TRACY_OPENGL_AUTO_CALIBRATION)
|
||||
endif()
|
||||
|
||||
target_include_directories(gl_spinning_triangle PRIVATE
|
||||
"${TRACY_DIR}/public"
|
||||
|
||||
@@ -6,10 +6,6 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __APPLE__
|
||||
// OpenGL is only available on MacOS (no iOS support)
|
||||
// Anything from gl3.h will spew deprecation warnings when used,
|
||||
// unless GL_SILENCE_DEPRECATION has been defined beforehand
|
||||
//# define GL_SILENCE_DEPRECATION
|
||||
# include <OpenGL/gl3.h>
|
||||
#else
|
||||
# include <GL/glew.h>
|
||||
|
||||
@@ -1,14 +1,23 @@
|
||||
// spinning_triangle.cpp — OpenGL spinning triangle demo with Tracy GPU profiling.
|
||||
//
|
||||
// Tracy GPU zones are active on non-Apple platforms when TRACY_ENABLE is defined.
|
||||
// TRACY_OPENGL_AUTO_CALIBRATION (enabled by default in CMakeLists.txt) enables
|
||||
// periodic GPU/CPU drift correction via glGetInteger64v(GL_TIMESTAMP).
|
||||
|
||||
#include "platform/platform.h"
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
#ifdef __APPLE__
|
||||
// NOTE: OpenGL is only available on MacOS (no iOS support)
|
||||
// Including and using anything related to OpenGL on Apple (like <OpenGL/gl3.h>)
|
||||
// will emit deprecation warnings, unless GL_SILENCE_DEPRECATION is defined
|
||||
#define GL_SILENCE_DEPRECATION
|
||||
// NOTE: TracyOpenGL.hpp will not work as expected even on Apple devices that
|
||||
// support OpenGL, because the OpenGL drivers do not implement ARB_timer_query
|
||||
// properly (querying GL_TIMESTAMP always resolves to 0). TracyOpenGL.hpp will
|
||||
// emit a compiler warning, and a Tracy message to the trace/profiler, but the
|
||||
// program will still run.
|
||||
#endif
|
||||
|
||||
#include "platform/platform.h" // also includes OpenGL headers
|
||||
|
||||
#include <tracy/Tracy.hpp>
|
||||
|
||||
// NOTE: opt-in toggle for periodic recalibrations during Collect()
|
||||
#define TRACY_OPENGL_AUTO_CALIBRATION
|
||||
#include <tracy/TracyOpenGL.hpp>
|
||||
|
||||
static const int kWidth = 800;
|
||||
|
||||
Reference in New Issue
Block a user