summaryrefslogtreecommitdiff
path: root/tools/gfx/debug-layer/debug-helper-functions.h
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2024-10-29 14:49:26 +0800
committerGitHub <noreply@github.com>2024-10-29 14:49:26 +0800
commitf65d756bff8d4c5cbc15bd0322a2ae8e6b896a21 (patch)
treeea1d61342cd29368e19135000ec2948813096205 /tools/gfx/debug-layer/debug-helper-functions.h
parenta729c15e9dce9f5116a38afc66329ab2ca4cea54 (diff)
format
* format * Minor test fixes * enable checking cpp format in ci
Diffstat (limited to 'tools/gfx/debug-layer/debug-helper-functions.h')
-rw-r--r--tools/gfx/debug-layer/debug-helper-functions.h33
1 files changed, 18 insertions, 15 deletions
diff --git a/tools/gfx/debug-layer/debug-helper-functions.h b/tools/gfx/debug-layer/debug-helper-functions.h
index f2edd0d84..8fad98f8a 100644
--- a/tools/gfx/debug-layer/debug-helper-functions.h
+++ b/tools/gfx/debug-layer/debug-helper-functions.h
@@ -1,7 +1,6 @@
// debug-helper-functions.h
#pragma once
#include "debug-base.h"
-
#include "debug-buffer.h"
#include "debug-command-buffer.h"
#include "debug-command-queue.h"
@@ -29,13 +28,13 @@ namespace debug
{
#ifdef __FUNCSIG__
-# define SLANG_FUNC_SIG __FUNCSIG__
+#define SLANG_FUNC_SIG __FUNCSIG__
#elif defined(__PRETTY_FUNCTION__)
-# define SLANG_FUNC_SIG __FUNCSIG__
+#define SLANG_FUNC_SIG __FUNCSIG__
#elif defined(__FUNCTION__)
-# define SLANG_FUNC_SIG __FUNCTION__
+#define SLANG_FUNC_SIG __FUNCTION__
#else
-# define SLANG_FUNC_SIG "UnknownFunction"
+#define SLANG_FUNC_SIG "UnknownFunction"
#endif
extern thread_local const char* _currentFunctionName;
@@ -50,12 +49,12 @@ struct SetCurrentFuncRAII
/// Returns the public API function name from a `SLANG_FUNC_SIG` string.
String _gfxGetFuncName(const char* input);
-template <typename... TArgs>
+template<typename... TArgs>
char* _gfxDiagnoseFormat(
- char* buffer, // Initial buffer to output formatted string.
- size_t shortBufferSize, // Size of the initial buffer.
+ char* buffer, // Initial buffer to output formatted string.
+ size_t shortBufferSize, // Size of the initial buffer.
List<char>& bufferArray, // A list for allocating a large buffer if needed.
- const char* format, // The format string.
+ const char* format, // The format string.
TArgs... args)
{
int length = sprintf_s(buffer, shortBufferSize, format, args...);
@@ -70,7 +69,7 @@ char* _gfxDiagnoseFormat(
return buffer;
}
-template <typename... TArgs>
+template<typename... TArgs>
void _gfxDiagnoseImpl(DebugMessageType type, const char* format, TArgs... args)
{
char shortBuffer[256];
@@ -103,7 +102,11 @@ void _gfxDiagnoseImpl(DebugMessageType type, const char* format, TArgs... args)
char shortBuffer[256]; \
List<char> bufferArray; \
auto message = _gfxDiagnoseFormat( \
- shortBuffer, sizeof(shortBuffer), bufferArray, format, __VA_ARGS__); \
+ shortBuffer, \
+ sizeof(shortBuffer), \
+ bufferArray, \
+ format, \
+ __VA_ARGS__); \
_gfxDiagnoseImpl( \
type, \
"%s: %s", \
@@ -117,16 +120,16 @@ void _gfxDiagnoseImpl(DebugMessageType type, const char* format, TArgs... args)
I##typeName* Debug##typeName::getInterface(const Slang::Guid& guid) \
{ \
return (guid == GfxGUID::IID_ISlangUnknown || guid == GfxGUID::IID_I##typeName) \
- ? static_cast<I##typeName*>(this) \
- : nullptr; \
+ ? static_cast<I##typeName*>(this) \
+ : nullptr; \
}
#define SLANG_GFX_DEBUG_GET_INTERFACE_IMPL_PARENT(typeName, parentType) \
I##typeName* Debug##typeName::getInterface(const Slang::Guid& guid) \
{ \
return (guid == GfxGUID::IID_ISlangUnknown || guid == GfxGUID::IID_I##typeName || \
guid == GfxGUID::IID_I##parentType) \
- ? static_cast<I##typeName*>(this) \
- : nullptr; \
+ ? static_cast<I##typeName*>(this) \
+ : nullptr; \
}
// Utility conversion functions to get Debug* object or the inner object from a user provided