Skip to content

Commit 6f14623

Browse files
author
stgatilov
committed
#6253. Fixed all source code after recent third-party updates.
tracy: Tracy macros no longer contain semicolon, so we have to put it on our side. Tracy is now packaged a bit differently, so some directories has changed (also less tracy include dirs needed). Plots API has changed: for now I only retained the one mode I use for progress bars. ffmpeg: minor constness fix tdm_installer: I upgraded zipsync to use CONFIG mode of CMake's find_package. While it works perfectly with conan, our code does not support them, so we need to set ZIPSYNC_OPTION_THIRDPARTY_MODULE_MODE. Also define CURL_STATICLIB globally (not sure who defined it previously), but for TDM it is also defined in CMakeLists.txt. git-svn-id: http://svn.thedarkmod.com/svn/darkmod_src/trunk@10754 49c82d7f-2e2a-0410-a16f-ae8f201b507f
1 parent 9c80bc7 commit 6f14623

File tree

8 files changed

+27
-31
lines changed

8 files changed

+27
-31
lines changed

CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,6 @@ include_directories(
239239
"${PROJECT_SOURCE_DIR}/idlib"
240240
"${PROJECT_SOURCE_DIR}/ThirdParty/artefacts/doctest/include"
241241
"${PROJECT_SOURCE_DIR}/ThirdParty/artefacts/tracy/include"
242-
"${PROJECT_SOURCE_DIR}/ThirdParty/artefacts/tracy/include/common"
243-
"${PROJECT_SOURCE_DIR}/ThirdParty/artefacts/tracy/include/client"
244-
"${PROJECT_SOURCE_DIR}/ThirdParty/artefacts/tracy/include/libbacktrace"
245242
${zlib_INCLUDE_DIRS}
246243
${minizip_INCLUDE_DIRS}
247244
${CURL_INCLUDE_DIRS}

framework/Session.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2546,7 +2546,7 @@ void idSessionLocal::UpdateLoadingProgressBar( progressStage_t stage, float rati
25462546
globalRatio += StageWeights[s];
25472547
globalRatio += StageWeights[stage] * ratio;
25482548

2549-
TRACE_PLOT_FRACTION( "LoadingProgressBar", globalRatio );
2549+
TRACE_PLOT_SMOOTH_FRACTION( "LoadingProgressBar", globalRatio );
25502550

25512551
if ( stage == lastUpdateProgressBarStage && ratio == lastUpdateProgressBarRatio )
25522552
return; // exactly same as previous update

framework/Tracing.h

+18-20
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Project: The Dark Mod (http://www.thedarkmod.com/)
1616
#pragma once
1717

1818
#include "renderer/backend/qgl/qgl.h"
19-
#include <TracyOpenGL.hpp>
19+
#include <tracy/TracyOpenGL.hpp>
2020
#include <common/TracySystem.hpp>
2121

2222
extern idCVar r_useDebugGroups;
@@ -33,47 +33,45 @@ extern bool g_tracingAllocStacks;
3333
extern bool g_glTraceInitialized;
3434

3535
#define TRACE_THREAD_NAME( name ) if ( g_tracingEnabled ) tracy::SetThreadName( name );
36-
#define TRACE_PLOT_NUMBER( name, value ) if ( g_tracingEnabled ) { TracyPlot( name, value ); TracyPlotConfig( name, tracy::PlotFormatType::Number ); }
37-
#define TRACE_PLOT_BYTES( name, value ) if ( g_tracingEnabled ) { TracyPlot( name, value ); TracyPlotConfig( name, tracy::PlotFormatType::Memory ); }
38-
#define TRACE_PLOT_FRACTION( name, value ) if ( g_tracingEnabled ) { TracyPlot( name, value*100 ); TracyPlotConfig( name, tracy::PlotFormatType::Percentage ); }
36+
#define TRACE_PLOT_SMOOTH_FRACTION( name, value ) if ( g_tracingEnabled ) { TracyPlot( name, value*100 ); TracyPlotConfig( name, tracy::PlotFormatType::Percentage, true, true, 0 ); }
3937

4038
#define TRACE_COLOR_IDLE 0x808080
4139

4240
//zones/scopes to measure and display as interval task
43-
#define TRACE_CPU_SCOPE( section ) ZoneNamedN( __tracy_scoped_zone, section, g_tracingEnabled )
44-
#define TRACE_CPU_SCOPE_COLOR( section, color ) ZoneNamedNC( __tracy_scoped_zone, section, color, g_tracingEnabled )
41+
#define TRACE_CPU_SCOPE( section ) ZoneNamedN( __tracy_scoped_zone, section, g_tracingEnabled );
42+
#define TRACE_CPU_SCOPE_COLOR( section, color ) ZoneNamedNC( __tracy_scoped_zone, section, color, g_tracingEnabled );
4543

4644
//set text of the currently active zone (overwrite)
4745
#define TRACE_ATTACH_TEXT( text ) if ( g_tracingEnabled ) { \
4846
const char *__tmp_cstr = text; \
49-
ZoneTextV( __tracy_scoped_zone, __tmp_cstr, strlen(__tmp_cstr) ) \
47+
ZoneTextV( __tracy_scoped_zone, __tmp_cstr, strlen(__tmp_cstr) ); \
5048
}
5149
#define TRACE_ATTACH_STR( text ) if ( g_tracingEnabled ) { \
5250
const idStr &__tmp_str = text; \
53-
ZoneTextV( __tracy_scoped_zone, __tmp_str.c_str(), __tmp_str.Length() ) \
51+
ZoneTextV( __tracy_scoped_zone, __tmp_str.c_str(), __tmp_str.Length() ); \
5452
}
5553
#define TRACE_ATTACH_FORMAT( ... ) if ( g_tracingEnabled ) { \
5654
char __tracy_scoped_buffer[1024]; \
5755
int __tracy_scoped_len = idStr::snPrintf(__tracy_scoped_buffer, 1024, __VA_ARGS__); \
58-
ZoneTextV( __tracy_scoped_zone, __tracy_scoped_buffer, __tracy_scoped_len ) \
56+
ZoneTextV( __tracy_scoped_zone, __tracy_scoped_buffer, __tracy_scoped_len ); \
5957
}
6058

