diff --git a/renderdoc/android/android.cpp b/renderdoc/android/android.cpp index 40ae93f5b..c15b8c0de 100644 --- a/renderdoc/android/android.cpp +++ b/renderdoc/android/android.cpp @@ -25,6 +25,7 @@ #include "android.h" #include #include "api/replay/version.h" +#include "common/formatting.h" #include "core/core.h" #include "core/remote_server.h" #include "strings/string_utils.h" diff --git a/renderdoc/android/android_tools.cpp b/renderdoc/android/android_tools.cpp index 4bcc46a93..70071d955 100644 --- a/renderdoc/android/android_tools.cpp +++ b/renderdoc/android/android_tools.cpp @@ -22,6 +22,7 @@ * THE SOFTWARE. ******************************************************************************/ +#include "common/formatting.h" #include "core/core.h" #include "strings/string_utils.h" #include "android_utils.h" diff --git a/renderdoc/android/android_utils.cpp b/renderdoc/android/android_utils.cpp index 485fc4d6a..d00c797e9 100644 --- a/renderdoc/android/android_utils.cpp +++ b/renderdoc/android/android_utils.cpp @@ -24,6 +24,7 @@ #include "android_utils.h" #include +#include "common/formatting.h" #include "core/core.h" #include "strings/string_utils.h" diff --git a/renderdoc/android/jdwp.h b/renderdoc/android/jdwp.h index 0b4cc0cbe..25f1175f5 100644 --- a/renderdoc/android/jdwp.h +++ b/renderdoc/android/jdwp.h @@ -24,6 +24,7 @@ #pragma once +#include "api/replay/stringise.h" #include "serialise/streamio.h" namespace JDWP diff --git a/renderdoc/api/replay/capture_options.h b/renderdoc/api/replay/capture_options.h index e6e2175a5..5c7e21310 100644 --- a/renderdoc/api/replay/capture_options.h +++ b/renderdoc/api/replay/capture_options.h @@ -29,6 +29,8 @@ #include "rdcstr.h" #include "stringise.h" +typedef uint8_t byte; + // see renderdoc_app.h RENDERDOC_CaptureOption - make sure any changes here are reflected there, to // the options or to the documentation DOCUMENT(R"(Sets up configuration and options for optional features either at capture time or at API diff --git a/renderdoc/api/replay/data_types.h b/renderdoc/api/replay/data_types.h index 5e1232163..1df860784 100644 --- a/renderdoc/api/replay/data_types.h +++ b/renderdoc/api/replay/data_types.h @@ -26,6 +26,7 @@ #pragma once #include "apidefs.h" +#include "rdcarray.h" #include "replay_enums.h" #include "resourceid.h" #include "stringise.h" diff --git a/renderdoc/api/replay/replay_enums.h b/renderdoc/api/replay/replay_enums.h index 0971da78f..741b569d7 100644 --- a/renderdoc/api/replay/replay_enums.h +++ b/renderdoc/api/replay/replay_enums.h @@ -3445,6 +3445,11 @@ enum class EnvSep : uint32_t DECLARE_REFLECTION_ENUM(EnvSep); +// see comment in common.h +#if !defined(LOGTYPE_DEFINED) + +#define LOGTYPE_DEFINED + DOCUMENT(R"(The type of a log message .. data:: Debug @@ -3467,7 +3472,7 @@ DOCUMENT(R"(The type of a log message The log message indicates a fatal error occurred which is impossible to recover from. )"); -enum class LogType : int32_t +enum class LogType : uint32_t { Debug, First = Debug, @@ -3478,6 +3483,10 @@ enum class LogType : int32_t Count, }; +#endif + +// this is OUTSIDE the #endif because we don't declare these in common.h, so in case they're needed +// we define them here DECLARE_REFLECTION_ENUM(LogType); ITERABLE_OPERATORS(LogType); @@ -3504,7 +3513,7 @@ DOCUMENT(R"(The level of optimisation used in This could result in side-effects like data from one replay being visible early in another replay, if it's known that the data will be overwritten before being used. )"); -enum class ReplayOptimisationLevel : int32_t +enum class ReplayOptimisationLevel : uint32_t { NoOptimisation, First = NoOptimisation, diff --git a/renderdoc/common/common.cpp b/renderdoc/common/common.cpp index 82749b93f..0915423c2 100644 --- a/renderdoc/common/common.cpp +++ b/renderdoc/common/common.cpp @@ -79,8 +79,8 @@ float SRGB8_lookuptable[256] = { void rdcassert(const char *msg, const char *file, unsigned int line, const char *func) { - rdclog_direct(Timing::GetUTCTime(), Process::GetCurrentPID(), LogType::Error, RDCLOG_PROJECT, - file, line, "Assertion failed: %s", msg); + rdclog_direct(FILL_AUTO_VALUE, FILL_AUTO_VALUE, LogType::Error, RDCLOG_PROJECT, file, line, + "Assertion failed: %s", msg); } #if 0 @@ -389,6 +389,14 @@ static void write_newline(char *output) void rdclog_direct(time_t utcTime, uint32_t pid, LogType type, const char *project, const char *file, unsigned int line, const char *fmt, ...) { + if(utcTime == FILL_AUTO_VALUE) + utcTime = Timing::GetUTCTime(); + + static uint32_t curpid = Process::GetCurrentPID(); + + if(pid == FILL_AUTO_VALUE) + pid = curpid; + va_list args; va_start(args, fmt); diff --git a/renderdoc/common/common.h b/renderdoc/common/common.h index caf792e8e..8474027ec 100644 --- a/renderdoc/common/common.h +++ b/renderdoc/common/common.h @@ -25,12 +25,46 @@ #pragma once -#include #include -#include -#include "api/replay/renderdoc_replay.h" +#include #include "globalconfig.h" +// we allow a small amount of leakage from OS-specific to avoid including os_specific.h which is +// heavier than we need. These are macros so can't be declared and then later defined, and are +// fortunately not too messy as it's basically windows vs. everyone else. +#if ENABLED(RDOC_WIN32) + +#define __PRETTY_FUNCTION_SIGNATURE__ __FUNCSIG__ +#define OS_DEBUG_BREAK() __debugbreak() + +#else + +#include + +#define __PRETTY_FUNCTION_SIGNATURE__ __PRETTY_FUNCTION__ +#define OS_DEBUG_BREAK() raise(SIGTRAP) + +#if defined(__clang__) + +#define DELIBERATE_FALLTHROUGH() [[clang::fallthrough]] + +#elif defined(__GNUC__) && (__GNUC__ >= 7) + +// works on GCC 7.0 and up. Before then there was no warning, so we're fine +#define DELIBERATE_FALLTHROUGH() __attribute__((fallthrough)) + +#endif + +#endif + +// pre-declare some OS-specific functions we need to reference in the header here. + +namespace OSUtility +{ +void ForceCrash(); +bool DebuggerPresent(); +}; + ///////////////////////////////////////////////// // Utility macros @@ -99,8 +133,6 @@ #define CONCAT2(a, b) a##b #define CONCAT(a, b) CONCAT2(a, b) -#include "os/os_specific.h" - #define RDCEraseMem(a, b) memset(a, 0, b) #define RDCEraseEl(a) memset(&a, 0, sizeof(a)) @@ -158,6 +190,8 @@ inline T AlignUpPtr(T x, A a) bool FindDiffRange(void *a, void *b, size_t bufSize, size_t &diffStart, size_t &diffEnd); uint32_t CalcNumMips(int Width, int Height, int Depth); +typedef uint8_t byte; + byte *AllocAlignedBuffer(uint64_t size, uint64_t alignment = 64); void FreeAlignedBuffer(byte *buf); @@ -178,42 +212,16 @@ inline size_t Log2Floor(size_t value) } #endif -template -struct BucketForRecord -{ - static size_t Get(size_t value); -}; - -template -struct BucketForRecord -{ - static size_t Get(size_t value) - { - const size_t size = T::BucketSize; - const size_t count = T::BucketCount; - const size_t maximum = size * count; - const size_t index = (value < maximum) ? (value / size) : (count - 1); - return index; - } -}; - -template -struct BucketForRecord -{ - static size_t Get(size_t value) - { - const size_t count = T::BucketCount; - static_assert(count <= (sizeof(size_t) * 8), - "Unexpected correspondence between bucket size and sizeof(size_t)"); - const size_t maximum = (size_t)1 << count; - const size_t index = (value < maximum) ? (size_t)(Log2Floor(value)) : (count - 1); - return index; - } -}; - ///////////////////////////////////////////////// // Debugging features +#if !defined(DELIBERATE_FALLTHROUGH) +#define DELIBERATE_FALLTHROUGH() \ + do \ + { \ + } while(0) +#endif + #define RDCDUMP() \ do \ { \ @@ -287,6 +295,36 @@ struct BucketForRecord // perform any operations necessary to flush the log void rdclog_flush(); +// we want to use the same log enum publicly and privately but we can't redefine the enum. So we let +// each header define it depending on which comes first (since we don't necessarily know if the +// other will be included after). Each defines LOGTYPE_DEFINED when it defines the enum, and uses +// that to gate definition. +// +// The public header just skips the definition entirely, the internal header also declares it as +// LogType__Internal so that we can assert that they're the same. +#if !defined(LOGTYPE_DEFINED) + +#define LOGTYPE_DEFINED +#define LOGTYPE_ENUM_NAME LogType + +#else + +#define LOGTYPE_ENUM_NAME LogType__Internal + +#endif + +// must match the definition in replay_enums.h +enum class LOGTYPE_ENUM_NAME : uint32_t +{ + Debug, + First = Debug, + Comment, + Warning, + Error, + Fatal, + Count, +}; + // actual low-level print to log output streams defined (useful for if we need to print // fatal error messages from within the more complex log function). void rdclogprint_int(LogType type, const char *fullMsg, const char *msg); @@ -299,8 +337,10 @@ void rdclogprint_int(LogType type, const char *fullMsg, const char *msg); void rdclog_direct(time_t utcTime, uint32_t pid, LogType type, const char *project, const char *file, unsigned int line, const char *fmt, ...); -#define rdclog(type, ...) \ - rdclog_direct(Timing::GetUTCTime(), Process::GetCurrentPID(), type, RDCLOG_PROJECT, __FILE__, \ +#define FILL_AUTO_VALUE 0x10203040 + +#define rdclog(type, ...) \ + rdclog_direct(time_t(FILL_AUTO_VALUE), FILL_AUTO_VALUE, type, RDCLOG_PROJECT, __FILE__, \ __LINE__, __VA_ARGS__) const char *rdclog_getfilename(); diff --git a/renderdoc/common/dds_readwrite.cpp b/renderdoc/common/dds_readwrite.cpp index 8691c8226..2cd55272b 100644 --- a/renderdoc/common/dds_readwrite.cpp +++ b/renderdoc/common/dds_readwrite.cpp @@ -25,6 +25,7 @@ #include "dds_readwrite.h" #include #include "common/common.h" +#include "os/os_specific.h" static const uint32_t dds_fourcc = MAKE_FOURCC('D', 'D', 'S', ' '); diff --git a/renderdoc/common/formatting.h b/renderdoc/common/formatting.h new file mode 100644 index 000000000..293d77aa0 --- /dev/null +++ b/renderdoc/common/formatting.h @@ -0,0 +1,32 @@ +/****************************************************************************** + * The MIT License (MIT) + * + * Copyright (c) 2019 Baldur Karlsson + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + ******************************************************************************/ + +#pragma once + +#include "api/replay/rdcstr.h" + +namespace StringFormat +{ +rdcstr Fmt(const char *format, ...); +}; diff --git a/renderdoc/common/threading.h b/renderdoc/common/threading.h index af2147278..cf89b2267 100644 --- a/renderdoc/common/threading.h +++ b/renderdoc/common/threading.h @@ -25,6 +25,7 @@ #pragma once +#include "common/common.h" #include "os/os_specific.h" namespace Threading diff --git a/renderdoc/common/timing.h b/renderdoc/common/timing.h index bb9d2462d..6d4d87478 100644 --- a/renderdoc/common/timing.h +++ b/renderdoc/common/timing.h @@ -123,9 +123,8 @@ public: ~ScopedTimer() { - rdclog_direct(Timing::GetUTCTime(), Process::GetCurrentPID(), LogType::Comment, RDCLOG_PROJECT, - m_File, m_Line, "Timer %s - %.3lf ms", m_Message.c_str(), - m_Timer.GetMilliseconds()); + rdclog_direct(FILL_AUTO_VALUE, FILL_AUTO_VALUE, LogType::Comment, RDCLOG_PROJECT, m_File, + m_Line, "Timer %s - %.3lf ms", m_Message.c_str(), m_Timer.GetMilliseconds()); } private: diff --git a/renderdoc/core/image_viewer.cpp b/renderdoc/core/image_viewer.cpp index 7d1786d3f..c62fa73e6 100644 --- a/renderdoc/core/image_viewer.cpp +++ b/renderdoc/core/image_viewer.cpp @@ -215,17 +215,14 @@ public: std::vector GetUsage(ResourceId id) { return std::vector(); } bool IsRenderOutput(ResourceId id) { return false; } ResourceId GetLiveID(ResourceId id) { return id; } - std::vector EnumerateCounters() { return std::vector(); } + rdcarray EnumerateCounters() { return {}; } CounterDescription DescribeCounter(GPUCounter counterID) { CounterDescription desc = {}; desc.counter = counterID; return desc; } - std::vector FetchCounters(const std::vector &counters) - { - return std::vector(); - } + rdcarray FetchCounters(const rdcarray &counters) { return {}; } void FillCBufferVariables(ResourceId pipeline, ResourceId shader, std::string entryPoint, uint32_t cbufSlot, rdcarray &outvars, const bytebuf &data) { diff --git a/renderdoc/core/precompiled.h b/renderdoc/core/precompiled.h index 5558a29b4..5a024245a 100644 --- a/renderdoc/core/precompiled.h +++ b/renderdoc/core/precompiled.h @@ -27,3 +27,4 @@ #include "api/app/renderdoc_app.h" #include "api/replay/renderdoc_replay.h" #include "common/common.h" +#include "os/os_specific.h" diff --git a/renderdoc/core/replay_proxy.cpp b/renderdoc/core/replay_proxy.cpp index 7bec518cc..1db0afab9 100644 --- a/renderdoc/core/replay_proxy.cpp +++ b/renderdoc/core/replay_proxy.cpp @@ -671,13 +671,13 @@ ResourceId ReplayProxy::GetLiveID(ResourceId id) } template -std::vector ReplayProxy::Proxied_FetchCounters(ParamSerialiser ¶mser, - ReturnSerialiser &retser, - const std::vector &counters) +rdcarray ReplayProxy::Proxied_FetchCounters(ParamSerialiser ¶mser, + ReturnSerialiser &retser, + const rdcarray &counters) { const ReplayProxyPacket expectedPacket = eReplayProxy_FetchCounters; ReplayProxyPacket packet = eReplayProxy_FetchCounters; - std::vector ret; + rdcarray ret; { BEGIN_PARAMS(); @@ -696,18 +696,18 @@ std::vector ReplayProxy::Proxied_FetchCounters(ParamSerialiser &p return ret; } -std::vector ReplayProxy::FetchCounters(const std::vector &counters) +rdcarray ReplayProxy::FetchCounters(const rdcarray &counters) { PROXY_FUNCTION(FetchCounters, counters); } template -std::vector ReplayProxy::Proxied_EnumerateCounters(ParamSerialiser ¶mser, - ReturnSerialiser &retser) +rdcarray ReplayProxy::Proxied_EnumerateCounters(ParamSerialiser ¶mser, + ReturnSerialiser &retser) { const ReplayProxyPacket expectedPacket = eReplayProxy_EnumerateCounters; ReplayProxyPacket packet = eReplayProxy_EnumerateCounters; - std::vector ret; + rdcarray ret; { BEGIN_PARAMS(); @@ -725,7 +725,7 @@ std::vector ReplayProxy::Proxied_EnumerateCounters(ParamSerialiser & return ret; } -std::vector ReplayProxy::EnumerateCounters() +rdcarray ReplayProxy::EnumerateCounters() { PROXY_FUNCTION(EnumerateCounters); } diff --git a/renderdoc/core/replay_proxy.h b/renderdoc/core/replay_proxy.h index 0c0ae892b..851ce872e 100644 --- a/renderdoc/core/replay_proxy.h +++ b/renderdoc/core/replay_proxy.h @@ -487,10 +487,10 @@ public: IMPLEMENT_FUNCTION_PROXIED(ResourceId, GetLiveID, ResourceId id); - IMPLEMENT_FUNCTION_PROXIED(std::vector, EnumerateCounters); + IMPLEMENT_FUNCTION_PROXIED(rdcarray, EnumerateCounters); IMPLEMENT_FUNCTION_PROXIED(CounterDescription, DescribeCounter, GPUCounter counterID); - IMPLEMENT_FUNCTION_PROXIED(std::vector, FetchCounters, - const std::vector &counterID); + IMPLEMENT_FUNCTION_PROXIED(rdcarray, FetchCounters, + const rdcarray &counterID); IMPLEMENT_FUNCTION_PROXIED(void, FillCBufferVariables, ResourceId pipeline, ResourceId shader, std::string entryPoint, uint32_t cbufSlot, diff --git a/renderdoc/data/embedded_files.h b/renderdoc/data/embedded_files.h index 4c4ad0f3b..c5b515e1b 100644 --- a/renderdoc/data/embedded_files.h +++ b/renderdoc/data/embedded_files.h @@ -25,7 +25,10 @@ #pragma once -#include "common/common.h" +#if !defined(CONCAT) +#define CONCAT2(a, b) a##b +#define CONCAT(a, b) CONCAT2(a, b) +#endif #define DECLARE_EMBED(filename) \ extern unsigned char CONCAT(data_, filename)[]; \ diff --git a/renderdoc/data/glsl_shaders.cpp b/renderdoc/data/glsl_shaders.cpp index 7b3108831..320189a01 100644 --- a/renderdoc/data/glsl_shaders.cpp +++ b/renderdoc/data/glsl_shaders.cpp @@ -25,7 +25,9 @@ #include "glsl_shaders.h" #include "3rdparty/glslang/glslang/Public/ShaderLang.h" #include "common/common.h" +#include "common/formatting.h" #include "driver/shaders/spirv/glslang_compile.h" +#include "os/os_specific.h" #define GLSL_HEADERS(HEADER) \ HEADER(glsl_globals) \ diff --git a/renderdoc/driver/d3d11/d3d11_counters.cpp b/renderdoc/driver/d3d11/d3d11_counters.cpp index 4425a92be..456aab6dd 100644 --- a/renderdoc/driver/d3d11/d3d11_counters.cpp +++ b/renderdoc/driver/d3d11/d3d11_counters.cpp @@ -32,9 +32,9 @@ #include "d3d11_debug.h" #include "d3d11_device.h" -std::vector D3D11Replay::EnumerateCounters() +rdcarray D3D11Replay::EnumerateCounters() { - std::vector ret; + rdcarray ret; ret.push_back(GPUCounter::EventGPUDuration); ret.push_back(GPUCounter::InputVerticesRead); @@ -52,20 +52,17 @@ std::vector D3D11Replay::EnumerateCounters() if(m_pAMDCounters) { - std::vector amdCounters = m_pAMDCounters->GetPublicCounterIds(); - ret.insert(ret.end(), amdCounters.begin(), amdCounters.end()); + ret.append(m_pAMDCounters->GetPublicCounterIds()); } if(m_pNVCounters) { - std::vector nvCounters = m_pNVCounters->GetPublicCounterIds(); - ret.insert(ret.end(), nvCounters.begin(), nvCounters.end()); + ret.append(m_pNVCounters->GetPublicCounterIds()); } if(m_pIntelCounters) { - std::vector intelCounters = m_pIntelCounters->GetPublicCounterIds(); - ret.insert(ret.end(), intelCounters.begin(), intelCounters.end()); + ret.append(m_pIntelCounters->GetPublicCounterIds()); } return ret; @@ -231,7 +228,7 @@ struct GPUTimer struct D3D11CounterContext { uint32_t eventStart; - std::vector timers; + rdcarray timers; }; void D3D11Replay::FillTimers(D3D11CounterContext &ctx, const DrawcallDescription &drawnode) @@ -333,7 +330,7 @@ void D3D11Replay::SerializeImmediateContext() } void D3D11Replay::FillTimersAMD(uint32_t &eventStartID, uint32_t &sampleIndex, - std::vector &eventIDs, const DrawcallDescription &drawnode) + rdcarray &eventIDs, const DrawcallDescription &drawnode) { if(drawnode.children.empty()) return; @@ -365,7 +362,7 @@ void D3D11Replay::FillTimersAMD(uint32_t &eventStartID, uint32_t &sampleIndex, } void D3D11Replay::FillTimersNV(uint32_t &eventStartID, uint32_t &sampleIndex, - std::vector &eventIDs, const DrawcallDescription &drawnode) + rdcarray &eventIDs, const DrawcallDescription &drawnode) { if(drawnode.children.empty()) return; @@ -400,8 +397,7 @@ void D3D11Replay::FillTimersNV(uint32_t &eventStartID, uint32_t &sampleIndex, } void D3D11Replay::FillTimersIntel(uint32_t &eventStartID, uint32_t &sampleIndex, - std::vector &eventIDs, - const DrawcallDescription &drawnode) + rdcarray &eventIDs, const DrawcallDescription &drawnode) { if(drawnode.children.empty()) return; @@ -435,13 +431,13 @@ void D3D11Replay::FillTimersIntel(uint32_t &eventStartID, uint32_t &sampleIndex, } } -std::vector D3D11Replay::FetchCountersAMD(const std::vector &counters) +rdcarray D3D11Replay::FetchCountersAMD(const rdcarray &counters) { ID3D11Device *d3dDevice = m_pDevice->GetReal(); if(!m_pAMDCounters->BeginMeasurementMode(AMDCounters::ApiType::Dx11, (void *)d3dDevice)) { - return std::vector(); + return rdcarray(); } uint32_t sessionID = m_pAMDCounters->CreateSession(); @@ -462,7 +458,7 @@ std::vector D3D11Replay::FetchCountersAMD(const std::vector eventIDs; + rdcarray eventIDs; for(uint32_t p = 0; p < passCount; p++) { @@ -481,7 +477,7 @@ std::vector D3D11Replay::FetchCountersAMD(const std::vectorEndSesssion(sessionID); - std::vector ret = + rdcarray ret = m_pAMDCounters->GetCounterData(sessionID, sampleIndex, eventIDs, counters); m_pAMDCounters->EndMeasurementMode(); @@ -489,14 +485,14 @@ std::vector D3D11Replay::FetchCountersAMD(const std::vector D3D11Replay::FetchCountersNV(const std::vector &counters) +rdcarray D3D11Replay::FetchCountersNV(const rdcarray &counters) { const FrameRecord &frameRecord = m_pDevice->GetFrameRecord(); const FrameStatistics &frameStats = frameRecord.frameInfo.stats; const uint32_t objectsCount = frameStats.draws.calls + frameStats.dispatches.calls + 1; - std::vector ret; + rdcarray ret; if(m_pNVCounters->PrepareExperiment(counters, objectsCount)) { @@ -504,7 +500,7 @@ std::vector D3D11Replay::FetchCountersNV(const std::vectorBeginExperiment(); uint32_t sampleIndex = 0; - std::vector eventIDs; + rdcarray eventIDs; for(uint32_t passIdx = 0; passIdx < passCount; ++passIdx) { @@ -524,7 +520,7 @@ std::vector D3D11Replay::FetchCountersNV(const std::vector D3D11Replay::FetchCountersIntel(const std::vector &counters) +rdcarray D3D11Replay::FetchCountersIntel(const rdcarray &counters) { m_pIntelCounters->DisableAllCounters(); @@ -543,7 +539,7 @@ std::vector D3D11Replay::FetchCountersIntel(const std::vector eventIDs; + rdcarray eventIDs; for(uint32_t p = 0; p < passCount; p++) { @@ -563,9 +559,9 @@ std::vector D3D11Replay::FetchCountersIntel(const std::vectorGetCounterData(eventIDs, counters); } -std::vector D3D11Replay::FetchCounters(const std::vector &counters) +rdcarray D3D11Replay::FetchCounters(const rdcarray &counters) { - std::vector ret; + rdcarray ret; if(counters.empty()) { @@ -575,14 +571,14 @@ std::vector D3D11Replay::FetchCounters(const std::vector d3dCounters; + rdcarray d3dCounters; std::copy_if(counters.begin(), counters.end(), std::back_inserter(d3dCounters), [](const GPUCounter &c) { return IsGenericCounter(c); }); if(m_pAMDCounters) { // Filter out the AMD counters - std::vector amdCounters; + rdcarray amdCounters; std::copy_if(counters.begin(), counters.end(), std::back_inserter(amdCounters), [](const GPUCounter &c) { return IsAMDCounter(c); }); @@ -595,7 +591,7 @@ std::vector D3D11Replay::FetchCounters(const std::vector nvCounters; + rdcarray nvCounters; std::copy_if(counters.begin(), counters.end(), std::back_inserter(nvCounters), [](const GPUCounter &c) { return IsNvidiaCounter(c); }); @@ -607,7 +603,7 @@ std::vector D3D11Replay::FetchCounters(const std::vector intelCounters; + rdcarray intelCounters; std::copy_if(counters.begin(), counters.end(), std::back_inserter(intelCounters), [](const GPUCounter &c) { return IsIntelCounter(c); }); diff --git a/renderdoc/driver/d3d11/d3d11_replay.h b/renderdoc/driver/d3d11/d3d11_replay.h index 15e750d49..2088e9ff4 100644 --- a/renderdoc/driver/d3d11/d3d11_replay.h +++ b/renderdoc/driver/d3d11/d3d11_replay.h @@ -206,9 +206,9 @@ public: void ReplaceResource(ResourceId from, ResourceId to); void RemoveReplacement(ResourceId id); - std::vector EnumerateCounters(); + rdcarray EnumerateCounters(); CounterDescription DescribeCounter(GPUCounter counterID); - std::vector FetchCounters(const std::vector &counters); + rdcarray FetchCounters(const rdcarray &counters); ResourceId CreateProxyTexture(const TextureDescription &templateTex); void SetProxyTextureData(ResourceId texid, const Subresource &sub, byte *data, size_t dataSize); @@ -272,17 +272,17 @@ private: void CreateSOBuffers(); void ShutdownStreamOut(); - std::vector FetchCountersAMD(const std::vector &counters); - std::vector FetchCountersNV(const std::vector &counters); - std::vector FetchCountersIntel(const std::vector &counters); + rdcarray FetchCountersAMD(const rdcarray &counters); + rdcarray FetchCountersNV(const rdcarray &counters); + rdcarray FetchCountersIntel(const rdcarray &counters); void FillTimers(D3D11CounterContext &ctx, const DrawcallDescription &drawnode); - void FillTimersAMD(uint32_t &eventStartID, uint32_t &sampleIndex, std::vector &eventIDs, + void FillTimersAMD(uint32_t &eventStartID, uint32_t &sampleIndex, rdcarray &eventIDs, const DrawcallDescription &drawnode); - void FillTimersNV(uint32_t &eventStartID, uint32_t &sampleIndex, std::vector &eventIDs, + void FillTimersNV(uint32_t &eventStartID, uint32_t &sampleIndex, rdcarray &eventIDs, const DrawcallDescription &drawnode); - void FillTimersIntel(uint32_t &eventStartID, uint32_t &sampleIndex, - std::vector &eventIDs, const DrawcallDescription &drawnode); + void FillTimersIntel(uint32_t &eventStartID, uint32_t &sampleIndex, rdcarray &eventIDs, + const DrawcallDescription &drawnode); void SerializeImmediateContext(); diff --git a/renderdoc/driver/d3d11/precompiled.h b/renderdoc/driver/d3d11/precompiled.h index 4ef36dbe9..0c5970f8f 100644 --- a/renderdoc/driver/d3d11/precompiled.h +++ b/renderdoc/driver/d3d11/precompiled.h @@ -27,5 +27,6 @@ #include "api/app/renderdoc_app.h" #include "api/replay/renderdoc_replay.h" #include "common/common.h" +#include "os/os_specific.h" #include "d3d11_common.h" diff --git a/renderdoc/driver/d3d12/d3d12_counters.cpp b/renderdoc/driver/d3d12/d3d12_counters.cpp index 952bd03ff..ddfc4e001 100644 --- a/renderdoc/driver/d3d12/d3d12_counters.cpp +++ b/renderdoc/driver/d3d12/d3d12_counters.cpp @@ -30,9 +30,9 @@ #include "d3d12_common.h" #include "d3d12_device.h" -std::vector D3D12Replay::EnumerateCounters() +rdcarray D3D12Replay::EnumerateCounters() { - std::vector ret; + rdcarray ret; ret.push_back(GPUCounter::EventGPUDuration); ret.push_back(GPUCounter::InputVerticesRead); @@ -50,8 +50,7 @@ std::vector D3D12Replay::EnumerateCounters() if(m_pAMDCounters) { - std::vector amdCounters = m_pAMDCounters->GetPublicCounterIds(); - ret.insert(ret.end(), amdCounters.begin(), amdCounters.end()); + ret.append(m_pAMDCounters->GetPublicCounterIds()); } return ret; @@ -191,7 +190,7 @@ CounterDescription D3D12Replay::DescribeCounter(GPUCounter counterID) struct D3D12AMDDrawCallback : public D3D12DrawcallCallback { D3D12AMDDrawCallback(WrappedID3D12Device *dev, D3D12Replay *rp, uint32_t &sampleIndex, - std::vector &eventIDs) + rdcarray &eventIDs) : m_pDevice(dev), m_pReplay(rp), m_pSampleId(&sampleIndex), m_pEventIds(&eventIDs) { m_pDevice->GetQueue()->GetCommandData()->m_DrawcallCallback = this; @@ -261,18 +260,18 @@ struct D3D12AMDDrawCallback : public D3D12DrawcallCallback uint32_t *m_pSampleId; WrappedID3D12Device *m_pDevice; D3D12Replay *m_pReplay; - std::vector *m_pEventIds; + rdcarray *m_pEventIds; std::set m_begunCommandLists; // events which are the 'same' from being the same command buffer resubmitted // multiple times in the frame. We will only get the full callback when we're // recording the command buffer, and will be given the first EID. After that // we'll just be told which other EIDs alias this event. - std::vector > m_AliasEvents; + rdcarray > m_AliasEvents; }; void D3D12Replay::FillTimersAMD(uint32_t *eventStartID, uint32_t *sampleIndex, - std::vector *eventIDs) + rdcarray *eventIDs) { uint32_t maxEID = m_pDevice->GetQueue()->GetMaxEID(); @@ -282,13 +281,13 @@ void D3D12Replay::FillTimersAMD(uint32_t *eventStartID, uint32_t *sampleIndex, m_pDevice->ReplayLog(*eventStartID, maxEID, eReplay_Full); } -std::vector D3D12Replay::FetchCountersAMD(const std::vector &counters) +rdcarray D3D12Replay::FetchCountersAMD(const rdcarray &counters) { ID3D12Device *d3dDevice = m_pDevice->GetReal(); if(!m_pAMDCounters->BeginMeasurementMode(AMDCounters::ApiType::Dx12, (void *)d3dDevice)) { - return std::vector(); + return rdcarray(); } uint32_t sessionID = m_pAMDCounters->CreateSession(); @@ -309,7 +308,7 @@ std::vector D3D12Replay::FetchCountersAMD(const std::vector eventIDs; + rdcarray eventIDs; for(uint32_t i = 0; i < passCount; i++) { @@ -328,7 +327,7 @@ std::vector D3D12Replay::FetchCountersAMD(const std::vectorEndSesssion(sessionID); - std::vector ret = + rdcarray ret = m_pAMDCounters->GetCounterData(sessionID, sampleIndex, eventIDs, counters); for(size_t i = 0; i < m_pAMDDrawCallback->m_AliasEvents.size(); i++) @@ -427,7 +426,7 @@ struct D3D12GPUTimerCallback : public D3D12DrawcallCallback ID3D12QueryHeap *m_TimerQueryHeap; ID3D12QueryHeap *m_PipeStatsQueryHeap; ID3D12QueryHeap *m_OcclusionQueryHeap; - std::vector > m_Results; + rdcarray > m_Results; uint32_t m_NumStatsQueries; uint32_t m_NumTimestampQueries; @@ -436,14 +435,14 @@ struct D3D12GPUTimerCallback : public D3D12DrawcallCallback // multiple times in the frame. We will only get the full callback when we're // recording the command buffer, and will be given the first EID. After that // we'll just be told which other EIDs alias this event. - std::vector > m_AliasEvents; + rdcarray > m_AliasEvents; }; -std::vector D3D12Replay::FetchCounters(const std::vector &counters) +rdcarray D3D12Replay::FetchCounters(const rdcarray &counters) { uint32_t maxEID = m_pDevice->GetQueue()->GetMaxEID(); - std::vector ret; + rdcarray ret; if(counters.empty()) { RDCERR("No counters specified to FetchCounters"); @@ -452,14 +451,14 @@ std::vector D3D12Replay::FetchCounters(const std::vector d3dCounters; + rdcarray d3dCounters; std::copy_if(counters.begin(), counters.end(), std::back_inserter(d3dCounters), [](const GPUCounter &c) { return !IsAMDCounter(c); }); if(m_pAMDCounters) { // Filter out the AMD counters - std::vector amdCounters; + rdcarray amdCounters; std::copy_if(counters.begin(), counters.end(), std::back_inserter(amdCounters), [](const GPUCounter &c) { return IsAMDCounter(c); }); diff --git a/renderdoc/driver/d3d12/d3d12_replay.h b/renderdoc/driver/d3d12/d3d12_replay.h index 3946f269b..4dbd3bf94 100644 --- a/renderdoc/driver/d3d12/d3d12_replay.h +++ b/renderdoc/driver/d3d12/d3d12_replay.h @@ -161,9 +161,9 @@ public: void ReplaceResource(ResourceId from, ResourceId to); void RemoveReplacement(ResourceId id); - std::vector EnumerateCounters(); + rdcarray EnumerateCounters(); CounterDescription DescribeCounter(GPUCounter counterID); - std::vector FetchCounters(const std::vector &counters); + rdcarray FetchCounters(const rdcarray &counters); ResourceId CreateProxyTexture(const TextureDescription &templateTex); void SetProxyTextureData(ResourceId texid, const Subresource &sub, byte *data, size_t dataSize); @@ -435,7 +435,7 @@ private: D3D12AMDDrawCallback *m_pAMDDrawCallback = NULL; - void FillTimersAMD(uint32_t *eventStartID, uint32_t *sampleIndex, std::vector *eventIDs); + void FillTimersAMD(uint32_t *eventStartID, uint32_t *sampleIndex, rdcarray *eventIDs); - std::vector FetchCountersAMD(const std::vector &counters); + rdcarray FetchCountersAMD(const rdcarray &counters); }; diff --git a/renderdoc/driver/d3d12/precompiled.h b/renderdoc/driver/d3d12/precompiled.h index a04f4f693..b36fb7690 100644 --- a/renderdoc/driver/d3d12/precompiled.h +++ b/renderdoc/driver/d3d12/precompiled.h @@ -27,5 +27,6 @@ #include "api/app/renderdoc_app.h" #include "api/replay/renderdoc_replay.h" #include "common/common.h" +#include "os/os_specific.h" #include "d3d12_common.h" diff --git a/renderdoc/driver/d3d8/precompiled.h b/renderdoc/driver/d3d8/precompiled.h index dd123c85f..e2aa20ca3 100644 --- a/renderdoc/driver/d3d8/precompiled.h +++ b/renderdoc/driver/d3d8/precompiled.h @@ -27,5 +27,6 @@ #include "api/app/renderdoc_app.h" #include "api/replay/renderdoc_replay.h" #include "common/common.h" +#include "os/os_specific.h" #include "d3d8_common.h" diff --git a/renderdoc/driver/d3d9/precompiled.h b/renderdoc/driver/d3d9/precompiled.h index 65b036a8c..dac18fbb0 100644 --- a/renderdoc/driver/d3d9/precompiled.h +++ b/renderdoc/driver/d3d9/precompiled.h @@ -27,5 +27,6 @@ #include "api/app/renderdoc_app.h" #include "api/replay/renderdoc_replay.h" #include "common/common.h" +#include "os/os_specific.h" #include "d3d9_common.h" diff --git a/renderdoc/driver/dxgi/precompiled.h b/renderdoc/driver/dxgi/precompiled.h index 6fd215b51..82a3916b2 100644 --- a/renderdoc/driver/dxgi/precompiled.h +++ b/renderdoc/driver/dxgi/precompiled.h @@ -27,5 +27,6 @@ #include "api/app/renderdoc_app.h" #include "api/replay/renderdoc_replay.h" #include "common/common.h" +#include "os/os_specific.h" #include "dxgi_common.h" diff --git a/renderdoc/driver/gl/gl_common.cpp b/renderdoc/driver/gl/gl_common.cpp index bcb801fc1..dd519197f 100644 --- a/renderdoc/driver/gl/gl_common.cpp +++ b/renderdoc/driver/gl/gl_common.cpp @@ -24,6 +24,7 @@ ******************************************************************************/ #include "gl_common.h" +#include "common/formatting.h" #include "core/core.h" #include "strings/string_utils.h" #include "gl_dispatch_table.h" diff --git a/renderdoc/driver/gl/gl_counters.cpp b/renderdoc/driver/gl/gl_counters.cpp index cde995d31..b2b66c6cc 100644 --- a/renderdoc/driver/gl/gl_counters.cpp +++ b/renderdoc/driver/gl/gl_counters.cpp @@ -30,9 +30,9 @@ #include "gl_replay.h" #include "gl_resources.h" -std::vector GLReplay::EnumerateCounters() +rdcarray GLReplay::EnumerateCounters() { - std::vector ret; + rdcarray ret; if(HasExt[ARB_timer_query]) ret.push_back(GPUCounter::EventGPUDuration); @@ -57,14 +57,12 @@ std::vector GLReplay::EnumerateCounters() if(m_pAMDCounters) { - std::vector amdCounters = m_pAMDCounters->GetPublicCounterIds(); - ret.insert(ret.end(), amdCounters.begin(), amdCounters.end()); + ret.append(m_pAMDCounters->GetPublicCounterIds()); } if(m_pIntelCounters) { - std::vector intelCounters = m_pIntelCounters->GetPublicCounterIds(); - ret.insert(ret.end(), intelCounters.begin(), intelCounters.end()); + ret.append(m_pIntelCounters->GetPublicCounterIds()); } return ret; @@ -221,7 +219,7 @@ struct GPUQueries struct GLCounterContext { uint32_t eventStart; - std::vector queries; + rdcarray queries; }; GLenum glCounters[] = { @@ -242,7 +240,7 @@ GLenum glCounters[] = { }; void GLReplay::FillTimers(GLCounterContext &ctx, const DrawcallDescription &drawnode, - const std::vector &counters) + const rdcarray &counters) { if(drawnode.children.empty()) return; @@ -302,7 +300,7 @@ void GLReplay::FillTimers(GLCounterContext &ctx, const DrawcallDescription &draw } void GLReplay::FillTimersAMD(uint32_t *eventStartID, uint32_t *sampleIndex, - std::vector *eventIDs, const DrawcallDescription &drawnode) + rdcarray *eventIDs, const DrawcallDescription &drawnode) { if(drawnode.children.empty()) return; @@ -331,11 +329,11 @@ void GLReplay::FillTimersAMD(uint32_t *eventStartID, uint32_t *sampleIndex, } } -std::vector GLReplay::FetchCountersAMD(const std::vector &counters) +rdcarray GLReplay::FetchCountersAMD(const rdcarray &counters) { if(!m_pAMDCounters->BeginMeasurementMode(AMDCounters::ApiType::Ogl, m_ReplayCtx.ctx)) { - return std::vector(); + return rdcarray(); } uint32_t sessionID = m_pAMDCounters->CreateSession(); @@ -356,7 +354,7 @@ std::vector GLReplay::FetchCountersAMD(const std::vector eventIDs; + rdcarray eventIDs; m_pDriver->ReplayMarkers(false); @@ -379,7 +377,7 @@ std::vector GLReplay::FetchCountersAMD(const std::vectorEndSesssion(sessionID); - std::vector ret = + rdcarray ret = m_pAMDCounters->GetCounterData(sessionID, sampleIndex, eventIDs, counters); m_pAMDCounters->EndMeasurementMode(); @@ -388,7 +386,7 @@ std::vector GLReplay::FetchCountersAMD(const std::vector *eventIDs, const DrawcallDescription &drawnode) + rdcarray *eventIDs, const DrawcallDescription &drawnode) { if(drawnode.children.empty()) return; @@ -417,7 +415,7 @@ void GLReplay::FillTimersIntel(uint32_t *eventStartID, uint32_t *sampleIndex, } } -std::vector GLReplay::FetchCountersIntel(const std::vector &counters) +rdcarray GLReplay::FetchCountersIntel(const rdcarray &counters) { m_pIntelCounters->DisableAllCounters(); @@ -436,7 +434,7 @@ std::vector GLReplay::FetchCountersIntel(const std::vector eventIDs; + rdcarray eventIDs; m_pDriver->ReplayMarkers(false); @@ -456,16 +454,16 @@ std::vector GLReplay::FetchCountersIntel(const std::vectorReplayMarkers(true); - std::vector ret = m_pIntelCounters->GetCounterData(sampleIndex, eventIDs, counters); + rdcarray ret = m_pIntelCounters->GetCounterData(sampleIndex, eventIDs, counters); m_pIntelCounters->EndSession(); return ret; } -std::vector GLReplay::FetchCounters(const std::vector &allCounters) +rdcarray GLReplay::FetchCounters(const rdcarray &allCounters) { - std::vector ret; + rdcarray ret; if(allCounters.empty()) { @@ -475,14 +473,14 @@ std::vector GLReplay::FetchCounters(const std::vector MakeCurrentReplayContext(&m_ReplayCtx); - std::vector counters; + rdcarray counters; std::copy_if(allCounters.begin(), allCounters.end(), std::back_inserter(counters), [](const GPUCounter &c) { return IsGenericCounter(c); }); if(m_pAMDCounters) { // Filter out the AMD counters - std::vector amdCounters; + rdcarray amdCounters; std::copy_if(allCounters.begin(), allCounters.end(), std::back_inserter(amdCounters), [](const GPUCounter &c) { return IsAMDCounter(c); }); @@ -495,7 +493,7 @@ std::vector GLReplay::FetchCounters(const std::vector if(m_pIntelCounters) { // Filter out the Intel counters - std::vector intelCounters; + rdcarray intelCounters; std::copy_if(allCounters.begin(), allCounters.end(), std::back_inserter(intelCounters), [](const GPUCounter &c) { return IsIntelCounter(c); }); diff --git a/renderdoc/driver/gl/gl_replay.h b/renderdoc/driver/gl/gl_replay.h index 9b58b07f5..50e0dcd6f 100644 --- a/renderdoc/driver/gl/gl_replay.h +++ b/renderdoc/driver/gl/gl_replay.h @@ -176,9 +176,9 @@ public: void ReplaceResource(ResourceId from, ResourceId to); void RemoveReplacement(ResourceId id); - std::vector EnumerateCounters(); + rdcarray EnumerateCounters(); CounterDescription DescribeCounter(GPUCounter counterID); - std::vector FetchCounters(const std::vector &counters); + rdcarray FetchCounters(const rdcarray &counters); void RenderMesh(uint32_t eventId, const std::vector &secondaryDraws, const MeshDisplay &cfg); @@ -404,7 +404,7 @@ private: void CheckGLSLVersion(const char *sl, int &glslVersion); void FillTimers(GLCounterContext &ctx, const DrawcallDescription &drawnode, - const std::vector &counters); + const rdcarray &counters); void InitOutputWindow(OutputWindow &outwin); void CreateOutputWindowBackbuffer(OutputWindow &outwin, bool depth); @@ -438,16 +438,16 @@ private: // AMD counter instance AMDCounters *m_pAMDCounters = NULL; - void FillTimersAMD(uint32_t *eventStartID, uint32_t *sampleIndex, std::vector *eventIDs, + void FillTimersAMD(uint32_t *eventStartID, uint32_t *sampleIndex, rdcarray *eventIDs, const DrawcallDescription &drawnode); - std::vector FetchCountersAMD(const std::vector &counters); + rdcarray FetchCountersAMD(const rdcarray &counters); // Intel counter instance IntelGlCounters *m_pIntelCounters = NULL; - void FillTimersIntel(uint32_t *eventStartID, uint32_t *sampleIndex, - std::vector *eventIDs, const DrawcallDescription &drawnode); + void FillTimersIntel(uint32_t *eventStartID, uint32_t *sampleIndex, rdcarray *eventIDs, + const DrawcallDescription &drawnode); - std::vector FetchCountersIntel(const std::vector &counters); + rdcarray FetchCountersIntel(const rdcarray &counters); }; diff --git a/renderdoc/driver/gl/precompiled.h b/renderdoc/driver/gl/precompiled.h index 0d1d4f798..88588c6be 100644 --- a/renderdoc/driver/gl/precompiled.h +++ b/renderdoc/driver/gl/precompiled.h @@ -27,5 +27,6 @@ #include "api/app/renderdoc_app.h" #include "api/replay/renderdoc_replay.h" #include "common/common.h" +#include "os/os_specific.h" #include "gl_common.h" diff --git a/renderdoc/driver/ihv/amd/AMD.vcxproj.filters b/renderdoc/driver/ihv/amd/AMD.vcxproj.filters index 9f0e17957..e8d8a5157 100644 --- a/renderdoc/driver/ihv/amd/AMD.vcxproj.filters +++ b/renderdoc/driver/ihv/amd/AMD.vcxproj.filters @@ -104,7 +104,6 @@ official\GPUPerfAPI - official\GPUPerfAPI @@ -114,5 +113,8 @@ official\RGA\Common + + RGP + \ No newline at end of file diff --git a/renderdoc/driver/ihv/amd/amd_counters.cpp b/renderdoc/driver/ihv/amd/amd_counters.cpp index ed9fa09a7..49b7b6eed 100644 --- a/renderdoc/driver/ihv/amd/amd_counters.cpp +++ b/renderdoc/driver/ihv/amd/amd_counters.cpp @@ -73,7 +73,7 @@ bool AMDCounters::Init(ApiType apiType, void *pContext) return false; #else - std::string dllName("GPUPerfAPI"); + rdcstr dllName("GPUPerfAPI"); switch(apiType) { @@ -99,7 +99,7 @@ bool AMDCounters::Init(ApiType apiType, void *pContext) #endif // first try in the plugin location it will be in distributed builds - std::string dllPath = LocatePluginFile("amd/counters", dllName.c_str()); + rdcstr dllPath = LocatePluginFile("amd/counters", dllName.c_str()); void *module = Process::LoadModule(dllPath.c_str()); if(module == NULL) @@ -263,9 +263,10 @@ std::map AMDCounters::EnumerateCounters() return counters; } -std::vector AMDCounters::GetPublicCounterIds() const +rdcarray AMDCounters::GetPublicCounterIds() const { - std::vector ret; + rdcarray ret; + ret.reserve(m_PublicToInternalCounter.size()); for(const std::pair &entry : m_PublicToInternalCounter) ret.push_back(entry.first); @@ -529,11 +530,11 @@ void AMDCounters::DeleteSession(uint32_t sessionId) } } -std::vector AMDCounters::GetCounterData(uint32_t sessionID, uint32_t maxSampleIndex, - const std::vector &eventIDs, - const std::vector &counters) +rdcarray AMDCounters::GetCounterData(uint32_t sessionID, uint32_t maxSampleIndex, + const rdcarray &eventIDs, + const rdcarray &counters) { - std::vector ret; + rdcarray ret; bool isReady = false; diff --git a/renderdoc/driver/ihv/amd/amd_counters.h b/renderdoc/driver/ihv/amd/amd_counters.h index da9208d81..a5266dc77 100644 --- a/renderdoc/driver/ihv/amd/amd_counters.h +++ b/renderdoc/driver/ihv/amd/amd_counters.h @@ -25,8 +25,9 @@ #pragma once #include -#include -#include "api/replay/renderdoc_replay.h" +#include "api/replay/data_types.h" +#include "api/replay/rdcarray.h" +#include "api/replay/replay_enums.h" #include "driver/vulkan/official/vulkan.h" #include "official/GPUPerfAPI/Include/GPUPerfAPI.h" @@ -49,7 +50,7 @@ public: ~AMDCounters(); bool Init(ApiType apiType, void *pContext); - std::vector GetPublicCounterIds() const; + rdcarray GetPublicCounterIds() const; CounterDescription GetCounterDescription(GPUCounter counter); @@ -77,9 +78,9 @@ public: void EndSample(void *pCommandList = NULL); // Session data retrieval - std::vector GetCounterData(uint32_t sessionID, uint32_t maxSampleIndex, - const std::vector &eventIDs, - const std::vector &counters); + rdcarray GetCounterData(uint32_t sessionID, uint32_t maxSampleIndex, + const rdcarray &eventIDs, + const rdcarray &counters); private: bool IsSessionReady(uint32_t sessionIndex); @@ -97,7 +98,7 @@ private: }; GPACmdListInfo m_gpaCmdListInfo; - std::vector m_gpaSessionInfo; + rdcarray m_gpaSessionInfo; ApiType m_apiType; uint32_t m_gpaSessionCounter; diff --git a/renderdoc/driver/ihv/amd/amd_isa.cpp b/renderdoc/driver/ihv/amd/amd_isa.cpp index e74771a4e..f945f2a86 100644 --- a/renderdoc/driver/ihv/amd/amd_isa.cpp +++ b/renderdoc/driver/ihv/amd/amd_isa.cpp @@ -24,30 +24,32 @@ #include "amd_isa.h" #include "common/common.h" +#include "common/formatting.h" #include "core/plugins.h" +#include "os/os_specific.h" #include "strings/string_utils.h" #include "amd_isa_devices.h" namespace GCNISA { #if ENABLED(RDOC_WIN32) -static const std::string amdspv_name = "amdspv.exe"; -static const std::string virtualcontext_name = "VirtualContext.exe"; +static const rdcstr amdspv_name = "amdspv.exe"; +static const rdcstr virtualcontext_name = "VirtualContext.exe"; #else -static const std::string amdspv_name = "amdspv.sh"; -static const std::string virtualcontext_name = "VirtualContext"; +static const rdcstr amdspv_name = "amdspv.sh"; +static const rdcstr virtualcontext_name = "VirtualContext"; #endif -std::string pluginPath = "amd/isa"; +rdcstr pluginPath = "amd/isa"; // in amd_isa_.cpp -std::string DisassembleDXBC(const bytebuf &shaderBytes, const std::string &target); +rdcstr DisassembleDXBC(const bytebuf &shaderBytes, const rdcstr &target); static bool IsSupported(ShaderEncoding encoding) { if(encoding == ShaderEncoding::GLSL) { - std::string vc = LocatePluginFile(pluginPath, virtualcontext_name); + rdcstr vc = LocatePluginFile(pluginPath, virtualcontext_name); Process::ProcessResult result = {}; Process::LaunchProcess(vc.c_str(), get_dirname(vc).c_str(), "", true, &result); @@ -62,7 +64,7 @@ static bool IsSupported(ShaderEncoding encoding) if(encoding == ShaderEncoding::SPIRV) { // TODO need to check if an AMD context is running - std::string amdspv = LocatePluginFile(pluginPath, amdspv_name); + rdcstr amdspv = LocatePluginFile(pluginPath, amdspv_name); Process::ProcessResult result = {}; Process::LaunchProcess(amdspv.c_str(), get_dirname(amdspv).c_str(), "", true, &result); @@ -77,7 +79,7 @@ static bool IsSupported(ShaderEncoding encoding) // we only need to check if we can get atidxx64.dll if(encoding == ShaderEncoding::DXBC) { - std::string test = DisassembleDXBC(bytebuf(), ""); + rdcstr test = DisassembleDXBC(bytebuf(), ""); return test.empty(); } @@ -85,7 +87,7 @@ static bool IsSupported(ShaderEncoding encoding) return false; } -void GetTargets(GraphicsAPI api, std::vector &targets) +void GetTargets(GraphicsAPI api, rdcarray &targets) { targets.reserve(asicCount + 1); @@ -122,7 +124,7 @@ void GetTargets(GraphicsAPI api, std::vector &targets) } } -std::string DisassembleSPIRV(ShaderStage stage, const bytebuf &shaderBytes, const std::string &target) +rdcstr DisassembleSPIRV(ShaderStage stage, const bytebuf &shaderBytes, const rdcstr &target) { if(!IsSupported(ShaderEncoding::SPIRV)) { @@ -134,7 +136,7 @@ std::string DisassembleSPIRV(ShaderStage stage, const bytebuf &shaderBytes, cons ; https://github.com/baldurk/renderdoc/wiki/GCN-ISA)"; } - std::string cmdLine = "-Dall -l"; + rdcstr cmdLine = "-Dall -l"; bool found = false; @@ -176,8 +178,8 @@ std::string DisassembleSPIRV(ShaderStage stage, const bytebuf &shaderBytes, cons case ShaderStage::Count: return "; Cannot identify shader type"; } - std::string tempPath = FileIO::GetTempFolderFilename() + "rdoc_isa__"; - std::string inPath = StringFormat::Fmt("%sin.spv", tempPath.c_str()); + rdcstr tempPath = FileIO::GetTempFolderFilename() + "rdoc_isa__"; + rdcstr inPath = StringFormat::Fmt("%sin.spv", tempPath.c_str()); cmdLine += StringFormat::Fmt( " -set in.spv=\"%sin.spv\" out.%s.palIlText=\"%sout.il\" out.%s.isa=\"%sout.bin\" " @@ -189,7 +191,7 @@ std::string DisassembleSPIRV(ShaderStage stage, const bytebuf &shaderBytes, cons FileIO::WriteAll(inPath.c_str(), shaderBytes); // try to locate the amdspv relative to our running program - std::string amdspv = LocatePluginFile(pluginPath, amdspv_name); + rdcstr amdspv = LocatePluginFile(pluginPath, amdspv_name); Process::ProcessResult result = {}; Process::LaunchProcess(amdspv.c_str(), get_dirname(amdspv).c_str(), cmdLine.c_str(), true, &result); @@ -214,7 +216,7 @@ std::string DisassembleSPIRV(ShaderStage stage, const bytebuf &shaderBytes, cons { FileIO::ReadAll(StringFormat::Fmt("%sout.txt", tempPath.c_str()).c_str(), ret); - std::string statsfile = StringFormat::Fmt("%sstats.txt", tempPath.c_str()); + rdcstr statsfile = StringFormat::Fmt("%sstats.txt", tempPath.c_str()); if(FileIO::exists(statsfile.c_str())) { @@ -236,7 +238,7 @@ std::string DisassembleSPIRV(ShaderStage stage, const bytebuf &shaderBytes, cons return ret; } -std::string DisassembleGLSL(ShaderStage stage, const bytebuf &shaderBytes, const std::string &target) +rdcstr DisassembleGLSL(ShaderStage stage, const bytebuf &shaderBytes, const rdcstr &target) { if(!IsSupported(ShaderEncoding::GLSL)) { @@ -279,14 +281,14 @@ std::string DisassembleGLSL(ShaderStage stage, const bytebuf &shaderBytes, const case ShaderStage::Count: return "; Cannot identify shader type"; } - std::string tempPath = FileIO::GetTempFolderFilename() + "rdoc_isa__"; - std::string inPath = StringFormat::Fmt("%sin.%s", tempPath.c_str(), stageName); - std::string outPath = StringFormat::Fmt("%sout.txt", tempPath.c_str()); - std::string binPath = StringFormat::Fmt("%sout.bin", tempPath.c_str()); - std::string statsPath = StringFormat::Fmt("%sstats.txt", tempPath.c_str()); - std::string ilPath = StringFormat::Fmt("%sil.txt", tempPath.c_str()); + rdcstr tempPath = FileIO::GetTempFolderFilename() + "rdoc_isa__"; + rdcstr inPath = StringFormat::Fmt("%sin.%s", tempPath.c_str(), stageName); + rdcstr outPath = StringFormat::Fmt("%sout.txt", tempPath.c_str()); + rdcstr binPath = StringFormat::Fmt("%sout.bin", tempPath.c_str()); + rdcstr statsPath = StringFormat::Fmt("%sstats.txt", tempPath.c_str()); + rdcstr ilPath = StringFormat::Fmt("%sil.txt", tempPath.c_str()); - std::string cmdLine = "\""; + rdcstr cmdLine = "\""; // ISA disassembly for(int i = 0; i < 6; i++) @@ -360,7 +362,7 @@ std::string DisassembleGLSL(ShaderStage stage, const bytebuf &shaderBytes, const FileIO::WriteAll(inPath.c_str(), shaderBytes); // try to locate the amdspv relative to our running program - std::string vc = LocatePluginFile(pluginPath, virtualcontext_name); + rdcstr vc = LocatePluginFile(pluginPath, virtualcontext_name); Process::ProcessResult result = {}; Process::LaunchProcess(vc.c_str(), get_dirname(vc).c_str(), cmdLine.c_str(), true, &result); @@ -401,8 +403,8 @@ std::string DisassembleGLSL(ShaderStage stage, const bytebuf &shaderBytes, const return ret; } -std::string Disassemble(ShaderEncoding encoding, ShaderStage stage, const bytebuf &shaderBytes, - const std::string &target) +rdcstr Disassemble(ShaderEncoding encoding, ShaderStage stage, const bytebuf &shaderBytes, + const rdcstr &target) { if(encoding == ShaderEncoding::DXBC) return DisassembleDXBC(shaderBytes, target); diff --git a/renderdoc/driver/ihv/amd/amd_isa.h b/renderdoc/driver/ihv/amd/amd_isa.h index c32ceb611..eb7bb20ea 100644 --- a/renderdoc/driver/ihv/amd/amd_isa.h +++ b/renderdoc/driver/ihv/amd/amd_isa.h @@ -24,13 +24,14 @@ #pragma once -#include -#include "api/replay/renderdoc_replay.h" +#include "api/replay/rdcarray.h" +#include "api/replay/rdcstr.h" +#include "api/replay/replay_enums.h" namespace GCNISA { -void GetTargets(GraphicsAPI api, std::vector &targets); +void GetTargets(GraphicsAPI api, rdcarray &targets); -std::string Disassemble(ShaderEncoding api, ShaderStage stage, const bytebuf &shaderBytes, - const std::string &target); +rdcstr Disassemble(ShaderEncoding api, ShaderStage stage, const bytebuf &shaderBytes, + const rdcstr &target); }; diff --git a/renderdoc/driver/ihv/amd/amd_isa_posix.cpp b/renderdoc/driver/ihv/amd/amd_isa_posix.cpp index fbddd4476..43782b2d0 100644 --- a/renderdoc/driver/ihv/amd/amd_isa_posix.cpp +++ b/renderdoc/driver/ihv/amd/amd_isa_posix.cpp @@ -26,7 +26,7 @@ namespace GCNISA { -std::string DisassembleDXBC(const bytebuf &shaderBytes, const std::string &target) +rdcstr DisassembleDXBC(const bytebuf &shaderBytes, const rdcstr &target) { return "Disassembling D3D shaders is only supported on windows"; } diff --git a/renderdoc/driver/ihv/amd/amd_isa_win32.cpp b/renderdoc/driver/ihv/amd/amd_isa_win32.cpp index ab5646d4d..1bf257a53 100644 --- a/renderdoc/driver/ihv/amd/amd_isa_win32.cpp +++ b/renderdoc/driver/ihv/amd/amd_isa_win32.cpp @@ -24,6 +24,7 @@ #include "amd_isa.h" #include "common/common.h" +#include "common/formatting.h" #include "core/plugins.h" #include "official/RGA/Common/AmdDxGsaCompile.h" #include "official/RGA/elf/elf32.h" @@ -45,7 +46,7 @@ https://github.com/baldurk/renderdoc/wiki/GCN-ISA)"; namespace GCNISA { -extern std::string pluginPath; +extern rdcstr pluginPath; static HMODULE GetAMDModule() { @@ -73,7 +74,7 @@ void SafelyCompile(PfnAmdDxGsaCompileShader compileShader, AmdDxGsaCompileShader } } -std::string DisassembleDXBC(const bytebuf &shaderBytes, const std::string &target) +rdcstr DisassembleDXBC(const bytebuf &shaderBytes, const rdcstr &target) { HMODULE mod = GetAMDModule(); @@ -150,7 +151,7 @@ std::string DisassembleDXBC(const bytebuf &shaderBytes, const std::string &targe const uint32_t numChunks = *dxbc; dxbc++; - std::vector chunkOffsets; + rdcarray chunkOffsets; for(uint32_t i = 0; i < numChunks; i++) { if(dxbc >= end) @@ -198,7 +199,7 @@ std::string DisassembleDXBC(const bytebuf &shaderBytes, const std::string &targe const Elf32_Ehdr *elfHeader = (const Elf32_Ehdr *)elf; - std::string ret; + rdcstr ret; // minimal code to extract data from ELF. We assume the ELF we got back is well-formed. if(IS_ELF(*elfHeader) && elfHeader->e_ident[EI_CLASS] == ELFCLASS32) @@ -242,8 +243,8 @@ std::string DisassembleDXBC(const bytebuf &shaderBytes, const std::string &targe if(stats && !amdil) { - std::string statStr = StringFormat::Fmt( - R"(; -------- Statistics --------------------- + ret.insert(0, StringFormat::Fmt( + R"(; -------- Statistics --------------------- ; SGPRs: %u out of %u used ; VGPRs: %u out of %u used ; LDS: %u out of %u bytes used @@ -251,16 +252,13 @@ std::string DisassembleDXBC(const bytebuf &shaderBytes, const std::string &targe ; Instructions: %u ALU, %u Control Flow, %u TFETCH )", - stats->numSgprsUsed, stats->availableSgprs, stats->numVgprsUsed, stats->availableVgprs, - stats->usedLdsBytes, stats->availableLdsBytes, stats->usedScratchBytes, stats->numAluInst, - stats->numControlFlowInst, stats->numTfetchInst); - - ret.insert(ret.begin(), statStr.begin(), statStr.end()); + stats->numSgprsUsed, stats->availableSgprs, stats->numVgprsUsed, + stats->availableVgprs, stats->usedLdsBytes, stats->availableLdsBytes, + stats->usedScratchBytes, stats->numAluInst, stats->numControlFlowInst, + stats->numTfetchInst)); } - std::string header = StringFormat::Fmt("; Disassembly for %s\n\n", target.c_str()); - - ret.insert(ret.begin(), header.begin(), header.end()); + ret.insert(0, StringFormat::Fmt("; Disassembly for %s\n\n", target.c_str())); } else { diff --git a/renderdoc/driver/ihv/amd/amd_rgp.cpp b/renderdoc/driver/ihv/amd/amd_rgp.cpp index c3e00389d..d64afcb7d 100644 --- a/renderdoc/driver/ihv/amd/amd_rgp.cpp +++ b/renderdoc/driver/ihv/amd/amd_rgp.cpp @@ -81,7 +81,7 @@ AMDRGPControl::AMDRGPControl() RDCLOG("Attempting to enable AMD RGP Interop"); // manually load in the DevDriverAPI dll and set up the function table - std::string dllName("DevDriverAPI"); + rdcstr dllName("DevDriverAPI"); #if ENABLED(RDOC_WIN32) #if ENABLED(RDOC_X64) @@ -94,7 +94,7 @@ AMDRGPControl::AMDRGPControl() #endif // first try in the plugin location it will be in distributed builds - std::string dllPath = LocatePluginFile("amd/rgp", dllName.c_str()); + rdcstr dllPath = LocatePluginFile("amd/rgp", dllName.c_str()); void *module = Process::LoadModule(dllPath.c_str()); if(module == NULL) @@ -167,7 +167,7 @@ bool AMDRGPControl::Initialised() return m_RGPContext != NULL; } -bool AMDRGPControl::TriggerCapture(const std::string &path) +bool AMDRGPControl::TriggerCapture(const rdcstr &path) { if(m_RGPContext == NULL) return false; @@ -232,8 +232,8 @@ bool AMDRGPControl::DriverSupportsInterop() TEST_CASE("Check that markers are distinct for begin and end", "[amd]") { - std::string beginMark = AMDRGPControl::GetBeginMarker(); - std::string endMark = AMDRGPControl::GetEndMarker(); + rdcstr beginMark = AMDRGPControl::GetBeginMarker(); + rdcstr endMark = AMDRGPControl::GetEndMarker(); CHECK(beginMark != endMark); CHECK(beginMark != ""); diff --git a/renderdoc/driver/ihv/amd/amd_rgp.h b/renderdoc/driver/ihv/amd/amd_rgp.h index a97edd661..19638d1cb 100644 --- a/renderdoc/driver/ihv/amd/amd_rgp.h +++ b/renderdoc/driver/ihv/amd/amd_rgp.h @@ -24,7 +24,7 @@ #pragma once -#include +#include "api/replay/rdcstr.h" typedef void *DevDriverAPIContext; @@ -38,7 +38,7 @@ public: bool Initialised(); - bool TriggerCapture(const std::string &path); + bool TriggerCapture(const rdcstr &path); bool HasCapture(); bool DriverSupportsInterop(); diff --git a/renderdoc/driver/ihv/intel/intel_counters.cpp b/renderdoc/driver/ihv/intel/intel_counters.cpp index 1ca33fbb8..fe17d7004 100644 --- a/renderdoc/driver/ihv/intel/intel_counters.cpp +++ b/renderdoc/driver/ihv/intel/intel_counters.cpp @@ -24,14 +24,20 @@ #include "common/common.h" +// some headers that DriverStorePath.h needs but doesn't include +#include +#include +#include + #include "official/DriverStorePath.h" #include "intel_counters.h" #include +#include "driver/dx/official/d3d11.h" -const static std::vector metricSetBlacklist = {"TestOa"}; +const static rdcarray metricSetBlacklist = {"TestOa"}; -HMODULE IntelCounters::m_MDLibraryHandle = 0; +void *IntelCounters::m_MDLibraryHandle = 0; IMetricsDevice_1_5 *IntelCounters::m_metricsDevice = NULL; OpenMetricsDevice_fn IntelCounters::OpenMetricsDevice = NULL; CloseMetricsDevice_fn IntelCounters::CloseMetricsDevice = NULL; @@ -51,9 +57,9 @@ IntelCounters::~IntelCounters() m_metricsDevice = NULL; if(m_MDLibraryHandle) - FreeLibrary(m_MDLibraryHandle); + FreeLibrary((HMODULE)m_MDLibraryHandle); - m_MDLibraryHandle = (HMODULE)0; + m_MDLibraryHandle = NULL; OpenMetricsDevice = NULL; CloseMetricsDevice = NULL; } @@ -63,16 +69,17 @@ void IntelCounters::Load() if(m_metricsDevice) return; - m_MDLibraryHandle = LoadDynamicLibrary(L"igdmd64.dll", NULL, 0); + m_MDLibraryHandle = (void *)LoadDynamicLibrary(L"igdmd64.dll", NULL, 0); if(!m_MDLibraryHandle) return; - OpenMetricsDevice = (OpenMetricsDevice_fn)GetProcAddress(m_MDLibraryHandle, "OpenMetricsDevice"); + OpenMetricsDevice = + (OpenMetricsDevice_fn)GetProcAddress((HMODULE)m_MDLibraryHandle, "OpenMetricsDevice"); if(!OpenMetricsDevice) return; CloseMetricsDevice = - (CloseMetricsDevice_fn)GetProcAddress(m_MDLibraryHandle, "CloseMetricsDevice"); + (CloseMetricsDevice_fn)GetProcAddress((HMODULE)m_MDLibraryHandle, "CloseMetricsDevice"); if(!CloseMetricsDevice) return; @@ -97,10 +104,10 @@ bool IntelCounters::Init(void *pContext) (deviceParams->Version.MajorNumber == 1 && deviceParams->Version.MinorNumber < 1)) { CloseMetricsDevice(m_metricsDevice); - FreeLibrary(m_MDLibraryHandle); + FreeLibrary((HMODULE)m_MDLibraryHandle); m_metricsDevice = NULL; - m_MDLibraryHandle = (HMODULE)0; + m_MDLibraryHandle = NULL; OpenMetricsDevice = NULL; CloseMetricsDevice = NULL; return false; @@ -116,11 +123,11 @@ CounterDescription IntelCounters::GetCounterDescription(GPUCounter counter) return m_Counters[GPUCounterToCounterIndex(counter)]; } -std::vector IntelCounters::EnumerateCounters() +rdcarray IntelCounters::EnumerateCounters() { m_Counters.clear(); m_allMetricSets.clear(); - std::set addedMetrics; + std::set addedMetrics; TMetricsDeviceParams_1_2 *deviceParams = m_metricsDevice->GetParams(); for(unsigned int i = 0; i < deviceParams->ConcurrentGroupsCount; ++i) { @@ -138,8 +145,7 @@ std::vector IntelCounters::EnumerateCounters() m_allMetricSets.push_back(metricSet); TMetricSetParams_1_0 *setParams = metricSet->GetParams(); - if(std::find(metricSetBlacklist.begin(), metricSetBlacklist.end(), setParams->SymbolName) != - metricSetBlacklist.end()) + if(metricSetBlacklist.contains(setParams->SymbolName)) continue; for(unsigned int k = 0; k < setParams->MetricsCount; ++k) @@ -288,15 +294,15 @@ void IntelCounters::EnableCounter(GPUCounter index) { uint32_t metricSetIdx = m_metricLocation[index].first; IMetricSet_1_1 *metricSet = m_allMetricSets[metricSetIdx]; - auto iter = std::find(m_subscribedMetricSets.begin(), m_subscribedMetricSets.end(), metricSet); - if(iter == m_subscribedMetricSets.end()) + int idx = m_subscribedMetricSets.indexOf(metricSet); + if(idx < 0) { m_subscribedMetricSets.push_back(metricSet); metricSetIdx = (uint32_t)m_subscribedMetricSets.size() - 1; } else { - metricSetIdx = (uint32_t)(iter - m_subscribedMetricSets.begin()); + metricSetIdx = (uint32_t)idx; } m_subscribedMetricsByCounterSet[metricSetIdx].push_back(index); } @@ -401,10 +407,10 @@ void IntelCounters::EndSample() m_sampleIndex++; } -std::vector IntelCounters::GetCounterData(const std::vector &eventIDs, - const std::vector &counters) +rdcarray IntelCounters::GetCounterData(const rdcarray &eventIDs, + const rdcarray &counters) { - std::vector ret; + rdcarray ret; for(uint32_t sample = 0; sample < (uint32_t)eventIDs.size(); sample++) { for(size_t counter = 0; counter < counters.size(); counter++) diff --git a/renderdoc/driver/ihv/intel/intel_counters.h b/renderdoc/driver/ihv/intel/intel_counters.h index 4f9589071..5510be3c9 100644 --- a/renderdoc/driver/ihv/intel/intel_counters.h +++ b/renderdoc/driver/ihv/intel/intel_counters.h @@ -24,14 +24,18 @@ #pragma once -#include -#include #include -#include -#include "api/replay/renderdoc_replay.h" +#include "api/replay/data_types.h" +#include "api/replay/rdcarray.h" +#include "api/replay/rdcpair.h" +#include "api/replay/replay_enums.h" #include "official/metrics_discovery_api.h" +struct ID3D11Device; +struct ID3D11DeviceContext; +struct ID3D11Counter; + using namespace MetricsDiscovery; inline constexpr GPUCounter MakeIntelCounter(int index) @@ -49,7 +53,7 @@ public: bool Init(void *pDevice); ~IntelCounters(); - std::vector GetPublicCounterIds() const { return m_counterIds; } + rdcarray GetPublicCounterIds() const { return m_counterIds; } CounterDescription GetCounterDescription(GPUCounter index); void EnableCounter(GPUCounter index); @@ -66,8 +70,8 @@ public: void BeginSample(); void EndSample(); - std::vector GetCounterData(const std::vector &eventIDs, - const std::vector &counters); + rdcarray GetCounterData(const rdcarray &eventIDs, + const rdcarray &counters); private: static uint32_t GPUCounterToCounterIndex(GPUCounter counter) @@ -75,22 +79,22 @@ private: return (uint32_t)(counter) - (uint32_t)(GPUCounter::FirstIntel); } - std::vector EnumerateCounters(); - std::vector m_counterIds; - std::vector m_Counters; - std::vector m_allMetricSets; - std::vector m_subscribedMetricSets; + rdcarray EnumerateCounters(); + rdcarray m_counterIds; + rdcarray m_Counters; + rdcarray m_allMetricSets; + rdcarray m_subscribedMetricSets; std::map> m_metricLocation; - std::vector> m_subscribedMetricsByCounterSet; + rdcarray> m_subscribedMetricsByCounterSet; ID3D11Device *m_device; ID3D11DeviceContext *m_deviceContext; ID3D11Counter *m_counter; - std::vector m_queryResult; + rdcarray m_queryResult; uint32_t m_passIndex; uint32_t m_sampleIndex; std::map, TTypedValue_1_0> m_results; - static HMODULE m_MDLibraryHandle; + static void *m_MDLibraryHandle; static IMetricsDevice_1_5 *m_metricsDevice; static OpenMetricsDevice_fn OpenMetricsDevice; static CloseMetricsDevice_fn CloseMetricsDevice; diff --git a/renderdoc/driver/ihv/intel/intel_gl_counters.cpp b/renderdoc/driver/ihv/intel/intel_gl_counters.cpp index 20f937120..4b86ad4b3 100644 --- a/renderdoc/driver/ihv/intel/intel_gl_counters.cpp +++ b/renderdoc/driver/ihv/intel/intel_gl_counters.cpp @@ -31,7 +31,7 @@ #include "intel_gl_counters.h" -const static std::vector metricSetBlacklist = { +const static rdcarray metricSetBlacklist = { // Used for testing HW is programmed correctly. "TestOa", // Used to plumb raw data from the GL driver to metrics-discovery. @@ -45,9 +45,9 @@ IntelGlCounters::~IntelGlCounters() { } -std::vector IntelGlCounters::GetPublicCounterIds() const +rdcarray IntelGlCounters::GetPublicCounterIds() const { - std::vector counters; + rdcarray counters; for(const IntelGlCounter &c : m_Counters) counters.push_back(c.desc.counter); @@ -124,8 +124,7 @@ void IntelGlCounters::addQuery(GLuint queryId) if(GL.glGetError() != eGL_NONE) return; - if(std::find(metricSetBlacklist.begin(), metricSetBlacklist.end(), query.name) != - metricSetBlacklist.end()) + if(metricSetBlacklist.contains(query.name)) return; m_Queries[query.queryId] = query; @@ -146,9 +145,9 @@ bool IntelGlCounters::Init() return false; #if defined(RENDERDOC_PLATFORM_ANDROID) || defined(RENDERDOC_PLATFORM_LINUX) - std::ifstream f("/proc/sys/dev/i915/perf_stream_paranoid"); - std::string contents; - std::getline(f, contents); + rdcstr contents; + FileIO::ReadAll("/proc/sys/dev/i915/perf_stream_paranoid", contents); + contents.trim(); if(!contents.empty()) { int paranoid = std::stoi(contents); @@ -214,7 +213,7 @@ void IntelGlCounters::EndPass() { // Flush all of the pass' queries to ensure we can begin further samples // with a different pass. - std::vector data(m_Queries[m_EnabledQueries[m_passIndex]].size); + rdcarray data(m_Queries[m_EnabledQueries[m_passIndex]].size); GLuint len; uint32_t nSamples = (uint32_t)m_glQueries.size() / (m_passIndex + 1); @@ -266,18 +265,18 @@ void IntelGlCounters::CopyData(void *dest, const IntelGlCounter &counter, uint32 uint32_t pass = CounterPass(counter); uint32_t queryHandle = m_glQueries[maxSampleIndex * pass + sample]; - std::vector data(m_Queries[m_EnabledQueries[pass]].size); + rdcarray data(m_Queries[m_EnabledQueries[pass]].size); GLuint len; GL.glGetPerfQueryDataINTEL(queryHandle, 0, (GLsizei)data.size(), &data[0], &len); memcpy(dest, &data[counter.offset], counter.desc.resultByteWidth); } -std::vector IntelGlCounters::GetCounterData(uint32_t maxSampleIndex, - const std::vector &eventIDs, - const std::vector &counters) +rdcarray IntelGlCounters::GetCounterData(uint32_t maxSampleIndex, + const rdcarray &eventIDs, + const rdcarray &counters) { - std::vector ret; + rdcarray ret; RDCASSERT((maxSampleIndex * m_EnabledQueries.size()) == m_glQueries.size()); diff --git a/renderdoc/driver/ihv/intel/intel_gl_counters.h b/renderdoc/driver/ihv/intel/intel_gl_counters.h index 03b26203f..d0e3ad01e 100644 --- a/renderdoc/driver/ihv/intel/intel_gl_counters.h +++ b/renderdoc/driver/ihv/intel/intel_gl_counters.h @@ -25,9 +25,9 @@ #pragma once #include -#include -#include "api/replay/renderdoc_replay.h" +#include "api/replay/rdcarray.h" +#include "api/replay/replay_enums.h" typedef unsigned int GLuint; @@ -44,7 +44,7 @@ public: bool Init(); ~IntelGlCounters(); - std::vector GetPublicCounterIds() const; + rdcarray GetPublicCounterIds() const; CounterDescription GetCounterDescription(GPUCounter index) const; void EnableCounter(GPUCounter index); @@ -61,9 +61,8 @@ public: void BeginSample(uint32_t sampleID); void EndSample(); - std::vector GetCounterData(uint32_t maxSampleIndex, - const std::vector &eventIDs, - const std::vector &counters); + rdcarray GetCounterData(uint32_t maxSampleIndex, const rdcarray &eventIDs, + const rdcarray &counters); private: static uint32_t GPUCounterToCounterIndex(GPUCounter counter) @@ -79,13 +78,13 @@ private: GLuint type = 0; GLuint dataType = 0; }; - std::vector m_Counters; - std::map m_CounterNames; + rdcarray m_Counters; + std::map m_CounterNames; struct IntelGlQuery { GLuint queryId = 0; - std::string name; + rdcstr name; GLuint size = 0; }; std::map m_Queries; @@ -95,9 +94,9 @@ private: uint32_t CounterPass(const IntelGlCounter &counter); void CopyData(void *dest, const IntelGlCounter &counter, uint32_t sample, uint32_t maxSampleIndex); - std::vector m_EnabledQueries; + rdcarray m_EnabledQueries; uint32_t m_passIndex; - std::vector m_glQueries; + rdcarray m_glQueries; }; diff --git a/renderdoc/driver/ihv/nv/nv_counters.cpp b/renderdoc/driver/ihv/nv/nv_counters.cpp index 90ee79dbc..65d0e1bf9 100644 --- a/renderdoc/driver/ihv/nv/nv_counters.cpp +++ b/renderdoc/driver/ihv/nv/nv_counters.cpp @@ -25,6 +25,7 @@ #include "nv_counters.h" #include "common/common.h" #include "core/plugins.h" +#include "os/os_specific.h" #define NVPM_INITGUID #include "official/PerfKit/include/NvPmApi.h" @@ -32,11 +33,11 @@ struct EnumCountersCtx { - std::vector m_ExternalIds; - std::vector m_InternalIds; - std::vector m_ExternalDescriptors; - std::vector m_InternalDescriptors; - std::vector m_TmpStr; + rdcarray m_ExternalIds; + rdcarray m_InternalIds; + rdcarray m_ExternalDescriptors; + rdcarray m_InternalDescriptors; + rdcarray m_TmpStr; NvPmApi *m_NvPmApi; @@ -192,9 +193,9 @@ bool NVCounters::Init() #if ENABLED(RDOC_WIN32) #if ENABLED(RDOC_X64) - std::string dllPath = LocatePluginFile("nv/counters/x64", "NvPmApi.Core.dll"); + rdcstr dllPath = LocatePluginFile("nv/counters/x64", "NvPmApi.Core.dll"); #else - std::string dllPath = LocatePluginFile("nv/counters/x86", "NvPmApi.Core.dll"); + rdcstr dllPath = LocatePluginFile("nv/counters/x86", "NvPmApi.Core.dll"); #endif #endif @@ -262,7 +263,7 @@ bool NVCounters::Init(ID3D11Device *pDevice) return true; } -bool NVCounters::PrepareExperiment(const std::vector &counters, uint32_t objectsCount) +bool NVCounters::PrepareExperiment(const rdcarray &counters, uint32_t objectsCount) { if(NvPmResultFails(m_NvPmApi->RemoveAllCounters(m_NvPmCtx), "call to 'NvPmApi::RemoveAllCounters'")) @@ -318,8 +319,7 @@ uint32_t NVCounters::BeginExperiment() const return NumPasses; } -void NVCounters::EndExperiment(const std::vector &eventIds, - std::vector &Result) const +void NVCounters::EndExperiment(const rdcarray &eventIds, rdcarray &Result) const { NvPmResultFails(m_NvPmApi->EndExperiment(m_NvPmCtx), "call to 'NvPmApi::EndExperiment'"); diff --git a/renderdoc/driver/ihv/nv/nv_counters.h b/renderdoc/driver/ihv/nv/nv_counters.h index 9ecf44227..a88e678b6 100644 --- a/renderdoc/driver/ihv/nv/nv_counters.h +++ b/renderdoc/driver/ihv/nv/nv_counters.h @@ -25,8 +25,9 @@ #pragma once #include -#include -#include "api/replay/renderdoc_replay.h" +#include "api/replay/data_types.h" +#include "api/replay/rdcarray.h" +#include "api/replay/replay_enums.h" struct ID3D11Device; @@ -38,18 +39,18 @@ public: bool Init(ID3D11Device *pDevice); - std::vector GetPublicCounterIds() const { return m_ExternalIds; } + rdcarray GetPublicCounterIds() const { return m_ExternalIds; } CounterDescription GetCounterDescription(GPUCounter counterID) const { const uint32_t LocalId = (uint32_t)counterID - (uint32_t)GPUCounter::FirstNvidia; return m_ExternalDescriptors[LocalId]; } - bool PrepareExperiment(const std::vector &counters, uint32_t objectsCount); + bool PrepareExperiment(const rdcarray &counters, uint32_t objectsCount); // returns num passes uint32_t BeginExperiment() const; - void EndExperiment(const std::vector &eventIds, std::vector &Result) const; + void EndExperiment(const rdcarray &eventIds, rdcarray &Result) const; void BeginPass(uint32_t passIdx) const; void EndPass(uint32_t passIdx) const; @@ -65,10 +66,10 @@ private: uint64_t m_NvPmCtx; uint32_t m_ObjectsCount; - std::vector m_ExternalIds; - std::vector m_InternalIds; - std::vector m_SelectedExternalIds; - std::vector m_SelectedInternalIds; - std::vector m_ExternalDescriptors; - std::vector m_InternalDescriptors; + rdcarray m_ExternalIds; + rdcarray m_InternalIds; + rdcarray m_SelectedExternalIds; + rdcarray m_SelectedInternalIds; + rdcarray m_ExternalDescriptors; + rdcarray m_InternalDescriptors; }; diff --git a/renderdoc/driver/shaders/dxbc/dxbc_debug.cpp b/renderdoc/driver/shaders/dxbc/dxbc_debug.cpp index 0b687b60b..40027126f 100644 --- a/renderdoc/driver/shaders/dxbc/dxbc_debug.cpp +++ b/renderdoc/driver/shaders/dxbc/dxbc_debug.cpp @@ -25,6 +25,7 @@ #include "dxbc_debug.h" #include +#include "common/formatting.h" #include "driver/dxgi/dxgi_common.h" #include "maths/formatpacking.h" #include "replay/replay_driver.h" diff --git a/renderdoc/driver/shaders/dxbc/dxbc_reflect.cpp b/renderdoc/driver/shaders/dxbc/dxbc_reflect.cpp index 9fc960539..823d3ae05 100644 --- a/renderdoc/driver/shaders/dxbc/dxbc_reflect.cpp +++ b/renderdoc/driver/shaders/dxbc/dxbc_reflect.cpp @@ -24,6 +24,7 @@ #include "dxbc_reflect.h" #include "api/replay/renderdoc_replay.h" +#include "common/formatting.h" #include "core/core.h" #include "dxbc_container.h" diff --git a/renderdoc/driver/shaders/dxbc/dxbc_spdb.cpp b/renderdoc/driver/shaders/dxbc/dxbc_spdb.cpp index f29189c7b..c9d2e7898 100644 --- a/renderdoc/driver/shaders/dxbc/dxbc_spdb.cpp +++ b/renderdoc/driver/shaders/dxbc/dxbc_spdb.cpp @@ -24,6 +24,7 @@ ******************************************************************************/ #include +#include "common/formatting.h" #include "dxbc_container.h" #include "official/cvinfo.h" diff --git a/renderdoc/driver/shaders/dxbc/precompiled.h b/renderdoc/driver/shaders/dxbc/precompiled.h index 5558a29b4..5a024245a 100644 --- a/renderdoc/driver/shaders/dxbc/precompiled.h +++ b/renderdoc/driver/shaders/dxbc/precompiled.h @@ -27,3 +27,4 @@ #include "api/app/renderdoc_app.h" #include "api/replay/renderdoc_replay.h" #include "common/common.h" +#include "os/os_specific.h" diff --git a/renderdoc/driver/shaders/dxil/dxil_bytecode.cpp b/renderdoc/driver/shaders/dxil/dxil_bytecode.cpp index e86e38531..7d6a255e3 100644 --- a/renderdoc/driver/shaders/dxil/dxil_bytecode.cpp +++ b/renderdoc/driver/shaders/dxil/dxil_bytecode.cpp @@ -27,6 +27,7 @@ #include #include #include "common/common.h" +#include "common/formatting.h" #include "llvm_decoder.h" // undef some annoying defines that might come from OS headers diff --git a/renderdoc/driver/shaders/dxil/precompiled.h b/renderdoc/driver/shaders/dxil/precompiled.h index 5558a29b4..5a024245a 100644 --- a/renderdoc/driver/shaders/dxil/precompiled.h +++ b/renderdoc/driver/shaders/dxil/precompiled.h @@ -27,3 +27,4 @@ #include "api/app/renderdoc_app.h" #include "api/replay/renderdoc_replay.h" #include "common/common.h" +#include "os/os_specific.h" diff --git a/renderdoc/driver/shaders/spirv/gen_spirv_code.py b/renderdoc/driver/shaders/spirv/gen_spirv_code.py index f5e7c0ba9..819262f3f 100644 --- a/renderdoc/driver/shaders/spirv/gen_spirv_code.py +++ b/renderdoc/driver/shaders/spirv/gen_spirv_code.py @@ -264,6 +264,7 @@ cpp.write('''{copyright} #include "spirv_gen.h" #include "os/os_specific.h" +#include "common/formatting.h" #include "spirv_op_helpers.h" '''.format(copyright = copyright)) diff --git a/renderdoc/driver/shaders/spirv/glslang_compile.cpp b/renderdoc/driver/shaders/spirv/glslang_compile.cpp index 9ec84906a..ee13882df 100644 --- a/renderdoc/driver/shaders/spirv/glslang_compile.cpp +++ b/renderdoc/driver/shaders/spirv/glslang_compile.cpp @@ -23,6 +23,7 @@ ******************************************************************************/ #include "glslang_compile.h" +#include "api/replay/rdcstr.h" #include "common/common.h" #undef min diff --git a/renderdoc/driver/shaders/spirv/precompiled.h b/renderdoc/driver/shaders/spirv/precompiled.h index 5558a29b4..5a024245a 100644 --- a/renderdoc/driver/shaders/spirv/precompiled.h +++ b/renderdoc/driver/shaders/spirv/precompiled.h @@ -27,3 +27,4 @@ #include "api/app/renderdoc_app.h" #include "api/replay/renderdoc_replay.h" #include "common/common.h" +#include "os/os_specific.h" diff --git a/renderdoc/driver/shaders/spirv/spirv_common.cpp b/renderdoc/driver/shaders/spirv/spirv_common.cpp index a93457991..b07767d4b 100644 --- a/renderdoc/driver/shaders/spirv/spirv_common.cpp +++ b/renderdoc/driver/shaders/spirv/spirv_common.cpp @@ -24,6 +24,7 @@ #include "spirv_common.h" #include "common/common.h" +#include "common/formatting.h" template <> rdcstr DoStringise(const rdcspv::Id &el) diff --git a/renderdoc/driver/shaders/spirv/spirv_compile.cpp b/renderdoc/driver/shaders/spirv/spirv_compile.cpp index 70b84f218..040e0e67f 100644 --- a/renderdoc/driver/shaders/spirv/spirv_compile.cpp +++ b/renderdoc/driver/shaders/spirv/spirv_compile.cpp @@ -24,6 +24,7 @@ #include "spirv_compile.h" #include "common/common.h" +#include "common/formatting.h" #include "glslang_compile.h" #undef min diff --git a/renderdoc/driver/shaders/spirv/spirv_disassemble.cpp b/renderdoc/driver/shaders/spirv/spirv_disassemble.cpp index 2a4475112..8ae88d4b2 100644 --- a/renderdoc/driver/shaders/spirv/spirv_disassemble.cpp +++ b/renderdoc/driver/shaders/spirv/spirv_disassemble.cpp @@ -22,6 +22,7 @@ * THE SOFTWARE. ******************************************************************************/ +#include "common/formatting.h" #include "spirv_op_helpers.h" #include "spirv_reflect.h" diff --git a/renderdoc/driver/shaders/spirv/spirv_gen.cpp b/renderdoc/driver/shaders/spirv/spirv_gen.cpp index 2e5dc76d0..8f6037af6 100644 --- a/renderdoc/driver/shaders/spirv/spirv_gen.cpp +++ b/renderdoc/driver/shaders/spirv/spirv_gen.cpp @@ -59,6 +59,7 @@ #include "spirv_gen.h" #include "os/os_specific.h" +#include "common/formatting.h" #include "spirv_op_helpers.h" template <> diff --git a/renderdoc/driver/shaders/spirv/spirv_reflect.cpp b/renderdoc/driver/shaders/spirv/spirv_reflect.cpp index 483f12cad..41ef95221 100644 --- a/renderdoc/driver/shaders/spirv/spirv_reflect.cpp +++ b/renderdoc/driver/shaders/spirv/spirv_reflect.cpp @@ -25,6 +25,7 @@ #include "spirv_reflect.h" #include #include +#include "common/formatting.h" #include "maths/half_convert.h" #include "replay/replay_driver.h" #include "spirv_editor.h" diff --git a/renderdoc/driver/vulkan/precompiled.h b/renderdoc/driver/vulkan/precompiled.h index 512c56f75..38f2f778f 100644 --- a/renderdoc/driver/vulkan/precompiled.h +++ b/renderdoc/driver/vulkan/precompiled.h @@ -27,5 +27,6 @@ #include "api/app/renderdoc_app.h" #include "api/replay/renderdoc_replay.h" #include "common/common.h" +#include "os/os_specific.h" #include "vk_common.h" diff --git a/renderdoc/driver/vulkan/vk_counters.cpp b/renderdoc/driver/vulkan/vk_counters.cpp index ddaafd6b8..54888eb48 100644 --- a/renderdoc/driver/vulkan/vk_counters.cpp +++ b/renderdoc/driver/vulkan/vk_counters.cpp @@ -138,9 +138,9 @@ void VulkanReplay::convertKhrCounterResult(CounterResult &rdcResult, } } -std::vector VulkanReplay::EnumerateCounters() +rdcarray VulkanReplay::EnumerateCounters() { - std::vector ret; + rdcarray ret; VkPhysicalDeviceFeatures availableFeatures = m_pDriver->GetDeviceFeatures(); @@ -186,8 +186,7 @@ std::vector VulkanReplay::EnumerateCounters() if(m_pAMDCounters) { - std::vector amdCounters = m_pAMDCounters->GetPublicCounterIds(); - ret.insert(ret.end(), amdCounters.begin(), amdCounters.end()); + ret.append(m_pAMDCounters->GetPublicCounterIds()); } return ret; @@ -349,7 +348,7 @@ CounterDescription VulkanReplay::DescribeCounter(GPUCounter counterID) struct VulkanAMDDrawCallback : public VulkanDrawcallCallback { VulkanAMDDrawCallback(WrappedVulkan *dev, VulkanReplay *rp, uint32_t &sampleIndex, - std::vector &eventIDs) + rdcarray &eventIDs) : m_pDriver(dev), m_pReplay(rp), m_pSampleId(&sampleIndex), m_pEventIds(&eventIDs) { m_pDriver->SetDrawcallCB(this); @@ -418,17 +417,17 @@ struct VulkanAMDDrawCallback : public VulkanDrawcallCallback uint32_t *m_pSampleId; WrappedVulkan *m_pDriver; VulkanReplay *m_pReplay; - std::vector *m_pEventIds; + rdcarray *m_pEventIds; std::set m_begunCommandBuffers; // events which are the 'same' from being the same command buffer resubmitted // multiple times in the frame. We will only get the full callback when we're // recording the command buffer, and will be given the first EID. After that // we'll just be told which other EIDs alias this event. - std::vector > m_AliasEvents; + rdcarray > m_AliasEvents; }; void VulkanReplay::FillTimersAMD(uint32_t *eventStartID, uint32_t *sampleIndex, - std::vector *eventIDs) + rdcarray *eventIDs) { uint32_t maxEID = m_pDriver->GetMaxEID(); @@ -438,14 +437,14 @@ void VulkanReplay::FillTimersAMD(uint32_t *eventStartID, uint32_t *sampleIndex, m_pDriver->ReplayLog(*eventStartID, maxEID, eReplay_Full); } -std::vector VulkanReplay::FetchCountersAMD(const std::vector &counters) +rdcarray VulkanReplay::FetchCountersAMD(const rdcarray &counters) { GPA_vkContextOpenInfo context = {Unwrap(m_pDriver->GetInstance()), Unwrap(m_pDriver->GetPhysDev()), Unwrap(m_pDriver->GetDev())}; if(!m_pAMDCounters->BeginMeasurementMode(AMDCounters::ApiType::Vk, (void *)&context)) { - return std::vector(); + return {}; } uint32_t sessionID = m_pAMDCounters->CreateSession(); @@ -466,7 +465,7 @@ std::vector VulkanReplay::FetchCountersAMD(const std::vector eventIDs; + rdcarray eventIDs; for(uint32_t i = 0; i < passCount; i++) { @@ -485,7 +484,7 @@ std::vector VulkanReplay::FetchCountersAMD(const std::vectorEndSesssion(sessionID); - std::vector ret = + rdcarray ret = m_pAMDCounters->GetCounterData(sessionID, sampleIndex, eventIDs, counters); for(size_t i = 0; i < m_pAMDDrawCallback->m_AliasEvents.size(); i++) @@ -566,17 +565,17 @@ struct VulkanKHRCallback : public VulkanDrawcallCallback WrappedVulkan *m_pDriver; VulkanReplay *m_pReplay; VkQueryPool m_QueryPool; - std::vector m_Results; + rdcarray m_Results; // events which are the 'same' from being the same command buffer resubmitted // multiple times in the frame. We will only get the full callback when we're // recording the command buffer, and will be given the first EID. After that // we'll just be told which other EIDs alias this event. - std::vector > m_AliasEvents; + rdcarray > m_AliasEvents; }; -std::vector VulkanReplay::FetchCountersKHR(const std::vector &counters) +rdcarray VulkanReplay::FetchCountersKHR(const rdcarray &counters) { - std::vector counterIndices; + rdcarray counterIndices; for(const GPUCounter &c : counters) counterIndices.push_back(FromKHRCounter(c)); @@ -595,7 +594,7 @@ std::vector VulkanReplay::FetchCountersKHR(const std::vector(); + return {}; } uint32_t maxEID = m_pDriver->GetMaxEID(); @@ -638,7 +637,7 @@ std::vector VulkanReplay::FetchCountersKHR(const std::vectorSetSubmitChain(NULL); } - std::vector perfResults; + rdcarray perfResults; perfResults.resize(cb.m_Results.size() * counters.size()); vkr = ObjDisp(dev)->GetQueryPoolResults( @@ -651,7 +650,7 @@ std::vector VulkanReplay::FetchCountersKHR(const std::vectorReleaseProfilingLockKHR(Unwrap(dev)); - std::vector ret; + rdcarray ret; for(size_t i = 0; i < cb.m_Results.size(); i++) { for(size_t c = 0; c < counters.size(); c++) @@ -761,28 +760,28 @@ struct VulkanGPUTimerCallback : public VulkanDrawcallCallback VkQueryPool m_TimeStampQueryPool; VkQueryPool m_OcclusionQueryPool; VkQueryPool m_PipeStatsQueryPool; - std::vector m_Results; + rdcarray m_Results; // events which are the 'same' from being the same command buffer resubmitted // multiple times in the frame. We will only get the full callback when we're // recording the command buffer, and will be given the first EID. After that // we'll just be told which other EIDs alias this event. - std::vector > m_AliasEvents; + rdcarray > m_AliasEvents; }; -std::vector VulkanReplay::FetchCounters(const std::vector &counters) +rdcarray VulkanReplay::FetchCounters(const rdcarray &counters) { uint32_t maxEID = m_pDriver->GetMaxEID(); - std::vector vkCounters; + rdcarray vkCounters; std::copy_if(counters.begin(), counters.end(), std::back_inserter(vkCounters), [](const GPUCounter &c) { return IsGenericCounter(c); }); - std::vector ret; + rdcarray ret; if(m_pAMDCounters) { // Filter out the AMD counters - std::vector amdCounters; + rdcarray amdCounters; std::copy_if(counters.begin(), counters.end(), std::back_inserter(amdCounters), [](const GPUCounter &c) { return IsAMDCounter(c); }); @@ -792,13 +791,12 @@ std::vector VulkanReplay::FetchCounters(const std::vector vkKHRCounters; + rdcarray vkKHRCounters; std::copy_if(counters.begin(), counters.end(), std::back_inserter(vkKHRCounters), [](const GPUCounter &c) { return IsVulkanExtendedCounter(c); }); if(!vkKHRCounters.empty()) { - std::vector khrResults = FetchCountersKHR(vkKHRCounters); - ret.insert(ret.end(), khrResults.begin(), khrResults.end()); + ret.append(FetchCountersKHR(vkKHRCounters)); } VkPhysicalDeviceFeatures availableFeatures = m_pDriver->GetDeviceFeatures(); @@ -896,7 +894,7 @@ std::vector VulkanReplay::FetchCounters(const std::vectorReplayLog(0, maxEID, eReplay_Full); - std::vector m_TimeStampData; + rdcarray m_TimeStampData; m_TimeStampData.resize(cb.m_Results.size() * 2); vkr = ObjDisp(dev)->GetQueryPoolResults( @@ -907,7 +905,7 @@ std::vector VulkanReplay::FetchCounters(const std::vectorDestroyQueryPool(Unwrap(dev), timeStampPool, NULL); - std::vector m_OcclusionData; + rdcarray m_OcclusionData; m_OcclusionData.resize(cb.m_Results.size()); if(occlusionPool != VK_NULL_HANDLE) { @@ -920,7 +918,7 @@ std::vector VulkanReplay::FetchCounters(const std::vectorDestroyQueryPool(Unwrap(dev), occlusionPool, NULL); } - std::vector m_PipeStatsData; + rdcarray m_PipeStatsData; m_PipeStatsData.resize(cb.m_Results.size() * 11); if(pipeStatsPool != VK_NULL_HANDLE) { diff --git a/renderdoc/driver/vulkan/vk_replay.h b/renderdoc/driver/vulkan/vk_replay.h index 6b3d04921..c812aa596 100644 --- a/renderdoc/driver/vulkan/vk_replay.h +++ b/renderdoc/driver/vulkan/vk_replay.h @@ -317,9 +317,9 @@ public: ResourceId GetLiveID(ResourceId id); - std::vector EnumerateCounters(); + rdcarray EnumerateCounters(); CounterDescription DescribeCounter(GPUCounter counterID); - std::vector FetchCounters(const std::vector &counters); + rdcarray FetchCounters(const rdcarray &counters); void PickPixel(ResourceId texture, uint32_t x, uint32_t y, const Subresource &sub, CompType typeCast, float pixel[4]); @@ -722,19 +722,19 @@ private: void CreateTexImageView(VkImage liveIm, const VulkanCreationInfo::Image &iminfo, CompType typeCast, TextureDisplayViews &views); - void FillTimersAMD(uint32_t *eventStartID, uint32_t *sampleIndex, std::vector *eventIDs); + void FillTimersAMD(uint32_t *eventStartID, uint32_t *sampleIndex, rdcarray *eventIDs); - std::vector FetchCountersAMD(const std::vector &counters); + rdcarray FetchCountersAMD(const rdcarray &counters); AMDCounters *m_pAMDCounters = NULL; AMDRGPControl *m_RGP = NULL; VulkanAMDDrawCallback *m_pAMDDrawCallback = NULL; - std::vector FetchCountersKHR(const std::vector &counters); + rdcarray FetchCountersKHR(const rdcarray &counters); - std::vector m_KHRCounters; - std::vector m_KHRCountersDescriptions; + rdcarray m_KHRCounters; + rdcarray m_KHRCountersDescriptions; void convertKhrCounterResult(CounterResult &rdcResult, const VkPerformanceCounterResultKHR &khrResult, diff --git a/renderdoc/maths/formatpacking.cpp b/renderdoc/maths/formatpacking.cpp index a41af1034..d4bc0efe3 100644 --- a/renderdoc/maths/formatpacking.cpp +++ b/renderdoc/maths/formatpacking.cpp @@ -25,6 +25,7 @@ #include "formatpacking.h" #include #include +#include "api/replay/rdcpair.h" #include "common/common.h" Vec3f ConvertFromR11G11B10(uint32_t data) diff --git a/renderdoc/os/os_specific.h b/renderdoc/os/os_specific.h index 47be87bde..440636360 100644 --- a/renderdoc/os/os_specific.h +++ b/renderdoc/os/os_specific.h @@ -450,8 +450,6 @@ int vsnprintf(char *str, size_t bufSize, const char *format, va_list v); int snprintf(char *str, size_t bufSize, const char *format, ...); void sntimef(char *str, size_t bufSize, const char *format); - -rdcstr Fmt(const char *format, ...); }; namespace OSUtility @@ -513,14 +511,9 @@ inline uint64_t CountLeadingZeroes(uint64_t value); }; // must #define: -// __PRETTY_FUNCTION_SIGNATURE__ - undecorated function signature // GetEmbeddedResource(name_with_underscores_ext) - function/inline that returns the given file in a // rdcstr -// OS_DEBUG_BREAK() - instruction that debugbreaks the debugger - define instead of function to -// preserve callstacks // EndianSwapXX() for XX = 16, 32, 64 -// DELIBERATE_FALLTHROUGH(); - maps either to something to silence deliberate fallthrough warnings, -// or an empty string, depending on compiler support #if ENABLED(RDOC_WIN32) #include "win32/win32_specific.h" diff --git a/renderdoc/os/posix/android/android_callstack.cpp b/renderdoc/os/posix/android/android_callstack.cpp index c1a539410..cfdcb9419 100644 --- a/renderdoc/os/posix/android/android_callstack.cpp +++ b/renderdoc/os/posix/android/android_callstack.cpp @@ -22,6 +22,7 @@ * THE SOFTWARE. ******************************************************************************/ +#include "common/common.h" #include "os/os_specific.h" class AndroidCallstack : public Callstack::Stackwalk diff --git a/renderdoc/os/posix/android/android_process.cpp b/renderdoc/os/posix/android/android_process.cpp index 67b2b583e..e46c31d84 100644 --- a/renderdoc/os/posix/android/android_process.cpp +++ b/renderdoc/os/posix/android/android_process.cpp @@ -23,6 +23,8 @@ ******************************************************************************/ #include +#include "common/common.h" +#include "common/formatting.h" #include "os/os_specific.h" #include "strings/string_utils.h" diff --git a/renderdoc/os/posix/android/android_stringio.cpp b/renderdoc/os/posix/android/android_stringio.cpp index 9941b6dff..42799ed29 100644 --- a/renderdoc/os/posix/android/android_stringio.cpp +++ b/renderdoc/os/posix/android/android_stringio.cpp @@ -25,6 +25,7 @@ #include #include #include +#include "common/common.h" #include "os/os_specific.h" #define LOGCAT_TAG "renderdoc" diff --git a/renderdoc/os/posix/apple/apple_callstack.cpp b/renderdoc/os/posix/apple/apple_callstack.cpp index 9e96386ac..a08e0e9f0 100644 --- a/renderdoc/os/posix/apple/apple_callstack.cpp +++ b/renderdoc/os/posix/apple/apple_callstack.cpp @@ -22,6 +22,7 @@ * THE SOFTWARE. ******************************************************************************/ +#include "common/common.h" #include "os/os_specific.h" class AndroidCallstack : public Callstack::Stackwalk diff --git a/renderdoc/os/posix/apple/apple_hook.cpp b/renderdoc/os/posix/apple/apple_hook.cpp index e51256a64..b54b7714e 100644 --- a/renderdoc/os/posix/apple/apple_hook.cpp +++ b/renderdoc/os/posix/apple/apple_hook.cpp @@ -28,6 +28,7 @@ #include #include #include +#include "common/common.h" #include "common/threading.h" #include "hooks/hooks.h" #include "strings/string_utils.h" diff --git a/renderdoc/os/posix/apple/apple_process.cpp b/renderdoc/os/posix/apple/apple_process.cpp index dccd84a47..e93c2cc92 100644 --- a/renderdoc/os/posix/apple/apple_process.cpp +++ b/renderdoc/os/posix/apple/apple_process.cpp @@ -27,6 +27,8 @@ #include #include #include +#include "common/common.h" +#include "common/formatting.h" #include "os/os_specific.h" char **GetCurrentEnvironment() diff --git a/renderdoc/os/posix/apple/apple_stringio.cpp b/renderdoc/os/posix/apple/apple_stringio.cpp index 011028041..4752a83a4 100644 --- a/renderdoc/os/posix/apple/apple_stringio.cpp +++ b/renderdoc/os/posix/apple/apple_stringio.cpp @@ -31,6 +31,7 @@ #include #include #include +#include "common/common.h" #include "common/threading.h" #include "os/os_specific.h" diff --git a/renderdoc/os/posix/ggp/ggp_callstack.cpp b/renderdoc/os/posix/ggp/ggp_callstack.cpp index a7df649c5..36979bd40 100644 --- a/renderdoc/os/posix/ggp/ggp_callstack.cpp +++ b/renderdoc/os/posix/ggp/ggp_callstack.cpp @@ -27,6 +27,8 @@ #include #include #include +#include "common/common.h" +#include "common/formatting.h" #include "os/os_specific.h" void *renderdocBase = NULL; diff --git a/renderdoc/os/posix/ggp/ggp_process.cpp b/renderdoc/os/posix/ggp/ggp_process.cpp index a6fc1da7d..e9b6f7fe4 100644 --- a/renderdoc/os/posix/ggp/ggp_process.cpp +++ b/renderdoc/os/posix/ggp/ggp_process.cpp @@ -24,6 +24,9 @@ #include #include +#include "api/replay/data_types.h" +#include "common/common.h" +#include "common/formatting.h" #include "os/os_specific.h" extern char **environ; diff --git a/renderdoc/os/posix/ggp/ggp_stringio.cpp b/renderdoc/os/posix/ggp/ggp_stringio.cpp index 8d45f8f75..c58e22f15 100644 --- a/renderdoc/os/posix/ggp/ggp_stringio.cpp +++ b/renderdoc/os/posix/ggp/ggp_stringio.cpp @@ -33,6 +33,7 @@ #include #include #include "api/app/renderdoc_app.h" +#include "common/common.h" #include "common/threading.h" #include "os/os_specific.h" #include "strings/string_utils.h" diff --git a/renderdoc/os/posix/linux/linux_callstack.cpp b/renderdoc/os/posix/linux/linux_callstack.cpp index d11013abf..af7e811c5 100644 --- a/renderdoc/os/posix/linux/linux_callstack.cpp +++ b/renderdoc/os/posix/linux/linux_callstack.cpp @@ -27,6 +27,8 @@ #include #include #include +#include "common/common.h" +#include "common/formatting.h" #include "os/os_specific.h" void *renderdocBase = NULL; diff --git a/renderdoc/os/posix/linux/linux_process.cpp b/renderdoc/os/posix/linux/linux_process.cpp index de3a79e50..b94b4989c 100644 --- a/renderdoc/os/posix/linux/linux_process.cpp +++ b/renderdoc/os/posix/linux/linux_process.cpp @@ -24,6 +24,9 @@ #include #include +#include "api/replay/data_types.h" +#include "common/common.h" +#include "common/formatting.h" #include "os/os_specific.h" extern char **environ; diff --git a/renderdoc/os/posix/linux/linux_stringio.cpp b/renderdoc/os/posix/linux/linux_stringio.cpp index 4793f4f66..8d9d46ae2 100644 --- a/renderdoc/os/posix/linux/linux_stringio.cpp +++ b/renderdoc/os/posix/linux/linux_stringio.cpp @@ -34,6 +34,8 @@ #include #include #include "api/app/renderdoc_app.h" +#include "api/replay/replay_enums.h" +#include "common/common.h" #include "common/threading.h" #include "os/os_specific.h" #include "strings/string_utils.h" @@ -41,16 +43,23 @@ #if ENABLED(RDOC_XLIB) #include #include +#else +typedef struct _XDisplay Display; #endif #if ENABLED(RDOC_XCB) #include #include +#else +struct xcb_connection_t; #endif #if ENABLED(RDOC_WAYLAND) #include #include +#else +struct wl_display; +struct wl_surface; #endif namespace Keyboard diff --git a/renderdoc/os/posix/posix_network.cpp b/renderdoc/os/posix/posix_network.cpp index 3d6471ae5..51a14dd96 100644 --- a/renderdoc/os/posix/posix_network.cpp +++ b/renderdoc/os/posix/posix_network.cpp @@ -35,6 +35,9 @@ #include #include #include +#include "api/replay/data_types.h" +#include "common/common.h" +#include "common/formatting.h" #include "os/os_specific.h" #include "strings/string_utils.h" diff --git a/renderdoc/os/posix/posix_process.cpp b/renderdoc/os/posix/posix_process.cpp index 0f8cb2ecc..efd2a622c 100644 --- a/renderdoc/os/posix/posix_process.cpp +++ b/renderdoc/os/posix/posix_process.cpp @@ -33,7 +33,9 @@ #include #include #include -#include "api/app/renderdoc_app.h" +//#include "api/app/renderdoc_app.h" +#include "api/replay/capture_options.h" +#include "api/replay/control_types.h" #include "common/threading.h" #include "os/os_specific.h" #include "strings/string_utils.h" diff --git a/renderdoc/os/posix/posix_specific.h b/renderdoc/os/posix/posix_specific.h index 50cb7ca5f..2831d056b 100644 --- a/renderdoc/os/posix/posix_specific.h +++ b/renderdoc/os/posix/posix_specific.h @@ -28,8 +28,6 @@ #include #include "data/embedded_files.h" -#define __PRETTY_FUNCTION_SIGNATURE__ __PRETTY_FUNCTION__ - // this works on all supported clang versions #if defined(__clang__) @@ -49,8 +47,6 @@ #endif -#define OS_DEBUG_BREAK() raise(SIGTRAP) - #if ENABLED(RDOC_APPLE) #include diff --git a/renderdoc/os/posix/posix_stringio.cpp b/renderdoc/os/posix/posix_stringio.cpp index 28b732949..16e95ca72 100644 --- a/renderdoc/os/posix/posix_stringio.cpp +++ b/renderdoc/os/posix/posix_stringio.cpp @@ -37,6 +37,7 @@ #include #include #include "api/app/renderdoc_app.h" +#include "api/replay/data_types.h" #include "common/threading.h" #include "os/os_specific.h" #include "strings/string_utils.h" diff --git a/renderdoc/os/posix/posix_threading.cpp b/renderdoc/os/posix/posix_threading.cpp index f8a79e799..41965211d 100644 --- a/renderdoc/os/posix/posix_threading.cpp +++ b/renderdoc/os/posix/posix_threading.cpp @@ -24,6 +24,7 @@ #include #include +#include "common/common.h" #include "os/os_specific.h" void CacheDebuggerPresent(); diff --git a/renderdoc/os/win32/win32_callstack.cpp b/renderdoc/os/win32/win32_callstack.cpp index ca0299da9..03e02651a 100644 --- a/renderdoc/os/win32/win32_callstack.cpp +++ b/renderdoc/os/win32/win32_callstack.cpp @@ -35,6 +35,7 @@ #include #include #include +#include "common/formatting.h" #include "core/core.h" #include "dbghelp/dbghelp.h" #include "os/os_specific.h" diff --git a/renderdoc/os/win32/win32_network.cpp b/renderdoc/os/win32/win32_network.cpp index ec7826a3f..dbbb8e084 100644 --- a/renderdoc/os/win32/win32_network.cpp +++ b/renderdoc/os/win32/win32_network.cpp @@ -26,6 +26,7 @@ #include #include #include "common/common.h" +#include "common/formatting.h" #include "os/os_specific.h" #ifndef WSA_FLAG_NO_HANDLE_INHERIT diff --git a/renderdoc/os/win32/win32_process.cpp b/renderdoc/os/win32/win32_process.cpp index 04ce0ace1..c60adb249 100644 --- a/renderdoc/os/win32/win32_process.cpp +++ b/renderdoc/os/win32/win32_process.cpp @@ -30,6 +30,7 @@ #include #include #include +#include "common/formatting.h" #include "core/core.h" #include "os/os_specific.h" #include "strings/string_utils.h" diff --git a/renderdoc/os/win32/win32_specific.h b/renderdoc/os/win32/win32_specific.h index e79d4ed0a..784a8b0f9 100644 --- a/renderdoc/os/win32/win32_specific.h +++ b/renderdoc/os/win32/win32_specific.h @@ -33,15 +33,6 @@ #include #include "data/resource.h" -#define __PRETTY_FUNCTION_SIGNATURE__ __FUNCSIG__ - -#define OS_DEBUG_BREAK() __debugbreak() - -#define DELIBERATE_FALLTHROUGH() \ - do \ - { \ - } while(0) - #define EndianSwap16(x) _byteswap_ushort(x) #define EndianSwap32(x) _byteswap_ulong(x) #define EndianSwap64(x) _byteswap_uint64(x) diff --git a/renderdoc/os/win32/win32_stringio.cpp b/renderdoc/os/win32/win32_stringio.cpp index 0a2d9c6e8..7bb17cbab 100644 --- a/renderdoc/os/win32/win32_stringio.cpp +++ b/renderdoc/os/win32/win32_stringio.cpp @@ -32,7 +32,9 @@ #include #include #include "api/app/renderdoc_app.h" +#include "api/replay/data_types.h" #include "common/common.h" +#include "common/formatting.h" #include "os/os_specific.h" #include "strings/string_utils.h" diff --git a/renderdoc/renderdoc.vcxproj b/renderdoc/renderdoc.vcxproj index f8b54abe8..9680a3924 100644 --- a/renderdoc/renderdoc.vcxproj +++ b/renderdoc/renderdoc.vcxproj @@ -181,6 +181,7 @@ + diff --git a/renderdoc/renderdoc.vcxproj.filters b/renderdoc/renderdoc.vcxproj.filters index 6865f9a8c..0039bcd3e 100644 --- a/renderdoc/renderdoc.vcxproj.filters +++ b/renderdoc/renderdoc.vcxproj.filters @@ -501,6 +501,9 @@ API\Replay + + Common + diff --git a/renderdoc/replay/app_api.cpp b/renderdoc/replay/app_api.cpp index 82f48a471..cb835382c 100644 --- a/renderdoc/replay/app_api.cpp +++ b/renderdoc/replay/app_api.cpp @@ -24,8 +24,9 @@ #include #include "api/app/renderdoc_app.h" -#include "api/replay/renderdoc_replay.h" // for RENDERDOC_API to export the RENDERDOC_GetAPI function +#include "api/replay/apidefs.h" // for RENDERDOC_API to export the RENDERDOC_GetAPI function #include "common/common.h" +#include "common/formatting.h" #include "core/core.h" #include "hooks/hooks.h" #include "serialise/rdcfile.h" diff --git a/renderdoc/replay/entry_points.cpp b/renderdoc/replay/entry_points.cpp index 134849dbe..1da2b2c54 100644 --- a/renderdoc/replay/entry_points.cpp +++ b/renderdoc/replay/entry_points.cpp @@ -27,6 +27,7 @@ #include "api/replay/renderdoc_replay.h" #include "api/replay/version.h" #include "common/common.h" +#include "common/formatting.h" #include "core/core.h" #include "maths/camera.h" #include "maths/formatpacking.h" @@ -226,17 +227,30 @@ extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetDebugLogFile(const char extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_LogText(const char *text) { - rdclog_direct(Timing::GetUTCTime(), Process::GetCurrentPID(), LogType::Comment, "EXT", "external", - 0, "%s", text); + rdclog_direct(FILL_AUTO_VALUE, FILL_AUTO_VALUE, LogType::Comment, "EXT", "external", 0, "%s", text); } extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_LogMessage(LogType type, const char *project, const char *file, unsigned int line, const char *text) { - rdclog_direct(Timing::GetUTCTime(), Process::GetCurrentPID(), type, project ? project : "UNK?", + rdclog_direct(FILL_AUTO_VALUE, FILL_AUTO_VALUE, type, project ? project : "UNK?", file ? file : "unknown", line, "%s", text); + // see comment in common.h + RDCCOMPILE_ASSERT((uint32_t)LogType::Debug == (uint32_t)LogType__Internal::Debug, + "External and internal LogType enums must match"); + RDCCOMPILE_ASSERT((uint32_t)LogType::Comment == (uint32_t)LogType__Internal::Comment, + "External and internal LogType enums must match"); + RDCCOMPILE_ASSERT((uint32_t)LogType::Warning == (uint32_t)LogType__Internal::Warning, + "External and internal LogType enums must match"); + RDCCOMPILE_ASSERT((uint32_t)LogType::Error == (uint32_t)LogType__Internal::Error, + "External and internal LogType enums must match"); + RDCCOMPILE_ASSERT((uint32_t)LogType::Fatal == (uint32_t)LogType__Internal::Fatal, + "External and internal LogType enums must match"); + RDCCOMPILE_ASSERT(ENUM_ARRAY_SIZE(LogType) == 5, + "External and internal LogType enums must match"); + #if ENABLED(DEBUGBREAK_ON_ERROR_LOG) if(type == LogType::Error) RDCBREAK(); diff --git a/renderdoc/replay/replay_controller.cpp b/renderdoc/replay/replay_controller.cpp index b0c4f7751..10c8ef654 100644 --- a/renderdoc/replay/replay_controller.cpp +++ b/renderdoc/replay/replay_controller.cpp @@ -539,9 +539,7 @@ rdcarray ReplayController::FetchCounters(const rdcarray counterArray(counters.begin(), counters.end()); - - return m_pDevice->FetchCounters(counterArray); + return m_pDevice->FetchCounters(counters); } rdcarray ReplayController::EnumerateCounters() diff --git a/renderdoc/replay/replay_controller.h b/renderdoc/replay/replay_controller.h index a9e8cc149..dc7e9a684 100644 --- a/renderdoc/replay/replay_controller.h +++ b/renderdoc/replay/replay_controller.h @@ -233,7 +233,7 @@ private: uint64_t m_ThreadID; APIProperties m_APIProps; - std::vector m_GCNTargets; + rdcarray m_GCNTargets; volatile int32_t m_ReplayLoopCancel = 0; volatile int32_t m_ReplayLoopFinished = 0; diff --git a/renderdoc/replay/replay_driver.h b/renderdoc/replay/replay_driver.h index ec1aa94af..170f25133 100644 --- a/renderdoc/replay/replay_driver.h +++ b/renderdoc/replay/replay_driver.h @@ -29,6 +29,39 @@ #include "core/core.h" #include "maths/vec.h" +template +struct BucketForRecord +{ + static size_t Get(size_t value); +}; + +template +struct BucketForRecord +{ + static size_t Get(size_t value) + { + const size_t size = T::BucketSize; + const size_t count = T::BucketCount; + const size_t maximum = size * count; + const size_t index = (value < maximum) ? (value / size) : (count - 1); + return index; + } +}; + +template +struct BucketForRecord +{ + static size_t Get(size_t value) + { + const size_t count = T::BucketCount; + static_assert(count <= (sizeof(size_t) * 8), + "Unexpected correspondence between bucket size and sizeof(size_t)"); + const size_t maximum = (size_t)1 << count; + const size_t index = (value < maximum) ? (size_t)(Log2Floor(value)) : (count - 1); + return index; + } +}; + struct FrameRecord { FrameDescription frameInfo; @@ -135,9 +168,9 @@ public: virtual void RemoveReplacement(ResourceId id) = 0; virtual void FreeTargetResource(ResourceId id) = 0; - virtual std::vector EnumerateCounters() = 0; + virtual rdcarray EnumerateCounters() = 0; virtual CounterDescription DescribeCounter(GPUCounter counterID) = 0; - virtual std::vector FetchCounters(const std::vector &counterID) = 0; + virtual rdcarray FetchCounters(const rdcarray &counterID) = 0; virtual void FillCBufferVariables(ResourceId pipeline, ResourceId shader, std::string entryPoint, uint32_t cbufSlot, rdcarray &outvars, diff --git a/renderdoc/serialise/codecs/chrome_json_codec.cpp b/renderdoc/serialise/codecs/chrome_json_codec.cpp index 1d51df453..71bf2dea1 100644 --- a/renderdoc/serialise/codecs/chrome_json_codec.cpp +++ b/renderdoc/serialise/codecs/chrome_json_codec.cpp @@ -24,6 +24,7 @@ #include #include "common/common.h" +#include "common/formatting.h" #include "serialise/rdcfile.h" ReplayStatus exportChrome(const char *filename, const RDCFile &rdc, const SDFile &structData, diff --git a/renderdoc/serialise/codecs/xml_codec.cpp b/renderdoc/serialise/codecs/xml_codec.cpp index 2114f15f8..702b4296f 100644 --- a/renderdoc/serialise/codecs/xml_codec.cpp +++ b/renderdoc/serialise/codecs/xml_codec.cpp @@ -24,6 +24,7 @@ #include #include "common/common.h" +#include "common/formatting.h" #include "serialise/rdcfile.h" #include "3rdparty/miniz/miniz.h" diff --git a/renderdoc/serialise/rdcfile.cpp b/renderdoc/serialise/rdcfile.cpp index 54421cc06..23167b345 100644 --- a/renderdoc/serialise/rdcfile.cpp +++ b/renderdoc/serialise/rdcfile.cpp @@ -28,6 +28,7 @@ #include "3rdparty/stb/stb_image.h" #include "api/replay/version.h" #include "common/dds_readwrite.h" +#include "common/formatting.h" #include "lz4io.h" #include "zstdio.h" diff --git a/renderdoc/serialise/serialiser.h b/renderdoc/serialise/serialiser.h index 845c30537..c2cfae924 100644 --- a/renderdoc/serialise/serialiser.h +++ b/renderdoc/serialise/serialiser.h @@ -29,6 +29,7 @@ #include #include #include "api/replay/renderdoc_replay.h" +#include "common/formatting.h" #include "streamio.h" // function to deallocate anything from a serialise. Default impl diff --git a/renderdoc/serialise/streamio.h b/renderdoc/serialise/streamio.h index 8ee00fa87..92f97957d 100644 --- a/renderdoc/serialise/streamio.h +++ b/renderdoc/serialise/streamio.h @@ -28,6 +28,7 @@ #include #include #include "common/common.h" +#include "os/os_specific.h" enum class Ownership { diff --git a/renderdoc/strings/utf8printf.cpp b/renderdoc/strings/utf8printf.cpp index 18f009438..d22bbbc04 100644 --- a/renderdoc/strings/utf8printf.cpp +++ b/renderdoc/strings/utf8printf.cpp @@ -23,6 +23,7 @@ ******************************************************************************/ #include "common/common.h" +#include "os/os_specific.h" // grisu2 double-to-string function, returns number of digits written to digits array int grisu2(uint64_t mantissa, int exponent, char digits[18], int &kout); @@ -1454,6 +1455,7 @@ int utf8printf(char *buf, size_t bufsize, const char *fmt, va_list args) #if ENABLED(ENABLE_UNIT_TESTS) #include "3rdparty/catch/catch.hpp" +#include "common/formatting.h" int utf8printf_wrapper(char *buf, size_t bufsize, const char *fmt, ...) {