blob: 15c944540011f769d9787942f39b6632cc85932b [file] [log] [blame]
{{- /*
--------------------------------------------------------------------------------
Template file for use with tools/src/cmd/gen to generate builtin_fn.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/spirv/spirv.def" -}}
#ifndef SRC_TINT_LANG_SPIRV_BUILTIN_FN_H_
#define SRC_TINT_LANG_SPIRV_BUILTIN_FN_H_
#include <cstdint>
#include <string>
#include "src/tint/utils/traits/traits.h"
#include "src/tint/lang/core/ir/call.h"
// \cond DO_NOT_DOCUMENT
namespace tint::spirv {
/// Enumerator of all builtin functions
enum class BuiltinFn : uint8_t {
{{- range $I.Sem.Builtins }}
k{{PascalCase .Name}},
{{- end }}
kNone,
};
/// @returns the name of the builtin function type. The spelling, including
/// case, matches the name in the WGSL spec.
const char* str(BuiltinFn i);
/// Emits the name of the builtin function type. The spelling, including case,
/// matches the name in the WGSL spec.
template <typename STREAM, typename = traits::EnableIfIsOStream<STREAM>>
auto& operator<<(STREAM& o, BuiltinFn i) {
return o << str(i);
}
/// @returns access restrictions for a function
tint::core::ir::Instruction::Accesses GetSideEffects(BuiltinFn fn);
} // namespace tint::spirv
// \endcond
#endif // SRC_TINT_LANG_SPIRV_BUILTIN_FN_H_