mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-20 22:41:36 +00:00
Fix matching variable-less buffer formats
* It's convenient and we sometimes automatically create formats that are just 'xint' so make sure they parse correctly.
This commit is contained in:
@@ -553,7 +553,8 @@ ParsedFormat BufferFormatter::ParseFormatString(const QString &formatString, uin
|
||||
"(?<mat>x[1-9])?" // or a matrix
|
||||
"(" // pointer or space
|
||||
"(?<ptr>\\s*\\*\\s*)|" // pointer asterisk
|
||||
"\\s+" // or just some whitespace
|
||||
"\\s+|" // or just some whitespace
|
||||
"$" // or the end, if it's nameless
|
||||
")" // end pointer or space
|
||||
"(?<name>[A-Za-z@_][A-Za-z0-9@_]*)?" // get identifier name
|
||||
"(?<array>\\s*\\[[0-9]*\\])?" // optional array dimension
|
||||
@@ -4341,6 +4342,24 @@ TEST_CASE("Buffer format parsing", "[formatter]")
|
||||
}
|
||||
};
|
||||
|
||||
SECTION("variable-less quick formats")
|
||||
{
|
||||
parsed = BufferFormatter::ParseFormatString(lit("float"), 0, true);
|
||||
|
||||
CHECK(parsed.errors.isEmpty());
|
||||
CHECK(parsed.repeating.type.members.empty());
|
||||
REQUIRE(parsed.fixed.type.members.size() == 1);
|
||||
CHECK((parsed.fixed.type.members[0].type == float_type));
|
||||
|
||||
parsed = BufferFormatter::ParseFormatString(lit("int4"), 0, true);
|
||||
|
||||
CHECK(parsed.errors.isEmpty());
|
||||
CHECK(parsed.repeating.type.members.empty());
|
||||
REQUIRE(parsed.fixed.type.members.size() == 1);
|
||||
CHECK(parsed.fixed.type.members[0].type.baseType == VarType::SInt);
|
||||
CHECK(parsed.fixed.type.members[0].type.columns == 4);
|
||||
};
|
||||
|
||||
SECTION("C-style sized formats")
|
||||
{
|
||||
parsed = BufferFormatter::ParseFormatString(lit("float32_t a;"), 0, true);
|
||||
|
||||
Reference in New Issue
Block a user