MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / AreLayoutCompatibleStructs

Function AreLayoutCompatibleStructs

source/val/validate_memory.cpp:60–72  ·  view source on GitHub ↗

Returns true if the two instructions represent structs that, as far as the validator can tell, have the exact same data layout.

Source from the content-addressed store, hash-verified

58// Returns true if the two instructions represent structs that, as far as the
59// validator can tell, have the exact same data layout.
60bool AreLayoutCompatibleStructs(ValidationState_t& _, const Instruction* type1,
61 const Instruction* type2) {
62 if (type1->opcode() != spv::Op::OpTypeStruct) {
63 return false;
64 }
65 if (type2->opcode() != spv::Op::OpTypeStruct) {
66 return false;
67 }
68
69 if (!HaveLayoutCompatibleMembers(_, type1, type2)) return false;
70
71 return HaveSameLayoutDecorations(_, type1, type2);
72}
73
74// Returns true if the operands to the OpTypeStruct instruction defining the
75// types are the same or are layout compatible types. |type1| and |type2| must

Callers 2

ValidateStoreFunction · 0.85

Calls 3

opcodeMethod · 0.45

Tested by

no test coverage detected