mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-29 21:30:53 +00:00
Fix stringification of bitfields with duplicate values
* We'd previously subtract the bitfield value twice, leading to underflow and then lots of unknown bits appear to be set. Instead we should clear the bit so that it's safe to apply multiple times.
This commit is contained in:
@@ -110,28 +110,28 @@ std::string ToStr(const T &el)
|
||||
#define STRINGISE_BITFIELD_BIT(b) \
|
||||
if(el & b) \
|
||||
{ \
|
||||
local -= (uint32_t)b; \
|
||||
local &= ~uint32_t(b); \
|
||||
ret += " | " #b; \
|
||||
}
|
||||
|
||||
#define STRINGISE_BITFIELD_CLASS_BIT(b) \
|
||||
if(el & enumType::b) \
|
||||
{ \
|
||||
local -= (uint32_t)enumType::b; \
|
||||
local &= ~uint32_t(enumType::b); \
|
||||
ret += " | " #b; \
|
||||
}
|
||||
|
||||
#define STRINGISE_BITFIELD_BIT_NAMED(b, str) \
|
||||
if(el & b) \
|
||||
{ \
|
||||
local -= (uint32_t)b; \
|
||||
local &= ~uint32_t(b); \
|
||||
ret += " | " str; \
|
||||
}
|
||||
|
||||
#define STRINGISE_BITFIELD_CLASS_BIT_NAMED(b, str) \
|
||||
if(el & enumType::b) \
|
||||
{ \
|
||||
local -= (uint32_t)enumType::b; \
|
||||
local &= ~uint32_t(enumType::b); \
|
||||
ret += " | " str; \
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user