From b0f2f6de580456d461daf26e003823340eeec7c4 Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 14 Feb 2018 00:41:16 +0000 Subject: [PATCH] For bitfields with no values set, return Type(0) instead of "" --- renderdoc/api/replay/stringise.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/renderdoc/api/replay/stringise.h b/renderdoc/api/replay/stringise.h index c9318c2b6..7e789c417 100644 --- a/renderdoc/api/replay/stringise.h +++ b/renderdoc/api/replay/stringise.h @@ -84,6 +84,7 @@ std::string ToStr(const T &el) #define BEGIN_BITFIELD_STRINGISE(type) \ using enumType = type; \ static const char unknown_prefix[] = " | " #type "("; \ + static const char empty_ret[] = #type "(0)"; \ static_assert(std::is_same::value, \ "Type in macro doesn't match el"); \ uint32_t local = (uint32_t)el; \ @@ -138,7 +139,11 @@ std::string ToStr(const T &el) if(local) \ ret += unknown_prefix + ToStr(local) + ")"; \ \ - if(!ret.empty()) \ + if(ret.empty()) \ + { \ + ret = empty_ret; \ + } \ + else \ { \ ret = ret.substr(3); \ } \