6159
//create zone with text attached immediately
6260
#define TRACE_CPU_SCOPE_TEXT( section, text_cstr ) \
63-
TRACE_CPU_SCOPE( section ) \
64-
TRACE_ATTACH_TEXT( text_cstr )
61+
TRACE_CPU_SCOPE( section ); \
62+
TRACE_ATTACH_TEXT( text_cstr );
6563
#define TRACE_CPU_SCOPE_STR( section, text_idstr ) \
66-
TRACE_CPU_SCOPE( section ) \
67-
TRACE_ATTACH_STR( text_idstr )
64+
TRACE_CPU_SCOPE( section ); \
65+
TRACE_ATTACH_STR( text_idstr );
6866
#define TRACE_CPU_SCOPE_FORMAT( section, ... ) \
69-
TRACE_CPU_SCOPE( section ) \
70-
TRACE_ATTACH_FORMAT( __VA_ARGS__ )
67+
TRACE_CPU_SCOPE( section ); \
68+
TRACE_ATTACH_FORMAT( __VA_ARGS__ );
7169

7270
//DSCOPE versions can have name generated at runtime
73-
#define TRACE_CPU_DSCOPE( section ) ZoneTransientN( __tracy_scoped_zone, section, g_tracingEnabled )
71+
#define TRACE_CPU_DSCOPE( section ) ZoneTransientN( __tracy_scoped_zone, section, g_tracingEnabled );
7472
#define TRACE_CPU_DSCOPE_TEXT( section, text_cstr ) \
75-
TRACE_CPU_DSCOPE( section ) \
76-
TRACE_ATTACH_TEXT( text_cstr )
73+
TRACE_CPU_DSCOPE( section ); \
74+
TRACE_ATTACH_TEXT( text_cstr );
7775

7876

7977
class GlDebugGroupScope {
@@ -89,5 +87,5 @@ class GlDebugGroupScope {
8987
}
9088
};
9189

92-
#define TRACE_GL_SCOPE( section ) GlDebugGroupScope __glDebugGroupCurentScope(section); TracyGpuNamedZone( __tracy_gpu_zone, section, g_tracingEnabled && g_glTraceInitialized );
93-
#define TRACE_GL_SCOPE_COLOR( section, color ) GlDebugGroupScope __glDebugGroupCurentScope(section); TracyGpuNamedZoneC( __tracy_gpu_zone, section, color, g_tracingEnabled && g_glTraceInitialized );
90+
#define TRACE_GL_SCOPE( section ) GlDebugGroupScope __glDebugGroupCurrentScope(section); TracyGpuNamedZone( __tracy_gpu_zone, section, g_tracingEnabled && g_glTraceInitialized );
91+
#define TRACE_GL_SCOPE_COLOR( section, color ) GlDebugGroupScope __glDebugGroupCurrentScope(section); TracyGpuNamedZoneC( __tracy_gpu_zone, section, color, g_tracingEnabled && g_glTraceInitialized );

