| {{- /* |
| -------------------------------------------------------------------------------- |
| Template file for use with tools/src/cmd/gen to generate storage_class.h |
| |
| To update the generated file, run: |
| ./tools/run gen |
| |
| See: |
| * tools/src/cmd/gen for structures used by this template |
| * https://golang.org/pkg/text/template/ for documentation on the template syntax |
| -------------------------------------------------------------------------------- |
| */ -}} |
| |
| {{- Import "src/tint/templates/enums.tmpl.inc" -}} |
| {{- $enum := (Sem.Enum "storage_class") -}} |
| |
| #ifndef SRC_TINT_AST_STORAGE_CLASS_H_ |
| #define SRC_TINT_AST_STORAGE_CLASS_H_ |
| |
| #include <ostream> |
| |
| namespace tint::ast { |
| |
| /// Storage class of a given pointer. |
| {{ Eval "DeclareEnum" $enum}} |
| |
| /// @returns true if the StorageClass is host-shareable |
| /// @param sc the StorageClass |
| /// @see https://gpuweb.github.io/gpuweb/wgsl.html#host-shareable |
| inline bool IsHostShareable(StorageClass sc) { |
| return sc == ast::StorageClass::kUniform || sc == ast::StorageClass::kStorage; |
| } |
| |
| } // namespace tint::ast |
| |
| #endif // SRC_TINT_AST_STORAGE_CLASS_H_ |