blob: fb1e9e1319cdb70f585f555fcd189f5e479d4633 [file] [log] [blame]
{{- /*
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
*/ -}}
{{- $I := LoadIntrinsics "src/tint/lang/core/core.def" -}}
{{- Import "src/tint/utils/templates/enums.tmpl.inc" -}}
{{- $enum := ($I.Sem.Enum "address_space") -}}
#ifndef SRC_TINT_LANG_CORE_ADDRESS_SPACE_H_
#define SRC_TINT_LANG_CORE_ADDRESS_SPACE_H_
#include <cstdint>
#include "src/tint/utils/traits/traits.h"
namespace tint::core {
/// 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::core
#endif // SRC_TINT_LANG_CORE_ADDRESS_SPACE_H_