Add SPIRVIterator comparisons and SPIRVId stringification

This commit is contained in:
baldurk
2018-01-08 15:56:02 +00:00
parent 0a29df1f02
commit 78e0a7424f
2 changed files with 15 additions and 0 deletions
@@ -25,6 +25,13 @@
#include "spirv_editor.h"
#include <utility>
#include "common/common.h"
#include "serialise/serialiser.h"
template <>
std::string DoStringise(const SPIRVId &el)
{
return StringFormat::Fmt("%u", el.id);
}
SPIRVScalar::SPIRVScalar(SPIRVIterator it)
{
@@ -29,6 +29,7 @@
#include <string>
#include <vector>
#include "3rdparty/glslang/SPIRV/spirv.hpp"
#include "api/replay/renderdoc_replay.h"
class SPIRVOperation;
class SPIRVEditor;
@@ -44,6 +45,8 @@ struct SPIRVId
uint32_t id;
};
DECLARE_STRINGISE_TYPE(SPIRVId);
// length of 1 word in the top 16-bits, OpNop = 0 in the lower 16-bits
#define SPV_NOP (0x00010000)
@@ -70,6 +73,11 @@ public:
return *this;
}
bool operator==(const SPIRVIterator &it) const
{
return words == it.words && offset == it.offset;
}
bool operator!=(const SPIRVIterator &it) const { return !(*this == it); }
// utility functions
explicit operator bool() const { return words != NULL && offset < words->size(); }
uint32_t &operator*() { return cur(); }