mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-26 20:01:17 +00:00
Tweak SERIALISE_ELEMENT_ARRAY to allow chained properties
* E.g. SERIALISE_ELEMENT_ARRAY(foo, bar).Named("foo_real");
This commit is contained in:
@@ -1213,7 +1213,8 @@ bool WrappedID3D12Device::Serialise_MapDataWrite(SerialiserType &ser, ID3D12Reso
|
||||
|
||||
// we serialise MappedData manually, so that when we don't need it we just skip instead of
|
||||
// actually allocating and memcpy'ing the buffer.
|
||||
ScopedDeserialiseArray<SerialiserType, byte *> deserialise_map(ser, &MappedData);
|
||||
ScopedDeserialiseArray<SerialiserType, byte *> deserialise_map(ser, &MappedData,
|
||||
range.End - range.Begin);
|
||||
SerialiserFlags flags = SerialiserFlags::AllocateMemory;
|
||||
if(alreadyuploaded)
|
||||
{
|
||||
|
||||
@@ -1850,7 +1850,10 @@ struct ScopedDeserialiseArray
|
||||
{
|
||||
typedef typename std::remove_pointer<ptrT>::type T;
|
||||
|
||||
ScopedDeserialiseArray(const SerialiserType &ser, T **el) : m_Ser(ser), m_El(el), count(0) {}
|
||||
ScopedDeserialiseArray(const SerialiserType &ser, T **el, uint64_t c)
|
||||
: m_Ser(ser), m_El(el), count(c)
|
||||
{
|
||||
}
|
||||
~ScopedDeserialiseArray()
|
||||
{
|
||||
if(m_Ser.IsReading())
|
||||
@@ -1860,7 +1863,6 @@ struct ScopedDeserialiseArray
|
||||
delete[] * m_El;
|
||||
}
|
||||
}
|
||||
void setCount(uint64_t c) { count = c; }
|
||||
const SerialiserType &m_Ser;
|
||||
T **m_El;
|
||||
uint64_t count;
|
||||
@@ -1869,13 +1871,12 @@ struct ScopedDeserialiseArray
|
||||
template <class SerialiserType>
|
||||
struct ScopedDeserialiseArray<SerialiserType, void *>
|
||||
{
|
||||
ScopedDeserialiseArray(const SerialiserType &ser, void **el) : m_Ser(ser), m_El(el) {}
|
||||
ScopedDeserialiseArray(const SerialiserType &ser, void **el, uint64_t) : m_Ser(ser), m_El(el) {}
|
||||
~ScopedDeserialiseArray()
|
||||
{
|
||||
if(m_Ser.IsReading())
|
||||
FreeAlignedBuffer((byte *)*m_El);
|
||||
}
|
||||
void setCount(uint64_t c) {}
|
||||
const SerialiserType &m_Ser;
|
||||
void **m_El;
|
||||
};
|
||||
@@ -1883,13 +1884,15 @@ struct ScopedDeserialiseArray<SerialiserType, void *>
|
||||
template <class SerialiserType>
|
||||
struct ScopedDeserialiseArray<SerialiserType, const void *>
|
||||
{
|
||||
ScopedDeserialiseArray(const SerialiserType &ser, const void **el) : m_Ser(ser), m_El(el) {}
|
||||
ScopedDeserialiseArray(const SerialiserType &ser, const void **el, uint64_t)
|
||||
: m_Ser(ser), m_El(el)
|
||||
{
|
||||
}
|
||||
~ScopedDeserialiseArray()
|
||||
{
|
||||
if(m_Ser.IsReading())
|
||||
FreeAlignedBuffer((byte *)*m_El);
|
||||
}
|
||||
void setCount(uint64_t c) {}
|
||||
const SerialiserType &m_Ser;
|
||||
const void **m_El;
|
||||
};
|
||||
@@ -1897,13 +1900,12 @@ struct ScopedDeserialiseArray<SerialiserType, const void *>
|
||||
template <class SerialiserType>
|
||||
struct ScopedDeserialiseArray<SerialiserType, byte *>
|
||||
{
|
||||
ScopedDeserialiseArray(const SerialiserType &ser, byte **el) : m_Ser(ser), m_El(el) {}
|
||||
ScopedDeserialiseArray(const SerialiserType &ser, byte **el, uint64_t) : m_Ser(ser), m_El(el) {}
|
||||
~ScopedDeserialiseArray()
|
||||
{
|
||||
if(m_Ser.IsReading())
|
||||
FreeAlignedBuffer(*m_El);
|
||||
}
|
||||
void setCount(uint64_t c) {}
|
||||
const SerialiserType &m_Ser;
|
||||
byte **m_El;
|
||||
};
|
||||
@@ -1937,9 +1939,8 @@ struct ScopedDeserialiseArray<SerialiserType, byte *>
|
||||
uint64_t CONCAT(dummy_array_count, __LINE__) = 0; \
|
||||
(void)CONCAT(dummy_array_count, __LINE__); \
|
||||
ScopedDeserialiseArray<decltype(GET_SERIALISER), decltype(obj)> CONCAT(deserialise_, __LINE__)( \
|
||||
GET_SERIALISER, &obj); \
|
||||
GET_SERIALISER.Serialise(STRING_LITERAL(#obj), obj, count, SerialiserFlags::AllocateMemory); \
|
||||
CONCAT(deserialise_, __LINE__).setCount(count);
|
||||
GET_SERIALISER, &obj, count); \
|
||||
GET_SERIALISER.Serialise(STRING_LITERAL(#obj), obj, count, SerialiserFlags::AllocateMemory)
|
||||
|
||||
#define SERIALISE_ELEMENT_OPT(obj) \
|
||||
ScopedDeserialiseNullable<decltype(GET_SERIALISER), decltype(obj)> CONCAT( \
|
||||
|
||||
Reference in New Issue
Block a user