blob: 42103c32313cb9a11fc91b8ecf8d4c5dcb8ede03 [file] [log] [blame] [edit]
{{- /*
--------------------------------------------------------------------------------
Template file for use with tools/src/cmd/gen to generate address_space.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 "address_space") -}}
#ifndef SRC_TINT_BUILTIN_ADDRESS_SPACE_H_
#define SRC_TINT_BUILTIN_ADDRESS_SPACE_H_
#include "src/tint/utils/string_stream.h"
namespace tint::builtin {
/// Address space of a given pointer.
{{ Eval "DeclareEnum" $enum}}
/// @returns true if the AddressSpace is host-shareable
/// @param address_space the AddressSpace
/// @see https://gpuweb.github.io/gpuweb/wgsl.html#host-shareable
inline bool IsHostShareable(AddressSpace address_space) {
return address_space == AddressSpace::kUniform ||
address_space == AddressSpace::kStorage ||
address_space == AddressSpace::kPushConstant;
}
} // namespace tint::builtin
#endif // SRC_TINT_BUILTIN_ADDRESS_SPACE_H_