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

Function hasImproperStraddle

source/val/validate_decorations.cpp:414–427  ·  view source on GitHub ↗

A member is defined to improperly straddle if either of the following are true: - It is a vector with total size less than or equal to 16 bytes, and has Offset decorations placing its first byte at F and its last byte at L, where floor(F / 16) != floor(L / 16). - It is a vector with total size greater than 16 bytes and has its Offset decorations placing its first byte at a non-integer multiple of

Source from the content-addressed store, hash-verified

412// - It is a vector with total size greater than 16 bytes and has its Offset
413// decorations placing its first byte at a non-integer multiple of 16.
414bool hasImproperStraddle(uint32_t id, uint32_t offset,
415 const LayoutConstraints& inherited,
416 MemberConstraints& constraints,
417 ValidationState_t& vstate) {
418 const auto size = getSize(id, inherited, constraints, vstate);
419 const auto F = offset;
420 const auto L = offset + size - 1;
421 if (size <= 16) {
422 if ((F >> 4) != (L >> 4)) return true;
423 } else {
424 if (F % 16 != 0) return true;
425 }
426 return false;
427}
428
429// Returns true if |offset| satsifies an alignment to |alignment|. In the case
430// of |alignment| of zero, the |offset| must also be zero.

Callers 1

checkLayoutFunction · 0.85

Calls 1

getSizeFunction · 0.85

Tested by

no test coverage detected