class MemoryLayout { public: enumclass Standard { // GLSL std140 layout as described in OpenGL Spec v4.5, 7.6.2.2.
k140,
// GLSL std430 layout. This layout is like std140 but with optimizations. This layout can // ONLY be used with shader storage blocks.
k430,
// MSL memory layout.
kMetal,
// WebGPU Shading Language buffer layout constraints for the uniform address space.
kWGSLUniform_Base, // treats f16 as a full 32-bit float
kWGSLUniform_EnableF16, // treats f16 as a 16-bit half float
// WebGPU Shading Language buffer layout constraints for the storage address space.
kWGSLStorage_Base,
kWGSLStorage_EnableF16,
};
/** *Returnsatype'srequiredalignmentwhenusedasastandalonevariable.
*/
size_t alignment(const Type& type) const { // See OpenGL Spec 7.6.2.2 Standard Uniform Block Layout switch (type.typeKind()) { case Type::TypeKind::kScalar: case Type::TypeKind::kAtomic: returnthis->size(type);
case Type::TypeKind::kVector: return GetVectorAlignment(this->size(type.componentType()), type.columns());
case Type::TypeKind::kMatrix: returnthis->roundUpIfNeeded(
GetVectorAlignment(this->size(type.componentType()), type.rows()),
type.typeKind());
case Type::TypeKind::kArray: returnthis->roundUpIfNeeded(this->alignment(type.componentType()),
type.typeKind());
case Type::TypeKind::kStruct: {
size_t result = 0; for (constauto& f : type.fields()) {
size_t alignment = this->alignment(*f.fType); if (alignment > result) {
result = alignment;
}
} returnthis->roundUpIfNeeded(result, type.typeKind());
} default:
SK_ABORT("cannot determine alignment of type '%s'", type.displayName().c_str());
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.