mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-20 21:46:52 +00:00
Resolve pending bitfield packing before applying specified field offsets
This commit is contained in:
@@ -1224,6 +1224,7 @@ ParsedFormat BufferFormatter::ParseFormatString(const QString &formatString, uin
|
||||
bool isPadding = false;
|
||||
bool isPointer = false;
|
||||
|
||||
uint32_t specifiedOffset = ~0U;
|
||||
if(structMatch.hasMatch() && structelems.contains(structMatch.captured(1)))
|
||||
{
|
||||
StructFormatData &structContext = structelems[structMatch.captured(1)];
|
||||
@@ -1257,7 +1258,6 @@ ParsedFormat BufferFormatter::ParseFormatString(const QString &formatString, uin
|
||||
if(varName.isEmpty())
|
||||
varName = lit("data");
|
||||
|
||||
uint32_t specifiedOffset = ~0U;
|
||||
for(const Annotation &annot : annotations)
|
||||
{
|
||||
if(annot.name == lit("offset") || annot.name == lit("byte_offset"))
|
||||
@@ -1834,19 +1834,7 @@ ParsedFormat BufferFormatter::ParseFormatString(const QString &formatString, uin
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t specifiedOffset = annot.param.toUInt();
|
||||
|
||||
if(specifiedOffset < cur->offset)
|
||||
{
|
||||
reportError(tr("Specified byte offset %1 overlaps with previous data.\n"
|
||||
"This value must be at byte offset %2 at minimum.")
|
||||
.arg(specifiedOffset)
|
||||
.arg(cur->offset));
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
|
||||
cur->offset = specifiedOffset;
|
||||
specifiedOffset = annot.param.toUInt();
|
||||
}
|
||||
else if(annot.name == lit("pad") || annot.name == lit("padding"))
|
||||
{
|
||||
@@ -2102,6 +2090,28 @@ ParsedFormat BufferFormatter::ParseFormatString(const QString &formatString, uin
|
||||
}
|
||||
}
|
||||
|
||||
if(specifiedOffset != ~0U)
|
||||
{
|
||||
if(specifiedOffset < cur->offset)
|
||||
{
|
||||
reportError(tr("Specified byte offset %1 overlaps with previous data.\n"
|
||||
"This value must be at byte offset %2 at minimum.")
|
||||
.arg(specifiedOffset)
|
||||
.arg(cur->offset));
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// if we're bitfield packing and we just specified an offset based padding, reset current position
|
||||
if(specifiedOffset > cur->offset)
|
||||
{
|
||||
el.bitFieldOffset = bitfieldCurPos = 0;
|
||||
bitfieldCurPos += el.bitFieldSize;
|
||||
}
|
||||
|
||||
cur->offset = specifiedOffset;
|
||||
}
|
||||
|
||||
el.byteOffset = cur->offset;
|
||||
|
||||
if(!isPadding)
|
||||
|
||||
Reference in New Issue
Block a user