mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-07 07:46:19 +01:00
50 lines
1.1 KiB
C++
50 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <sstream>
|
|
|
|
#include "log.h"
|
|
|
|
#ifdef _MSC_VER
|
|
#define METHOD_NAME __FUNCSIG__
|
|
#else
|
|
#define METHOD_NAME __PRETTY_FUNCTION__
|
|
#endif
|
|
|
|
#define TRACE_ENABLED
|
|
|
|
#ifdef TRACE_ENABLED
|
|
#define TRACE(...) \
|
|
do { dxvk::debug::trace(METHOD_NAME, ##__VA_ARGS__); } while (0)
|
|
#else
|
|
#define TRACE(...) \
|
|
do { } while (0)
|
|
#endif
|
|
|
|
namespace dxvk::debug {
|
|
|
|
std::string methodName(const std::string& prettyName);
|
|
|
|
inline void traceArgs(std::stringstream& stream) { }
|
|
|
|
template<typename Arg1>
|
|
void traceArgs(std::stringstream& stream, const Arg1& arg1) {
|
|
stream << arg1;
|
|
}
|
|
|
|
template<typename Arg1, typename Arg2, typename... Args>
|
|
void traceArgs(std::stringstream& stream, const Arg1& arg1, const Arg2& arg2, const Args&... args) {
|
|
stream << arg1 << ",";
|
|
traceArgs(stream, arg2, args...);
|
|
}
|
|
|
|
template<typename... Args>
|
|
void trace(const std::string& funcName, const Args&... args) {
|
|
std::stringstream stream;
|
|
stream << methodName(funcName) << "(";
|
|
traceArgs(stream, args...);
|
|
stream << ")";
|
|
Logger::trace(stream.str());
|
|
}
|
|
|
|
}
|