idlib/Heap.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ bool g_tracingAllocStacks = false;
3131
//stgatilov: not very good in terms of code size, but hopefully it won't be a problem in one cpp file
3232
#define TRACY_MALLOC_REPORT(ptr, len) \
3333
if (g_tracingAllocStacks) { \
34-
TracySecureAllocS(ptr, len, 10) \
34+
TracySecureAllocS(ptr, len, 10); \
3535
} else { \
36-
TracySecureAlloc(ptr, len) \
36+
TracySecureAlloc(ptr, len); \
3737
}
3838
#define TRACY_FREE_ANNOUNCE(ptr) \
39-
TracySecureFree(ptr)
39+
TracySecureFree(ptr);
4040
#else
4141
#define TRACY_MALLOC_REPORT(ptr, len)
4242
#define TRACY_FREE_ANNOUNCE(ptr)

idlib/precompiled.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Project: The Dark Mod (http://www.thedarkmod.com/)
2626

2727
#undef min
2828
#undef max
29-
#include <Tracy.hpp>
29+
#include <tracy/Tracy.hpp>
3030

3131
#define ID_TIME_T time_t
3232

renderer/resources/CinematicFFMpeg.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ int idCinematicFFMpeg::OpenBestStreamOfType(AVMediaType type, AVCodecContext* &c
415415
LogPrintf("Stream %d is encoded with codec %d: %s", streamIndex, codecId, ExtLibs::avcodec_get_name(codecId));
416416
// find decoder for the stream
417417
TIMER_START(findDecoder);
418-
AVCodec* dec = ExtLibs::avcodec_find_decoder(codecId);
418+
const AVCodec* dec = ExtLibs::avcodec_find_decoder(codecId);
419419
if (!dec) {
420420
common->Warning("Failed to find %s:%s decoder\n", ExtLibs::av_get_media_type_string(type), ExtLibs::avcodec_get_name(codecId));
421421
return AVERROR(EINVAL);

sys/msvc/properties/_Common.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<PreprocessorDefinitions>WIN32;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_ALLOW_KEYWORD_MACROS;NO_WARN_MBCS_MFC_DEPRECATION;ExtLibs=;%(PreprocessorDefinitions)</PreprocessorDefinitions>
1515
<WarningLevel>Level4</WarningLevel>
1616
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
17-
<AdditionalIncludeDirectories>$(ThirdPartyDir)tracy\include;$(ThirdPartyDir)tracy\include\common;$(ThirdPartyDir)tracy\include\client;$(ThirdPartyDir)glfw\include;$(ThirdPartyDir)doctest\include;$(ThirdPartyDir)ffmpeg\include;$(ThirdPartyDir)libcurl\include;$(ThirdPartyDir)libjpeg\include;$(ThirdPartyDir)libpng\include;$(ThirdPartyDir)mbedtls\include;$(ThirdPartyDir)openal\include;$(ThirdPartyDir)ogg\include;$(ThirdPartyDir)vorbis\include;$(ThirdPartyDir)pugixml\include;$(ThirdPartyDir)zlib\include;$(ThirdPartyDir)minizip\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
17+
<AdditionalIncludeDirectories>$(ThirdPartyDir)tracy\include;$(ThirdPartyDir)glfw\include;$(ThirdPartyDir)doctest\include;$(ThirdPartyDir)ffmpeg\include;$(ThirdPartyDir)libcurl\include;$(ThirdPartyDir)libjpeg\include;$(ThirdPartyDir)libpng\include;$(ThirdPartyDir)mbedtls\include;$(ThirdPartyDir)openal\include;$(ThirdPartyDir)ogg\include;$(ThirdPartyDir)vorbis\include;$(ThirdPartyDir)pugixml\include;$(ThirdPartyDir)zlib\include;$(ThirdPartyDir)minizip\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
1818
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)\idlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
1919
<MinimalRebuild>false</MinimalRebuild>
2020
<DisableSpecificWarnings>4127;4458;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>

tdm_installer/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ if(TDM_INSTALLER_FAST_DEBUG AND MSVC)
1818
string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
1919
endif()
2020

21-
21+
add_compile_definitions(CURL_STATICLIB=1)
2222
set(ZIPSYNC_OPTION_BUILD_TESTS OFF CACHE BOOL "")
2323
set(ZIPSYNC_OPTION_BUILD_TOOL OFF CACHE BOOL "")
24+
set(ZIPSYNC_OPTION_THIRDPARTY_MODULE_MODE ON CACHE BOOL "")
2425
add_subdirectory(zipsync)
2526

2627
set(sources

0 commit comments

Comments
 (0)