MCPcopy Create free account
hub / github.com/baldurk/renderdoc / CheckInvalidUnbounded

Method CheckInvalidUnbounded

qrenderdoc/Code/BufferFormatter.cpp:502–538  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

500}
501
502bool BufferFormatter::CheckInvalidUnbounded(const StructFormatData &structData,
503 const QMap<QString, StructFormatData> &structelems,
504 QMap<int, QString> &errors)
505{
506 const ShaderConstant &def = structData.structDef;
507
508 for(size_t i = 0; i < def.type.members.size(); i++)
509 {
510 const bool isLast = i == def.type.members.size() - 1;
511
512 // if it's not the last member and it's unbounded, that's a problem!
513 if(!isLast && def.type.members[i].type.elements == ~0U)
514 {
515 int line = structData.lineMemberDefs[(int)i];
516 errors[line] = tr("Only the last member of a struct can be an unbounded array.");
517 return false;
518 }
519
520 // if it's not the last member, no child can have an unbounded array
521 rdcpair<rdcstr, rdcstr> unbounded;
522 if(!isLast && ContainsUnbounded(def.type.members[i], &unbounded))
523 {
524 int line = structData.lineMemberDefs[(int)i];
525 errors[line] =
526 tr("Only the last member of a struct can contain an unbounded array. %1 in %2 is "
527 "unbounded.")
528 .arg(unbounded.second)
529 .arg(unbounded.first);
530 return false;
531 }
532
533 if(!CheckInvalidUnbounded(structelems[def.type.members[i].type.name], structelems, errors))
534 return false;
535 }
536
537 return true;
538}
539
540ParsedFormat BufferFormatter::ParseFormatString(const QString &formatString, uint64_t maxLen,
541 bool cbuffer)

Callers

nothing calls this directly

Calls 3

trFunction · 0.70
sizeMethod · 0.45
argMethod · 0.45

Tested by

no test coverage detected