Move the Extension builtin to the builtin/ folder.

This CL moves Extension from ast:: to builtin::

Change-Id: Ica1e6f4f9229341b547011389d47ae3be9830b0d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/120362
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
dan sinclair 2023-02-17 21:58:59 +00:00 committed by Dawn LUCI CQ
parent 6392579ee1
commit e4039c76c7
101 changed files with 604 additions and 591 deletions

View File

@ -277,6 +277,7 @@ libtint_source_set("libtint_program_src") {
deps = [ deps = [
":libtint_ast_hdrs", ":libtint_ast_hdrs",
":libtint_base_src", ":libtint_base_src",
":libtint_builtins_src",
":libtint_constant_src", ":libtint_constant_src",
":libtint_sem_src", ":libtint_sem_src",
":libtint_text_src", ":libtint_text_src",
@ -310,6 +311,7 @@ libtint_source_set("libtint_inspector_src") {
deps = [ deps = [
":libtint_ast_src", ":libtint_ast_src",
":libtint_base_src", ":libtint_base_src",
":libtint_builtins_src",
":libtint_program_src", ":libtint_program_src",
":libtint_sem_src", ":libtint_sem_src",
":libtint_type_src", ":libtint_type_src",
@ -468,7 +470,6 @@ libtint_source_set("libtint_ast_hdrs") {
"ast/discard_statement.h", "ast/discard_statement.h",
"ast/enable.h", "ast/enable.h",
"ast/expression.h", "ast/expression.h",
"ast/extension.h",
"ast/float_literal_expression.h", "ast/float_literal_expression.h",
"ast/for_loop_statement.h", "ast/for_loop_statement.h",
"ast/function.h", "ast/function.h",
@ -554,7 +555,6 @@ libtint_source_set("libtint_ast_src") {
"ast/discard_statement.cc", "ast/discard_statement.cc",
"ast/enable.cc", "ast/enable.cc",
"ast/expression.cc", "ast/expression.cc",
"ast/extension.cc",
"ast/float_literal_expression.cc", "ast/float_literal_expression.cc",
"ast/for_loop_statement.cc", "ast/for_loop_statement.cc",
"ast/function.cc", "ast/function.cc",
@ -685,6 +685,7 @@ libtint_source_set("libtint_sem_src") {
deps = [ deps = [
":libtint_ast_hdrs", ":libtint_ast_hdrs",
":libtint_base_src", ":libtint_base_src",
":libtint_builtins_src",
":libtint_constant_src", ":libtint_constant_src",
":libtint_type_src", ":libtint_type_src",
] ]
@ -694,7 +695,10 @@ libtint_source_set("libtint_builtins_src") {
sources = [ sources = [
"builtin/builtin_value.cc", "builtin/builtin_value.cc",
"builtin/builtin_value.h", "builtin/builtin_value.h",
"builtin/extension.cc",
"builtin/extension.h",
] ]
deps = [ ":libtint_base_src" ]
} }
libtint_source_set("libtint_type_src") { libtint_source_set("libtint_type_src") {
@ -869,6 +873,7 @@ libtint_source_set("libtint_writer_src") {
deps = [ deps = [
":libtint_ast_src", ":libtint_ast_src",
":libtint_base_src", ":libtint_base_src",
":libtint_builtins_src",
":libtint_inspector_src", ":libtint_inspector_src",
":libtint_program_src", ":libtint_program_src",
":libtint_sem_src", ":libtint_sem_src",
@ -1232,7 +1237,6 @@ if (tint_build_unittests) {
"ast/diagnostic_directive_test.cc", "ast/diagnostic_directive_test.cc",
"ast/discard_statement_test.cc", "ast/discard_statement_test.cc",
"ast/enable_test.cc", "ast/enable_test.cc",
"ast/extension_test.cc",
"ast/float_literal_expression_test.cc", "ast/float_literal_expression_test.cc",
"ast/for_loop_statement_test.cc", "ast/for_loop_statement_test.cc",
"ast/function_test.cc", "ast/function_test.cc",
@ -1282,7 +1286,10 @@ if (tint_build_unittests) {
} }
tint_unittests_source_set("tint_unittests_builtins_src") { tint_unittests_source_set("tint_unittests_builtins_src") {
sources = [ "builtin/builtin_value_test.cc" ] sources = [
"builtin/builtin_value_test.cc",
"builtin/extension_test.cc",
]
deps = [ ":libtint_builtins_src" ] deps = [ ":libtint_builtins_src" ]
} }
@ -1373,6 +1380,7 @@ if (tint_build_unittests) {
] ]
deps = [ deps = [
":libtint_base_src", ":libtint_base_src",
":libtint_builtins_src",
":libtint_transform_src", ":libtint_transform_src",
":tint_unittests_ast_src", ":tint_unittests_ast_src",
] ]

View File

@ -549,8 +549,8 @@ list(APPEND TINT_LIB_SRCS
) )
tint_generated(builtin/builtin_value BENCH TEST) tint_generated(builtin/builtin_value BENCH TEST)
tint_generated(builtin/extension BENCH TEST)
tint_generated(ast/diagnostic_control BENCH TEST) tint_generated(ast/diagnostic_control BENCH TEST)
tint_generated(ast/extension BENCH TEST)
tint_generated(ast/interpolate_attribute BENCH TEST) tint_generated(ast/interpolate_attribute BENCH TEST)
tint_generated(resolver/init_conv_intrinsic) tint_generated(resolver/init_conv_intrinsic)
tint_generated(sem/builtin_type) tint_generated(sem/builtin_type)

View File

@ -20,7 +20,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::Enable);
namespace tint::ast { namespace tint::ast {
Enable::Enable(ProgramID pid, NodeID nid, const Source& src, Extension ext) Enable::Enable(ProgramID pid, NodeID nid, const Source& src, builtin::Extension ext)
: Base(pid, nid, src), extension(ext) {} : Base(pid, nid, src), extension(ext) {}
Enable::Enable(Enable&&) = default; Enable::Enable(Enable&&) = default;

View File

@ -19,8 +19,8 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "src/tint/ast/extension.h"
#include "src/tint/ast/node.h" #include "src/tint/ast/node.h"
#include "src/tint/builtin/extension.h"
namespace tint::ast { namespace tint::ast {
@ -36,7 +36,7 @@ class Enable final : public Castable<Enable, Node> {
/// @param nid the unique node identifier /// @param nid the unique node identifier
/// @param src the source of this node /// @param src the source of this node
/// @param ext the extension /// @param ext the extension
Enable(ProgramID pid, NodeID nid, const Source& src, Extension ext); Enable(ProgramID pid, NodeID nid, const Source& src, builtin::Extension ext);
/// Move constructor /// Move constructor
Enable(Enable&&); Enable(Enable&&);
@ -49,7 +49,7 @@ class Enable final : public Castable<Enable, Node> {
const Enable* Clone(CloneContext* ctx) const override; const Enable* Clone(CloneContext* ctx) const override;
/// The extension name /// The extension name
const Extension extension; const builtin::Extension extension;
}; };
} // namespace tint::ast } // namespace tint::ast

View File

@ -22,12 +22,12 @@ namespace {
using EnableTest = TestHelper; using EnableTest = TestHelper;
TEST_F(EnableTest, Creation) { TEST_F(EnableTest, Creation) {
auto* ext = create<ast::Enable>(Source{{{20, 2}, {20, 5}}}, Extension::kF16); auto* ext = create<ast::Enable>(Source{{{20, 2}, {20, 5}}}, builtin::Extension::kF16);
EXPECT_EQ(ext->source.range.begin.line, 20u); EXPECT_EQ(ext->source.range.begin.line, 20u);
EXPECT_EQ(ext->source.range.begin.column, 2u); EXPECT_EQ(ext->source.range.begin.column, 2u);
EXPECT_EQ(ext->source.range.end.line, 20u); EXPECT_EQ(ext->source.range.end.line, 20u);
EXPECT_EQ(ext->source.range.end.column, 5u); EXPECT_EQ(ext->source.range.end.column, 5u);
EXPECT_EQ(ext->extension, Extension::kF16); EXPECT_EQ(ext->extension, builtin::Extension::kF16);
} }
} // namespace } // namespace

View File

@ -135,9 +135,9 @@ TEST_F(ModuleTest, CloneOrder) {
} }
TEST_F(ModuleTest, Directives) { TEST_F(ModuleTest, Directives) {
auto* enable_1 = Enable(ast::Extension::kF16); auto* enable_1 = Enable(builtin::Extension::kF16);
auto* diagnostic_1 = DiagnosticDirective(DiagnosticSeverity::kWarning, "foo"); auto* diagnostic_1 = DiagnosticDirective(DiagnosticSeverity::kWarning, "foo");
auto* enable_2 = Enable(ast::Extension::kChromiumExperimentalFullPtrParameters); auto* enable_2 = Enable(builtin::Extension::kChromiumExperimentalFullPtrParameters);
auto* diagnostic_2 = DiagnosticDirective(DiagnosticSeverity::kOff, "bar"); auto* diagnostic_2 = DiagnosticDirective(DiagnosticSeverity::kOff, "bar");
this->SetResolveOnBuild(false); this->SetResolveOnBuild(false);

View File

@ -15,14 +15,14 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen // File generated by tools/src/cmd/gen
// using the template: // using the template:
// src/tint/ast/extension.cc.tmpl // src/tint/builtin/extension.cc.tmpl
// //
// Do not modify this file directly // Do not modify this file directly
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "src/tint/ast/extension.h" #include "src/tint/builtin/extension.h"
namespace tint::ast { namespace tint::builtin {
/// ParseExtension parses a Extension from a string. /// ParseExtension parses a Extension from a string.
/// @param str the string to parse /// @param str the string to parse
@ -64,4 +64,4 @@ std::ostream& operator<<(std::ostream& out, Extension value) {
return out << "<unknown>"; return out << "<unknown>";
} }
} // namespace tint::ast } // namespace tint::builtin

View File

@ -11,12 +11,12 @@ See:
{{- Import "src/tint/templates/enums.tmpl.inc" -}} {{- Import "src/tint/templates/enums.tmpl.inc" -}}
{{- $enum := (Sem.Enum "extension") -}} {{- $enum := (Sem.Enum "extension") -}}
#include "src/tint/ast/extension.h" #include "src/tint/builtin/extension.h"
namespace tint::ast { namespace tint::builtin {
{{ Eval "ParseEnum" $enum}} {{ Eval "ParseEnum" $enum}}
{{ Eval "EnumOStream" $enum}} {{ Eval "EnumOStream" $enum}}
} // namespace tint::ast } // namespace tint::builtin

View File

@ -15,19 +15,19 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen // File generated by tools/src/cmd/gen
// using the template: // using the template:
// src/tint/ast/extension.h.tmpl // src/tint/builtin/extension.h.tmpl
// //
// Do not modify this file directly // Do not modify this file directly
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#ifndef SRC_TINT_AST_EXTENSION_H_ #ifndef SRC_TINT_BUILTIN_EXTENSION_H_
#define SRC_TINT_AST_EXTENSION_H_ #define SRC_TINT_BUILTIN_EXTENSION_H_
#include <ostream> #include <ostream>
#include "src/tint/utils/unique_vector.h" #include "src/tint/utils/unique_vector.h"
namespace tint::ast { namespace tint::builtin {
/// An enumerator of WGSL extensions /// An enumerator of WGSL extensions
/// @see src/tint/intrinsics.def for extension descriptions /// @see src/tint/intrinsics.def for extension descriptions
@ -61,6 +61,6 @@ constexpr const char* kExtensionStrings[] = {
// A unique vector of extensions // A unique vector of extensions
using Extensions = utils::UniqueVector<Extension, 4>; using Extensions = utils::UniqueVector<Extension, 4>;
} // namespace tint::ast } // namespace tint::builtin
#endif // SRC_TINT_AST_EXTENSION_H_ #endif // SRC_TINT_BUILTIN_EXTENSION_H_

View File

@ -11,14 +11,14 @@ See:
{{- Import "src/tint/templates/enums.tmpl.inc" -}} {{- Import "src/tint/templates/enums.tmpl.inc" -}}
{{- $enum := (Sem.Enum "extension") -}} {{- $enum := (Sem.Enum "extension") -}}
#ifndef SRC_TINT_AST_EXTENSION_H_ #ifndef SRC_TINT_BUILTIN_EXTENSION_H_
#define SRC_TINT_AST_EXTENSION_H_ #define SRC_TINT_BUILTIN_EXTENSION_H_
#include <ostream> #include <ostream>
#include "src/tint/utils/unique_vector.h" #include "src/tint/utils/unique_vector.h"
namespace tint::ast { namespace tint::builtin {
/// An enumerator of WGSL extensions /// An enumerator of WGSL extensions
/// @see src/tint/intrinsics.def for extension descriptions /// @see src/tint/intrinsics.def for extension descriptions
@ -27,6 +27,6 @@ namespace tint::ast {
// A unique vector of extensions // A unique vector of extensions
using Extensions = utils::UniqueVector<Extension, 4>; using Extensions = utils::UniqueVector<Extension, 4>;
} // namespace tint::ast } // namespace tint::builtin
#endif // SRC_TINT_AST_EXTENSION_H_ #endif // SRC_TINT_BUILTIN_EXTENSION_H_

View File

@ -15,18 +15,18 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen // File generated by tools/src/cmd/gen
// using the template: // using the template:
// src/tint/ast/extension_bench.cc.tmpl // src/tint/builtin/extension_bench.cc.tmpl
// //
// Do not modify this file directly // Do not modify this file directly
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "src/tint/ast/extension.h" #include "src/tint/builtin/extension.h"
#include <array> #include <array>
#include "benchmark/benchmark.h" #include "benchmark/benchmark.h"
namespace tint::ast { namespace tint::builtin {
namespace { namespace {
void ExtensionParser(::benchmark::State& state) { void ExtensionParser(::benchmark::State& state) {
@ -78,4 +78,4 @@ void ExtensionParser(::benchmark::State& state) {
BENCHMARK(ExtensionParser); BENCHMARK(ExtensionParser);
} // namespace } // namespace
} // namespace tint::ast } // namespace tint::builtin

View File

@ -11,16 +11,16 @@ See:
{{- Import "src/tint/templates/enums.tmpl.inc" -}} {{- Import "src/tint/templates/enums.tmpl.inc" -}}
{{- $enum := (Sem.Enum "extension") -}} {{- $enum := (Sem.Enum "extension") -}}
#include "src/tint/ast/extension.h" #include "src/tint/builtin/extension.h"
#include <array> #include <array>
#include "benchmark/benchmark.h" #include "benchmark/benchmark.h"
namespace tint::ast { namespace tint::builtin {
namespace { namespace {
{{ Eval "BenchmarkParseEnum" $enum }} {{ Eval "BenchmarkParseEnum" $enum }}
} // namespace } // namespace
} // namespace tint::ast } // namespace tint::builtin

View File

@ -15,19 +15,20 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen // File generated by tools/src/cmd/gen
// using the template: // using the template:
// src/tint/ast/extension_test.cc.tmpl // src/tint/builtin/extension_test.cc.tmpl
// //
// Do not modify this file directly // Do not modify this file directly
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "src/tint/ast/extension.h" #include "src/tint/builtin/extension.h"
#include <gtest/gtest.h>
#include <string> #include <string>
#include "src/tint/ast/test_helper.h"
#include "src/tint/utils/string.h" #include "src/tint/utils/string.h"
namespace tint::ast { namespace tint::builtin {
namespace { namespace {
namespace parse_print_tests { namespace parse_print_tests {
@ -92,4 +93,4 @@ INSTANTIATE_TEST_SUITE_P(ValidCases, ExtensionPrintTest, testing::ValuesIn(kVali
} // namespace parse_print_tests } // namespace parse_print_tests
} // namespace } // namespace
} // namespace tint::ast } // namespace tint::builtin

View File

@ -11,17 +11,18 @@ See:
{{- Import "src/tint/templates/enums.tmpl.inc" -}} {{- Import "src/tint/templates/enums.tmpl.inc" -}}
{{- $enum := (Sem.Enum "extension") -}} {{- $enum := (Sem.Enum "extension") -}}
#include "src/tint/ast/extension.h" #include "src/tint/builtin/extension.h"
#include <gtest/gtest.h>
#include <string> #include <string>
#include "src/tint/ast/test_helper.h"
#include "src/tint/utils/string.h" #include "src/tint/utils/string.h"
namespace tint::ast { namespace tint::builtin {
namespace { namespace {
{{ Eval "TestParsePrintEnum" $enum}} {{ Eval "TestParsePrintEnum" $enum}}
} // namespace } // namespace
} // namespace tint::ast } // namespace tint::builtin

View File

@ -734,7 +734,7 @@ bool GenerateHlsl(const tint::Program* program, const Options& options) {
auto enable_list = program->AST().Enables(); auto enable_list = program->AST().Enables();
bool dxc_require_16bit_types = false; bool dxc_require_16bit_types = false;
for (auto enable : enable_list) { for (auto enable : enable_list) {
if (enable->extension == tint::ast::Extension::kF16) { if (enable->extension == tint::builtin::Extension::kF16) {
dxc_require_16bit_types = true; dxc_require_16bit_types = true;
break; break;
} }

View File

@ -19,7 +19,6 @@
#include "src/tint/ast/bool_literal_expression.h" #include "src/tint/ast/bool_literal_expression.h"
#include "src/tint/ast/call_expression.h" #include "src/tint/ast/call_expression.h"
#include "src/tint/ast/extension.h"
#include "src/tint/ast/float_literal_expression.h" #include "src/tint/ast/float_literal_expression.h"
#include "src/tint/ast/id_attribute.h" #include "src/tint/ast/id_attribute.h"
#include "src/tint/ast/identifier.h" #include "src/tint/ast/identifier.h"
@ -29,6 +28,7 @@
#include "src/tint/ast/module.h" #include "src/tint/ast/module.h"
#include "src/tint/ast/override.h" #include "src/tint/ast/override.h"
#include "src/tint/ast/var.h" #include "src/tint/ast/var.h"
#include "src/tint/builtin/extension.h"
#include "src/tint/sem/call.h" #include "src/tint/sem/call.h"
#include "src/tint/sem/function.h" #include "src/tint/sem/function.h"
#include "src/tint/sem/module.h" #include "src/tint/sem/module.h"

View File

@ -289,7 +289,7 @@ TEST_P(InspectorGetEntryPointComponentAndCompositionTest, Test) {
std::function<ast::Type()> tint_type = GetTypeFunction(component, composition); std::function<ast::Type()> tint_type = GetTypeFunction(component, composition);
if (component == ComponentType::kF16) { if (component == ComponentType::kF16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
} }
auto* in_var = Param("in_var", tint_type(), auto* in_var = Param("in_var", tint_type(),

View File

@ -1509,7 +1509,7 @@ TEST_F(IR_BuilderImplTest, EmitLiteral_F32) {
} }
TEST_F(IR_BuilderImplTest, EmitLiteral_F16) { TEST_F(IR_BuilderImplTest, EmitLiteral_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* expr = Expr(1.2_h); auto* expr = Expr(1.2_h);
GlobalVar("a", ty.f16(), type::AddressSpace::kPrivate, expr); GlobalVar("a", ty.f16(), type::AddressSpace::kPrivate, expr);

View File

@ -42,7 +42,6 @@
#include "src/tint/ast/disable_validation_attribute.h" #include "src/tint/ast/disable_validation_attribute.h"
#include "src/tint/ast/discard_statement.h" #include "src/tint/ast/discard_statement.h"
#include "src/tint/ast/enable.h" #include "src/tint/ast/enable.h"
#include "src/tint/ast/extension.h"
#include "src/tint/ast/float_literal_expression.h" #include "src/tint/ast/float_literal_expression.h"
#include "src/tint/ast/for_loop_statement.h" #include "src/tint/ast/for_loop_statement.h"
#include "src/tint/ast/id_attribute.h" #include "src/tint/ast/id_attribute.h"
@ -74,6 +73,7 @@
#include "src/tint/ast/variable_decl_statement.h" #include "src/tint/ast/variable_decl_statement.h"
#include "src/tint/ast/while_statement.h" #include "src/tint/ast/while_statement.h"
#include "src/tint/ast/workgroup_attribute.h" #include "src/tint/ast/workgroup_attribute.h"
#include "src/tint/builtin/extension.h"
#include "src/tint/constant/composite.h" #include "src/tint/constant/composite.h"
#include "src/tint/constant/splat.h" #include "src/tint/constant/splat.h"
#include "src/tint/constant/value.h" #include "src/tint/constant/value.h"
@ -2036,7 +2036,7 @@ class ProgramBuilder {
/// Adds the extension to the list of enable directives at the top of the module. /// Adds the extension to the list of enable directives at the top of the module.
/// @param ext the extension to enable /// @param ext the extension to enable
/// @return an `ast::Enable` enabling the given extension. /// @return an `ast::Enable` enabling the given extension.
const ast::Enable* Enable(ast::Extension ext) { const ast::Enable* Enable(builtin::Extension ext) {
auto* enable = create<ast::Enable>(ext); auto* enable = create<ast::Enable>(ext);
AST().AddEnable(enable); AST().AddEnable(enable);
return enable; return enable;
@ -2046,7 +2046,7 @@ class ProgramBuilder {
/// @param source the enable source /// @param source the enable source
/// @param ext the extension to enable /// @param ext the extension to enable
/// @return an `ast::Enable` enabling the given extension. /// @return an `ast::Enable` enabling the given extension.
const ast::Enable* Enable(const Source& source, ast::Extension ext) { const ast::Enable* Enable(const Source& source, builtin::Extension ext) {
auto* enable = create<ast::Enable>(source, ext); auto* enable = create<ast::Enable>(source, ext);
AST().AddEnable(enable); AST().AddEnable(enable);
return enable; return enable;

View File

@ -422,14 +422,15 @@ Maybe<Void> ParserImpl::enable_directive() {
return add_error(t.source(), "enable directives don't take parenthesis"); return add_error(t.source(), "enable directives don't take parenthesis");
} }
auto extension = ast::Extension::kUndefined; auto extension = builtin::Extension::kUndefined;
if (t.Is(Token::Type::kF16)) { if (t.Is(Token::Type::kF16)) {
// `f16` is a valid extension name and also a keyword // `f16` is a valid extension name and also a keyword
synchronized_ = true; synchronized_ = true;
next(); next();
extension = ast::Extension::kF16; extension = builtin::Extension::kF16;
} else { } else {
auto ext = expect_enum("extension", ast::ParseExtension, ast::kExtensionStrings); auto ext =
expect_enum("extension", builtin::ParseExtension, builtin::kExtensionStrings);
if (ext.errored) { if (ext.errored) {
return Failure::kErrored; return Failure::kErrored;
} }

View File

@ -30,7 +30,7 @@ TEST_F(EnableDirectiveTest, Valid) {
auto& ast = program.AST(); auto& ast = program.AST();
ASSERT_EQ(ast.Enables().Length(), 1u); ASSERT_EQ(ast.Enables().Length(), 1u);
auto* enable = ast.Enables()[0]; auto* enable = ast.Enables()[0];
EXPECT_EQ(enable->extension, ast::Extension::kF16); EXPECT_EQ(enable->extension, builtin::Extension::kF16);
ASSERT_EQ(ast.GlobalDeclarations().Length(), 1u); ASSERT_EQ(ast.GlobalDeclarations().Length(), 1u);
EXPECT_EQ(ast.GlobalDeclarations()[0], enable); EXPECT_EQ(ast.GlobalDeclarations()[0], enable);
} }
@ -48,8 +48,8 @@ enable f16;
ASSERT_EQ(ast.Enables().Length(), 2u); ASSERT_EQ(ast.Enables().Length(), 2u);
auto* enable_a = ast.Enables()[0]; auto* enable_a = ast.Enables()[0];
auto* enable_b = ast.Enables()[1]; auto* enable_b = ast.Enables()[1];
EXPECT_EQ(enable_a->extension, ast::Extension::kF16); EXPECT_EQ(enable_a->extension, builtin::Extension::kF16);
EXPECT_EQ(enable_b->extension, ast::Extension::kF16); EXPECT_EQ(enable_b->extension, builtin::Extension::kF16);
ASSERT_EQ(ast.GlobalDeclarations().Length(), 2u); ASSERT_EQ(ast.GlobalDeclarations().Length(), 2u);
EXPECT_EQ(ast.GlobalDeclarations()[0], enable_a); EXPECT_EQ(ast.GlobalDeclarations()[0], enable_a);
EXPECT_EQ(ast.GlobalDeclarations()[1], enable_b); EXPECT_EQ(ast.GlobalDeclarations()[1], enable_b);
@ -168,7 +168,7 @@ enable f16;
// Accept the enable directive although it caused an error // Accept the enable directive although it caused an error
ASSERT_EQ(ast.Enables().Length(), 1u); ASSERT_EQ(ast.Enables().Length(), 1u);
auto* enable = ast.Enables()[0]; auto* enable = ast.Enables()[0];
EXPECT_EQ(enable->extension, ast::Extension::kF16); EXPECT_EQ(enable->extension, builtin::Extension::kF16);
ASSERT_EQ(ast.GlobalDeclarations().Length(), 2u); ASSERT_EQ(ast.GlobalDeclarations().Length(), 2u);
EXPECT_EQ(ast.GlobalDeclarations()[1], enable); EXPECT_EQ(ast.GlobalDeclarations()[1], enable);
} }
@ -188,7 +188,7 @@ enable f16;
// Accept the enable directive although it cause an error // Accept the enable directive although it cause an error
ASSERT_EQ(ast.Enables().Length(), 1u); ASSERT_EQ(ast.Enables().Length(), 1u);
auto* enable = ast.Enables()[0]; auto* enable = ast.Enables()[0];
EXPECT_EQ(enable->extension, ast::Extension::kF16); EXPECT_EQ(enable->extension, builtin::Extension::kF16);
ASSERT_EQ(ast.GlobalDeclarations().Length(), 1u); ASSERT_EQ(ast.GlobalDeclarations().Length(), 1u);
EXPECT_EQ(ast.GlobalDeclarations()[0], enable); EXPECT_EQ(ast.GlobalDeclarations()[0], enable);
} }

View File

@ -371,7 +371,7 @@ TEST_F(ResolverAddressSpaceLayoutValidationTest, UniformBuffer_Vec3F16MemberOffs
// @group(0) @binding(0) // @group(0) @binding(0)
// var<uniform> a : ScalarPackedAtEndOfVec3; // var<uniform> a : ScalarPackedAtEndOfVec3;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Structure("ScalarPackedAtEndOfVec3", utils::Vector{ Structure("ScalarPackedAtEndOfVec3", utils::Vector{
Member("v", ty.vec3(ty.f16())), Member("v", ty.vec3(ty.f16())),
@ -568,7 +568,7 @@ TEST_F(ResolverAddressSpaceLayoutValidationTest, PushConstant_UnalignedMember) {
// @align(1) b : f32; // @align(1) b : f32;
// }; // };
// var<push_constant> a : S; // var<push_constant> a : S;
Enable(ast::Extension::kChromiumExperimentalPushConstant); Enable(builtin::Extension::kChromiumExperimentalPushConstant);
Structure( Structure(
Source{{12, 34}}, "S", Source{{12, 34}}, "S",
utils::Vector{Member("a", ty.f32(), utils::Vector{MemberSize(5_a)}), utils::Vector{Member("a", ty.f32(), utils::Vector{MemberSize(5_a)}),
@ -595,7 +595,7 @@ TEST_F(ResolverAddressSpaceLayoutValidationTest, PushConstant_Aligned) {
// @align(4) b : f32; // @align(4) b : f32;
// }; // };
// var<push_constant> a : S; // var<push_constant> a : S;
Enable(ast::Extension::kChromiumExperimentalPushConstant); Enable(builtin::Extension::kChromiumExperimentalPushConstant);
Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{MemberSize(5_a)}), Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{MemberSize(5_a)}),
Member("b", ty.f32(), utils::Vector{MemberAlign(4_i)})}); Member("b", ty.f32(), utils::Vector{MemberAlign(4_i)})});
GlobalVar("a", ty("S"), type::AddressSpace::kPushConstant); GlobalVar("a", ty("S"), type::AddressSpace::kPushConstant);

View File

@ -249,7 +249,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Storage_IntScalar) {
TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Storage_F16) { TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Storage_F16) {
// enable f16; // enable f16;
// var<storage> g : f16; // var<storage> g : f16;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("g", ty.f16(), type::AddressSpace::kStorage, Binding(0_a), Group(0_a)); GlobalVar("g", ty.f16(), type::AddressSpace::kStorage, Binding(0_a), Group(0_a));
@ -259,7 +259,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Storage_F16) {
TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Storage_F16) { TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Storage_F16) {
// enable f16; // enable f16;
// type t = ptr<storage, f16>; // type t = ptr<storage, f16>;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Alias("t", ty.pointer(ty.f16(), type::AddressSpace::kStorage)); Alias("t", ty.pointer(ty.f16(), type::AddressSpace::kStorage));
@ -270,7 +270,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Storage_F16Alias) {
// enable f16; // enable f16;
// type a = f16; // type a = f16;
// var<storage, read> g : a; // var<storage, read> g : a;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Alias("a", ty.f16()); Alias("a", ty.f16());
GlobalVar("g", ty("a"), type::AddressSpace::kStorage, Binding(0_a), Group(0_a)); GlobalVar("g", ty("a"), type::AddressSpace::kStorage, Binding(0_a), Group(0_a));
@ -282,7 +282,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Storage_F16Alias) {
// enable f16; // enable f16;
// type a = f16; // type a = f16;
// type t = ptr<storage, a>; // type t = ptr<storage, a>;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Alias("a", ty.f16()); Alias("a", ty.f16());
Alias("t", ty.pointer(ty("a"), type::AddressSpace::kStorage)); Alias("t", ty.pointer(ty("a"), type::AddressSpace::kStorage));
@ -306,7 +306,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Storage_VectorF32) {
TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Storage_VectorF16) { TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Storage_VectorF16) {
// var<storage> g : vec4<f16>; // var<storage> g : vec4<f16>;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("g", ty.vec(ty.f16(), 4u), type::AddressSpace::kStorage, Binding(0_a), Group(0_a)); GlobalVar("g", ty.vec(ty.f16(), 4u), type::AddressSpace::kStorage, Binding(0_a), Group(0_a));
ASSERT_TRUE(r()->Resolve()) << r()->error(); ASSERT_TRUE(r()->Resolve()) << r()->error();
@ -314,7 +314,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Storage_VectorF16) {
TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Storage_VectorF16) { TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Storage_VectorF16) {
// type t = ptr<storage, vec4<f16>>; // type t = ptr<storage, vec4<f16>>;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Alias("t", ty.pointer(ty.vec(ty.f16(), 4u), type::AddressSpace::kStorage)); Alias("t", ty.pointer(ty.vec(ty.f16(), 4u), type::AddressSpace::kStorage));
ASSERT_TRUE(r()->Resolve()) << r()->error(); ASSERT_TRUE(r()->Resolve()) << r()->error();
@ -343,7 +343,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Storage_ArrayF16) {
// enable f16; // enable f16;
// struct S{ a : f16 }; // struct S{ a : f16 };
// var<storage, read> g : array<S, 3u>; // var<storage, read> g : array<S, 3u>;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Structure("S", utils::Vector{Member("a", ty.f16())}); Structure("S", utils::Vector{Member("a", ty.f16())});
GlobalVar("g", ty.array(ty("S"), 3_u), type::AddressSpace::kStorage, type::Access::kRead, GlobalVar("g", ty.array(ty("S"), 3_u), type::AddressSpace::kStorage, type::Access::kRead,
@ -356,7 +356,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Storage_ArrayF16) {
// enable f16; // enable f16;
// struct S{ a : f16 }; // struct S{ a : f16 };
// type t = ptr<storage, read, array<S, 3u>>; // type t = ptr<storage, read, array<S, 3u>>;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Structure("S", utils::Vector{Member("a", ty.f16())}); Structure("S", utils::Vector{Member("a", ty.f16())});
Alias("t", Alias("t",
@ -412,7 +412,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Storage_StructI32Aliases
TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Storage_StructF16) { TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Storage_StructF16) {
// struct S { x : f16 }; // struct S { x : f16 };
// var<storage, read> g : S; // var<storage, read> g : S;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Structure("S", utils::Vector{Member("x", ty.f16())}); Structure("S", utils::Vector{Member("x", ty.f16())});
GlobalVar("g", ty("S"), type::AddressSpace::kStorage, type::Access::kRead, Binding(0_a), GlobalVar("g", ty("S"), type::AddressSpace::kStorage, type::Access::kRead, Binding(0_a),
@ -424,7 +424,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Storage_StructF16) {
TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Storage_StructF16) { TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Storage_StructF16) {
// struct S { x : f16 }; // struct S { x : f16 };
// type t = ptr<storage, read, S>; // type t = ptr<storage, read, S>;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Structure("S", utils::Vector{Member("x", ty.f16())}); Structure("S", utils::Vector{Member("x", ty.f16())});
Alias("t", ty.pointer(ty("S"), type::AddressSpace::kStorage, type::Access::kRead)); Alias("t", ty.pointer(ty("S"), type::AddressSpace::kStorage, type::Access::kRead));
@ -436,7 +436,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Storage_StructF16Alias
// struct S { x : f16 }; // struct S { x : f16 };
// type a1 = S; // type a1 = S;
// var<storage, read> g : a1; // var<storage, read> g : a1;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Structure("S", utils::Vector{Member("x", ty.f16())}); Structure("S", utils::Vector{Member("x", ty.f16())});
Alias("a1", ty("S")); Alias("a1", ty("S"));
@ -451,7 +451,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Storage_StructF16Aliases
// struct S { x : f16 }; // struct S { x : f16 };
// type a1 = S; // type a1 = S;
// type t = ptr<storage, read, a1>; // type t = ptr<storage, read, a1>;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Structure("S", utils::Vector{Member("x", ty.f16())}); Structure("S", utils::Vector{Member("x", ty.f16())});
Alias("a1", ty("S")); Alias("a1", ty("S"));
@ -675,7 +675,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_UniformBufferIntScalar)
TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_UniformBufferF16) { TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_UniformBufferF16) {
// enable f16; // enable f16;
// var<uniform> g : f16; // var<uniform> g : f16;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("g", ty.f16(), type::AddressSpace::kUniform, Binding(0_a), Group(0_a)); GlobalVar("g", ty.f16(), type::AddressSpace::kUniform, Binding(0_a), Group(0_a));
@ -685,7 +685,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_UniformBufferF16) {
TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_UniformBufferF16) { TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_UniformBufferF16) {
// enable f16; // enable f16;
// type t = ptr<uniform, f16>; // type t = ptr<uniform, f16>;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Alias("t", ty.pointer(ty.f16(), type::AddressSpace::kUniform)); Alias("t", ty.pointer(ty.f16(), type::AddressSpace::kUniform));
@ -709,7 +709,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_UniformBufferVectorF32)
TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_UniformBufferVectorF16) { TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_UniformBufferVectorF16) {
// enable f16; // enable f16;
// var<uniform> g : vec4<f16>; // var<uniform> g : vec4<f16>;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("g", ty.vec4<f16>(), type::AddressSpace::kUniform, Binding(0_a), Group(0_a)); GlobalVar("g", ty.vec4<f16>(), type::AddressSpace::kUniform, Binding(0_a), Group(0_a));
@ -719,7 +719,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_UniformBufferVectorF16
TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_UniformBufferVectorF16) { TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_UniformBufferVectorF16) {
// enable f16; // enable f16;
// type t = ptr<uniform, vec4<f16>>; // type t = ptr<uniform, vec4<f16>>;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Alias("t", ty.pointer(ty.vec4<f16>(), type::AddressSpace::kUniform)); Alias("t", ty.pointer(ty.vec4<f16>(), type::AddressSpace::kUniform));
@ -754,7 +754,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_UniformBufferArrayF16)
// @size(16) f : f16; // @size(16) f : f16;
// } // }
// var<uniform> g : array<S, 3u>; // var<uniform> g : array<S, 3u>;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Structure("S", utils::Vector{Member("a", ty.f16(), utils::Vector{MemberSize(16_a)})}); Structure("S", utils::Vector{Member("a", ty.f16(), utils::Vector{MemberSize(16_a)})});
GlobalVar("g", ty.array(ty("S"), 3_u), type::AddressSpace::kUniform, Binding(0_a), Group(0_a)); GlobalVar("g", ty.array(ty("S"), 3_u), type::AddressSpace::kUniform, Binding(0_a), Group(0_a));
@ -768,7 +768,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_UniformBufferArrayF16) {
// @size(16) f : f16; // @size(16) f : f16;
// } // }
// type t = ptr<uniform, array<S, 3u>>; // type t = ptr<uniform, array<S, 3u>>;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Structure("S", utils::Vector{Member("a", ty.f16(), utils::Vector{MemberSize(16_a)})}); Structure("S", utils::Vector{Member("a", ty.f16(), utils::Vector{MemberSize(16_a)})});
Alias("t", ty.pointer(ty.array(ty("S"), 3_u), type::AddressSpace::kUniform)); Alias("t", ty.pointer(ty.array(ty("S"), 3_u), type::AddressSpace::kUniform));
@ -820,7 +820,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_UniformBufferStructF16
// enable f16; // enable f16;
// struct S { x : f16 }; // struct S { x : f16 };
// var<uniform> g : S; // var<uniform> g : S;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Structure("S", utils::Vector{Member("x", ty.f16())}); Structure("S", utils::Vector{Member("x", ty.f16())});
GlobalVar("g", ty("S"), type::AddressSpace::kUniform, Binding(0_a), Group(0_a)); GlobalVar("g", ty("S"), type::AddressSpace::kUniform, Binding(0_a), Group(0_a));
@ -832,7 +832,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_UniformBufferStructF16)
// enable f16; // enable f16;
// struct S { x : f16 }; // struct S { x : f16 };
// type t = ptr<uniform, S>; // type t = ptr<uniform, S>;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Structure("S", utils::Vector{Member("x", ty.f16())}); Structure("S", utils::Vector{Member("x", ty.f16())});
Alias("t", ty.pointer(ty("S"), type::AddressSpace::kUniform)); Alias("t", ty.pointer(ty("S"), type::AddressSpace::kUniform));
@ -845,7 +845,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_UniformBufferStructF16
// struct S { x : f16 }; // struct S { x : f16 };
// type a1 = S; // type a1 = S;
// var<uniform> g : a1; // var<uniform> g : a1;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Structure("S", utils::Vector{Member("x", ty.f16())}); Structure("S", utils::Vector{Member("x", ty.f16())});
Alias("a1", ty("S")); Alias("a1", ty("S"));
@ -859,7 +859,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_UniformBufferStructF16Al
// struct S { x : f16 }; // struct S { x : f16 };
// type a1 = S; // type a1 = S;
// type t = ptr<uniform, a1>; // type t = ptr<uniform, a1>;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Structure("S", utils::Vector{Member("x", ty.f16())}); Structure("S", utils::Vector{Member("x", ty.f16())});
Alias("a1", ty("S")); Alias("a1", ty("S"));
@ -871,7 +871,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_UniformBufferStructF16Al
TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_PushConstantBool) { TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_PushConstantBool) {
// enable chromium_experimental_push_constant; // enable chromium_experimental_push_constant;
// var<push_constant> g : bool; // var<push_constant> g : bool;
Enable(ast::Extension::kChromiumExperimentalPushConstant); Enable(builtin::Extension::kChromiumExperimentalPushConstant);
GlobalVar(Source{{56, 78}}, "g", ty.bool_(Source{{12, 34}}), type::AddressSpace::kPushConstant); GlobalVar(Source{{56, 78}}, "g", ty.bool_(Source{{12, 34}}), type::AddressSpace::kPushConstant);
ASSERT_FALSE(r()->Resolve()); ASSERT_FALSE(r()->Resolve());
@ -884,7 +884,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_PushConstantBool) {
TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_PushConstantBool) { TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_PushConstantBool) {
// enable chromium_experimental_push_constant; // enable chromium_experimental_push_constant;
// type t = ptr<push_constant, bool>; // type t = ptr<push_constant, bool>;
Enable(ast::Extension::kChromiumExperimentalPushConstant); Enable(builtin::Extension::kChromiumExperimentalPushConstant);
Alias(Source{{56, 78}}, "t", Alias(Source{{56, 78}}, "t",
ty.pointer(ty.bool_(Source{{12, 34}}), type::AddressSpace::kPushConstant)); ty.pointer(ty.bool_(Source{{12, 34}}), type::AddressSpace::kPushConstant));
@ -899,8 +899,8 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_PushConstantF16) {
// enable f16; // enable f16;
// enable chromium_experimental_push_constant; // enable chromium_experimental_push_constant;
// var<push_constant> g : f16; // var<push_constant> g : f16;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Enable(ast::Extension::kChromiumExperimentalPushConstant); Enable(builtin::Extension::kChromiumExperimentalPushConstant);
GlobalVar("g", ty.f16(Source{{56, 78}}), type::AddressSpace::kPushConstant); GlobalVar("g", ty.f16(Source{{56, 78}}), type::AddressSpace::kPushConstant);
ASSERT_FALSE(r()->Resolve()); ASSERT_FALSE(r()->Resolve());
@ -912,8 +912,8 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_PushConstantF16) {
// enable f16; // enable f16;
// enable chromium_experimental_push_constant; // enable chromium_experimental_push_constant;
// type t = ptr<push_constant, f16>; // type t = ptr<push_constant, f16>;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Enable(ast::Extension::kChromiumExperimentalPushConstant); Enable(builtin::Extension::kChromiumExperimentalPushConstant);
Alias("t", ty.pointer(ty.f16(Source{{56, 78}}), type::AddressSpace::kPushConstant)); Alias("t", ty.pointer(ty.f16(Source{{56, 78}}), type::AddressSpace::kPushConstant));
ASSERT_FALSE(r()->Resolve()); ASSERT_FALSE(r()->Resolve());
@ -924,7 +924,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_PushConstantF16) {
TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_PushConstantPointer) { TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_PushConstantPointer) {
// enable chromium_experimental_push_constant; // enable chromium_experimental_push_constant;
// var<push_constant> g : ptr<private, f32>; // var<push_constant> g : ptr<private, f32>;
Enable(ast::Extension::kChromiumExperimentalPushConstant); Enable(builtin::Extension::kChromiumExperimentalPushConstant);
GlobalVar(Source{{56, 78}}, "g", GlobalVar(Source{{56, 78}}, "g",
ty.pointer(Source{{12, 34}}, ty.f32(), type::AddressSpace::kPrivate), ty.pointer(Source{{12, 34}}, ty.f32(), type::AddressSpace::kPrivate),
type::AddressSpace::kPushConstant); type::AddressSpace::kPushConstant);
@ -939,7 +939,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_PushConstantPointer) {
TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_PushConstantPointer) { TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_PushConstantPointer) {
// enable chromium_experimental_push_constant; // enable chromium_experimental_push_constant;
// type t = ptr<push_constant, ptr<private, f32>>; // type t = ptr<push_constant, ptr<private, f32>>;
Enable(ast::Extension::kChromiumExperimentalPushConstant); Enable(builtin::Extension::kChromiumExperimentalPushConstant);
Alias(Source{{56, 78}}, "t", Alias(Source{{56, 78}}, "t",
ty.pointer(ty.pointer(Source{{12, 34}}, ty.f32(), type::AddressSpace::kPrivate), ty.pointer(ty.pointer(Source{{12, 34}}, ty.f32(), type::AddressSpace::kPrivate),
type::AddressSpace::kPushConstant)); type::AddressSpace::kPushConstant));
@ -954,7 +954,7 @@ note: while instantiating ptr<push_constant, ptr<private, f32, read_write>, read
TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_PushConstantIntScalar) { TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_PushConstantIntScalar) {
// enable chromium_experimental_push_constant; // enable chromium_experimental_push_constant;
// var<push_constant> g : i32; // var<push_constant> g : i32;
Enable(ast::Extension::kChromiumExperimentalPushConstant); Enable(builtin::Extension::kChromiumExperimentalPushConstant);
GlobalVar("g", ty.i32(), type::AddressSpace::kPushConstant); GlobalVar("g", ty.i32(), type::AddressSpace::kPushConstant);
ASSERT_TRUE(r()->Resolve()) << r()->error(); ASSERT_TRUE(r()->Resolve()) << r()->error();
@ -963,7 +963,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_PushConstantIntScalar)
TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_PushConstantIntScalar) { TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_PushConstantIntScalar) {
// enable chromium_experimental_push_constant; // enable chromium_experimental_push_constant;
// type t = ptr<push_constant, i32>; // type t = ptr<push_constant, i32>;
Enable(ast::Extension::kChromiumExperimentalPushConstant); Enable(builtin::Extension::kChromiumExperimentalPushConstant);
Alias("t", ty.pointer(ty.i32(), type::AddressSpace::kPushConstant)); Alias("t", ty.pointer(ty.i32(), type::AddressSpace::kPushConstant));
ASSERT_TRUE(r()->Resolve()) << r()->error(); ASSERT_TRUE(r()->Resolve()) << r()->error();
@ -972,7 +972,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_PushConstantIntScalar) {
TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_PushConstantVectorF32) { TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_PushConstantVectorF32) {
// enable chromium_experimental_push_constant; // enable chromium_experimental_push_constant;
// var<push_constant> g : vec4<f32>; // var<push_constant> g : vec4<f32>;
Enable(ast::Extension::kChromiumExperimentalPushConstant); Enable(builtin::Extension::kChromiumExperimentalPushConstant);
GlobalVar("g", ty.vec4<f32>(), type::AddressSpace::kPushConstant); GlobalVar("g", ty.vec4<f32>(), type::AddressSpace::kPushConstant);
ASSERT_TRUE(r()->Resolve()) << r()->error(); ASSERT_TRUE(r()->Resolve()) << r()->error();
@ -981,7 +981,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_PushConstantVectorF32)
TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_PushConstantVectorF32) { TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_PushConstantVectorF32) {
// enable chromium_experimental_push_constant; // enable chromium_experimental_push_constant;
// var<push_constant> g : vec4<f32>; // var<push_constant> g : vec4<f32>;
Enable(ast::Extension::kChromiumExperimentalPushConstant); Enable(builtin::Extension::kChromiumExperimentalPushConstant);
Alias("t", ty.pointer(ty.vec4<f32>(), type::AddressSpace::kPushConstant)); Alias("t", ty.pointer(ty.vec4<f32>(), type::AddressSpace::kPushConstant));
ASSERT_TRUE(r()->Resolve()) << r()->error(); ASSERT_TRUE(r()->Resolve()) << r()->error();
@ -991,7 +991,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_PushConstantArrayF32)
// enable chromium_experimental_push_constant; // enable chromium_experimental_push_constant;
// struct S { a : f32} // struct S { a : f32}
// var<push_constant> g : array<S, 3u>; // var<push_constant> g : array<S, 3u>;
Enable(ast::Extension::kChromiumExperimentalPushConstant); Enable(builtin::Extension::kChromiumExperimentalPushConstant);
Structure("S", utils::Vector{Member("a", ty.f32())}); Structure("S", utils::Vector{Member("a", ty.f32())});
GlobalVar("g", ty.array(ty("S"), 3_u), type::AddressSpace::kPushConstant); GlobalVar("g", ty.array(ty("S"), 3_u), type::AddressSpace::kPushConstant);
@ -1002,7 +1002,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_PushConstantArrayF32) {
// enable chromium_experimental_push_constant; // enable chromium_experimental_push_constant;
// struct S { a : f32} // struct S { a : f32}
// type t = ptr<push_constant, array<S, 3u>>; // type t = ptr<push_constant, array<S, 3u>>;
Enable(ast::Extension::kChromiumExperimentalPushConstant); Enable(builtin::Extension::kChromiumExperimentalPushConstant);
Structure("S", utils::Vector{Member("a", ty.f32())}); Structure("S", utils::Vector{Member("a", ty.f32())});
Alias("t", ty.pointer(ty.array(ty("S"), 3_u), type::AddressSpace::kPushConstant)); Alias("t", ty.pointer(ty.array(ty("S"), 3_u), type::AddressSpace::kPushConstant));

View File

@ -471,7 +471,7 @@ TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, FourParams_Vector_f32) {
TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, OneParam_Scalar_f16) { TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, OneParam_Scalar_f16) {
auto param = GetParam(); auto param = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto val = 0.5_h; auto val = 0.5_h;
if (param.name == std::string("acosh")) { if (param.name == std::string("acosh")) {
@ -499,7 +499,7 @@ TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, OneParam_Scalar_f16) {
TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, OneParam_Vector_f16) { TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, OneParam_Vector_f16) {
auto param = GetParam(); auto param = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto val = param.name == std::string("acosh") ? vec3<f16>(1.0_h, 2.0_h, 3.0_h) auto val = param.name == std::string("acosh") ? vec3<f16>(1.0_h, 2.0_h, 3.0_h)
: vec3<f16>(0.5_h, 0.5_h, 0.8_h); : vec3<f16>(0.5_h, 0.5_h, 0.8_h);
@ -528,7 +528,7 @@ TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, OneParam_Vector_f16) {
TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, TwoParams_Scalar_f16) { TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, TwoParams_Scalar_f16) {
auto param = GetParam(); auto param = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* call = Call(param.name, 1_h, 1_h); auto* call = Call(param.name, 1_h, 1_h);
WrapInFunction(call); WrapInFunction(call);
@ -551,7 +551,7 @@ TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, TwoParams_Scalar_f16) {
TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, TwoParams_Vector_f16) { TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, TwoParams_Vector_f16) {
auto param = GetParam(); auto param = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* call = Call(param.name, vec3<f16>(1_h, 1_h, 3_h), vec3<f16>(1_h, 1_h, 3_h)); auto* call = Call(param.name, vec3<f16>(1_h, 1_h, 3_h), vec3<f16>(1_h, 1_h, 3_h));
WrapInFunction(call); WrapInFunction(call);
@ -577,7 +577,7 @@ TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, TwoParams_Vector_f16) {
TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, ThreeParams_Scalar_f16) { TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, ThreeParams_Scalar_f16) {
auto param = GetParam(); auto param = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* call = Call(param.name, 0_h, 1_h, 2_h); auto* call = Call(param.name, 0_h, 1_h, 2_h);
WrapInFunction(call); WrapInFunction(call);
@ -600,7 +600,7 @@ TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, ThreeParams_Scalar_f16) {
TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, ThreeParams_Vector_f16) { TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, ThreeParams_Vector_f16) {
auto param = GetParam(); auto param = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* call = Call(param.name, vec3<f16>(0_h, 0_h, 0_h), vec3<f16>(1_h, 1_h, 1_h), auto* call = Call(param.name, vec3<f16>(0_h, 0_h, 0_h), vec3<f16>(1_h, 1_h, 1_h),
vec3<f16>(2_h, 2_h, 2_h)); vec3<f16>(2_h, 2_h, 2_h));
@ -628,7 +628,7 @@ TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, ThreeParams_Vector_f16) {
TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, FourParams_Scalar_f16) { TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, FourParams_Scalar_f16) {
auto param = GetParam(); auto param = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* call = Call(param.name, 1_h, 1_h, 1_h, 1_h); auto* call = Call(param.name, 1_h, 1_h, 1_h, 1_h);
WrapInFunction(call); WrapInFunction(call);
@ -651,7 +651,7 @@ TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, FourParams_Scalar_f16) {
TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, FourParams_Vector_f16) { TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, FourParams_Vector_f16) {
auto param = GetParam(); auto param = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* call = Call(param.name, vec3<f16>(1_h, 1_h, 3_h), vec3<f16>(1_h, 1_h, 3_h), auto* call = Call(param.name, vec3<f16>(1_h, 1_h, 3_h), vec3<f16>(1_h, 1_h, 3_h),
vec3<f16>(1_h, 1_h, 3_h), vec3<f16>(1_h, 1_h, 3_h)); vec3<f16>(1_h, 1_h, 3_h), vec3<f16>(1_h, 1_h, 3_h));
@ -745,7 +745,7 @@ TEST_F(ResolverBuiltinFloatTest, Cross_f32) {
} }
TEST_F(ResolverBuiltinFloatTest, Cross_f16) { TEST_F(ResolverBuiltinFloatTest, Cross_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* call = Call("cross", vec3<f16>(1_h, 2_h, 3_h), vec3<f16>(1_h, 2_h, 3_h)); auto* call = Call("cross", vec3<f16>(1_h, 2_h, 3_h), vec3<f16>(1_h, 2_h, 3_h));
WrapInFunction(call); WrapInFunction(call);
@ -841,7 +841,7 @@ TEST_F(ResolverBuiltinFloatTest, Distance_Scalar_f32) {
} }
TEST_F(ResolverBuiltinFloatTest, Distance_Scalar_f16) { TEST_F(ResolverBuiltinFloatTest, Distance_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* call = Call("distance", 1_h, 1_h); auto* call = Call("distance", 1_h, 1_h);
WrapInFunction(call); WrapInFunction(call);
@ -863,7 +863,7 @@ TEST_F(ResolverBuiltinFloatTest, Distance_Vector_f32) {
} }
TEST_F(ResolverBuiltinFloatTest, Distance_Vector_f16) { TEST_F(ResolverBuiltinFloatTest, Distance_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* call = Call("distance", vec3<f16>(1_h, 1_h, 3_h), vec3<f16>(1_h, 1_h, 3_h)); auto* call = Call("distance", vec3<f16>(1_h, 1_h, 3_h), vec3<f16>(1_h, 1_h, 3_h));
WrapInFunction(call); WrapInFunction(call);
@ -949,7 +949,7 @@ TEST_F(ResolverBuiltinFloatTest, FrexpScalar_f32) {
} }
TEST_F(ResolverBuiltinFloatTest, FrexpScalar_f16) { TEST_F(ResolverBuiltinFloatTest, FrexpScalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* call = Call("frexp", 1_h); auto* call = Call("frexp", 1_h);
WrapInFunction(call); WrapInFunction(call);
@ -1013,7 +1013,7 @@ TEST_F(ResolverBuiltinFloatTest, FrexpVector_f32) {
} }
TEST_F(ResolverBuiltinFloatTest, FrexpVector_f16) { TEST_F(ResolverBuiltinFloatTest, FrexpVector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* call = Call("frexp", vec3<f16>()); auto* call = Call("frexp", vec3<f16>());
WrapInFunction(call); WrapInFunction(call);
@ -1075,7 +1075,7 @@ TEST_F(ResolverBuiltinFloatTest, Length_Scalar_f32) {
} }
TEST_F(ResolverBuiltinFloatTest, Length_Scalar_f16) { TEST_F(ResolverBuiltinFloatTest, Length_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* call = Call("length", 1_h); auto* call = Call("length", 1_h);
WrapInFunction(call); WrapInFunction(call);
@ -1097,7 +1097,7 @@ TEST_F(ResolverBuiltinFloatTest, Length_FloatVector_f32) {
} }
TEST_F(ResolverBuiltinFloatTest, Length_FloatVector_f16) { TEST_F(ResolverBuiltinFloatTest, Length_FloatVector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* call = Call("length", vec3<f16>(1_h, 1_h, 3_h)); auto* call = Call("length", vec3<f16>(1_h, 1_h, 3_h));
WrapInFunction(call); WrapInFunction(call);
@ -1152,7 +1152,7 @@ TEST_F(ResolverBuiltinFloatTest, Mix_VectorScalar_f32) {
} }
TEST_F(ResolverBuiltinFloatTest, Mix_VectorScalar_f16) { TEST_F(ResolverBuiltinFloatTest, Mix_VectorScalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* call = Call("mix", vec3<f16>(1_h, 1_h, 1_h), vec3<f16>(1_h, 1_h, 1_h), 4_h); auto* call = Call("mix", vec3<f16>(1_h, 1_h, 1_h), vec3<f16>(1_h, 1_h, 1_h), 4_h);
WrapInFunction(call); WrapInFunction(call);
@ -1198,7 +1198,7 @@ TEST_F(ResolverBuiltinFloatTest, ModfScalar_f32) {
} }
TEST_F(ResolverBuiltinFloatTest, ModfScalar_f16) { TEST_F(ResolverBuiltinFloatTest, ModfScalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* call = Call("modf", 1_h); auto* call = Call("modf", 1_h);
WrapInFunction(call); WrapInFunction(call);
@ -1262,7 +1262,7 @@ TEST_F(ResolverBuiltinFloatTest, ModfVector_f32) {
} }
TEST_F(ResolverBuiltinFloatTest, ModfVector_f16) { TEST_F(ResolverBuiltinFloatTest, ModfVector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* call = Call("modf", vec3<f16>()); auto* call = Call("modf", vec3<f16>());
WrapInFunction(call); WrapInFunction(call);
@ -1372,7 +1372,7 @@ TEST_F(ResolverBuiltinFloatTest, Normalize_Vector_f32) {
} }
TEST_F(ResolverBuiltinFloatTest, Normalize_Vector_f16) { TEST_F(ResolverBuiltinFloatTest, Normalize_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* call = Call("normalize", vec3<f16>(1_h, 1_h, 3_h)); auto* call = Call("normalize", vec3<f16>(1_h, 1_h, 3_h));
WrapInFunction(call); WrapInFunction(call);
@ -1835,7 +1835,7 @@ TEST_F(ResolverBuiltinTest, Determinant_2x2_f32) {
} }
TEST_F(ResolverBuiltinTest, Determinant_2x2_f16) { TEST_F(ResolverBuiltinTest, Determinant_2x2_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("var", ty.mat2x2<f16>(), type::AddressSpace::kPrivate); GlobalVar("var", ty.mat2x2<f16>(), type::AddressSpace::kPrivate);
@ -1861,7 +1861,7 @@ TEST_F(ResolverBuiltinTest, Determinant_3x3_f32) {
} }
TEST_F(ResolverBuiltinTest, Determinant_3x3_f16) { TEST_F(ResolverBuiltinTest, Determinant_3x3_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("var", ty.mat3x3<f16>(), type::AddressSpace::kPrivate); GlobalVar("var", ty.mat3x3<f16>(), type::AddressSpace::kPrivate);
@ -1887,7 +1887,7 @@ TEST_F(ResolverBuiltinTest, Determinant_4x4_f32) {
} }
TEST_F(ResolverBuiltinTest, Determinant_4x4_f16) { TEST_F(ResolverBuiltinTest, Determinant_4x4_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("var", ty.mat4x4<f16>(), type::AddressSpace::kPrivate); GlobalVar("var", ty.mat4x4<f16>(), type::AddressSpace::kPrivate);
@ -1948,7 +1948,7 @@ TEST_F(ResolverBuiltinTest, Dot_Vec2_f32) {
} }
TEST_F(ResolverBuiltinTest, Dot_Vec2_f16) { TEST_F(ResolverBuiltinTest, Dot_Vec2_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("my_var", ty.vec2<f16>(), type::AddressSpace::kPrivate); GlobalVar("my_var", ty.vec2<f16>(), type::AddressSpace::kPrivate);

View File

@ -523,7 +523,7 @@ using ResolverDP4aExtensionValidationTest = ResolverTest;
TEST_F(ResolverDP4aExtensionValidationTest, Dot4I8PackedWithExtension) { TEST_F(ResolverDP4aExtensionValidationTest, Dot4I8PackedWithExtension) {
// enable chromium_experimental_dp4a; // enable chromium_experimental_dp4a;
// fn func { return dot4I8Packed(1u, 2u); } // fn func { return dot4I8Packed(1u, 2u); }
Enable(ast::Extension::kChromiumExperimentalDp4A); Enable(builtin::Extension::kChromiumExperimentalDp4A);
Func("func", utils::Empty, ty.i32(), Func("func", utils::Empty, ty.i32(),
utils::Vector{ utils::Vector{
@ -551,7 +551,7 @@ TEST_F(ResolverDP4aExtensionValidationTest, Dot4I8PackedWithoutExtension) {
TEST_F(ResolverDP4aExtensionValidationTest, Dot4U8PackedWithExtension) { TEST_F(ResolverDP4aExtensionValidationTest, Dot4U8PackedWithExtension) {
// enable chromium_experimental_dp4a; // enable chromium_experimental_dp4a;
// fn func { return dot4U8Packed(1u, 2u); } // fn func { return dot4U8Packed(1u, 2u); }
Enable(ast::Extension::kChromiumExperimentalDp4A); Enable(builtin::Extension::kChromiumExperimentalDp4A);
Func("func", utils::Empty, ty.u32(), Func("func", utils::Empty, ty.u32(),
utils::Vector{ utils::Vector{

View File

@ -82,7 +82,7 @@ static constexpr Params all_param_types[] = {
}; };
TEST_F(ResolverCallTest, Valid) { TEST_F(ResolverCallTest, Valid) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
utils::Vector<const ast::Parameter*, 4> params; utils::Vector<const ast::Parameter*, 4> params;
utils::Vector<const ast::Expression*, 4> args; utils::Vector<const ast::Expression*, 4> args;

View File

@ -165,7 +165,7 @@ TEST_F(ResolverCallValidationTest,
// var v : S; // var v : S;
// foo(&v.m); // foo(&v.m);
// } // }
Enable(ast::Extension::kChromiumExperimentalFullPtrParameters); Enable(builtin::Extension::kChromiumExperimentalFullPtrParameters);
auto* S = Structure("S", utils::Vector{ auto* S = Structure("S", utils::Vector{
Member("m", ty.i32()), Member("m", ty.i32()),
}); });
@ -346,7 +346,7 @@ TEST_F(ResolverCallValidationTest, LetPointer_NotWholeVar_WithFullPtrParametersE
// let p: ptr<function, i32> = &(v[0]); // let p: ptr<function, i32> = &(v[0]);
// x(p); // x(p);
// } // }
Enable(ast::Extension::kChromiumExperimentalFullPtrParameters); Enable(builtin::Extension::kChromiumExperimentalFullPtrParameters);
Func("foo", Func("foo",
utils::Vector{ utils::Vector{
Param("p", ty.pointer<i32>(type::AddressSpace::kFunction)), Param("p", ty.pointer<i32>(type::AddressSpace::kFunction)),
@ -437,7 +437,7 @@ TEST_F(ResolverCallValidationTest, ComplexPointerChain_NotWholeVar_WithFullPtrPa
// let p3 = &(*p2)[0]; // let p3 = &(*p2)[0];
// foo(&*p); // foo(&*p);
// } // }
Enable(ast::Extension::kChromiumExperimentalFullPtrParameters); Enable(builtin::Extension::kChromiumExperimentalFullPtrParameters);
Func("foo", Func("foo",
utils::Vector{ utils::Vector{
Param("p", ty.pointer<i32>(type::AddressSpace::kFunction)), Param("p", ty.pointer<i32>(type::AddressSpace::kFunction)),

View File

@ -83,7 +83,7 @@ std::ostream& operator<<(std::ostream& o, const ErrorCase& c) {
using ResolverConstEvalBinaryOpTest = ResolverTestWithParam<std::tuple<ast::BinaryOp, Case>>; using ResolverConstEvalBinaryOpTest = ResolverTestWithParam<std::tuple<ast::BinaryOp, Case>>;
TEST_P(ResolverConstEvalBinaryOpTest, Test) { TEST_P(ResolverConstEvalBinaryOpTest, Test) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto op = std::get<0>(GetParam()); auto op = std::get<0>(GetParam());
auto& c = std::get<1>(GetParam()); auto& c = std::get<1>(GetParam());

View File

@ -142,7 +142,7 @@ static Case E(std::initializer_list<ScalarTypes> sargs, std::string err) {
using ResolverConstEvalBuiltinTest = ResolverTestWithParam<std::tuple<sem::BuiltinType, Case>>; using ResolverConstEvalBuiltinTest = ResolverTestWithParam<std::tuple<sem::BuiltinType, Case>>;
TEST_P(ResolverConstEvalBuiltinTest, Test) { TEST_P(ResolverConstEvalBuiltinTest, Test) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto builtin = std::get<0>(GetParam()); auto builtin = std::get<0>(GetParam());
auto& c = std::get<1>(GetParam()); auto& c = std::get<1>(GetParam());

View File

@ -102,7 +102,7 @@ TEST_F(ResolverConstEvalTest, Scalar_f32) {
} }
TEST_F(ResolverConstEvalTest, Scalar_f16) { TEST_F(ResolverConstEvalTest, Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* expr = Expr(9.9_h); auto* expr = Expr(9.9_h);
WrapInFunction(expr); WrapInFunction(expr);
@ -146,7 +146,7 @@ Case C() {
} }
using ResolverConstEvalZeroInitTest = ResolverTestWithParam<Case>; using ResolverConstEvalZeroInitTest = ResolverTestWithParam<Case>;
TEST_P(ResolverConstEvalZeroInitTest, Test) { TEST_P(ResolverConstEvalZeroInitTest, Test) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto& param = GetParam(); auto& param = GetParam();
auto ty = param.type(*this); auto ty = param.type(*this);
auto* expr = Call(ty); auto* expr = Call(ty);
@ -316,7 +316,7 @@ TEST_F(ResolverConstEvalTest, Vec3_ZeroInit_f32) {
} }
TEST_F(ResolverConstEvalTest, Vec3_ZeroInit_f16) { TEST_F(ResolverConstEvalTest, Vec3_ZeroInit_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* expr = vec3<f16>(); auto* expr = vec3<f16>();
WrapInFunction(expr); WrapInFunction(expr);
@ -483,7 +483,7 @@ TEST_F(ResolverConstEvalTest, Vec3_Splat_f32) {
} }
TEST_F(ResolverConstEvalTest, Vec3_Splat_f16) { TEST_F(ResolverConstEvalTest, Vec3_Splat_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* expr = vec3<f16>(9.9_h); auto* expr = vec3<f16>(9.9_h);
WrapInFunction(expr); WrapInFunction(expr);
@ -719,7 +719,7 @@ TEST_F(ResolverConstEvalTest, Vec3_FullConstruct_f32) {
} }
TEST_F(ResolverConstEvalTest, Vec3_FullConstruct_f16) { TEST_F(ResolverConstEvalTest, Vec3_FullConstruct_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* expr = vec3<f16>(1_h, 2_h, 3_h); auto* expr = vec3<f16>(1_h, 2_h, 3_h);
WrapInFunction(expr); WrapInFunction(expr);
@ -1018,7 +1018,7 @@ TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f32_mixed_sign_0) {
} }
TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16) { TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* expr = vec3<f16>(1_h, vec2<f16>(2_h, 3_h)); auto* expr = vec3<f16>(1_h, vec2<f16>(2_h, 3_h));
WrapInFunction(expr); WrapInFunction(expr);
@ -1053,7 +1053,7 @@ TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16) {
} }
TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_all_10) { TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_all_10) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* expr = vec3<f16>(10_h, vec2<f16>(10_h, 10_h)); auto* expr = vec3<f16>(10_h, vec2<f16>(10_h, 10_h));
WrapInFunction(expr); WrapInFunction(expr);
@ -1088,7 +1088,7 @@ TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_all_10) {
} }
TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_all_positive_0) { TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_all_positive_0) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* expr = vec3<f16>(0_h, vec2<f16>(0_h, 0_h)); auto* expr = vec3<f16>(0_h, vec2<f16>(0_h, 0_h));
WrapInFunction(expr); WrapInFunction(expr);
@ -1123,7 +1123,7 @@ TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_all_positive_0) {
} }
TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_all_negative_0) { TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_all_negative_0) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* expr = vec3<f16>(vec2<f16>(-0_h, -0_h), -0_h); auto* expr = vec3<f16>(vec2<f16>(-0_h, -0_h), -0_h);
WrapInFunction(expr); WrapInFunction(expr);
@ -1158,7 +1158,7 @@ TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_all_negative_0) {
} }
TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_mixed_sign_0) { TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_mixed_sign_0) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* expr = vec3<f16>(0_h, vec2<f16>(-0_h, 0_h)); auto* expr = vec3<f16>(0_h, vec2<f16>(-0_h, 0_h));
WrapInFunction(expr); WrapInFunction(expr);
@ -1341,7 +1341,7 @@ TEST_F(ResolverConstEvalTest, Mat2x3_ZeroInit_f32) {
} }
TEST_F(ResolverConstEvalTest, Mat2x3_ZeroInit_f16) { TEST_F(ResolverConstEvalTest, Mat2x3_ZeroInit_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* expr = mat2x3<f16>(); auto* expr = mat2x3<f16>();
WrapInFunction(expr); WrapInFunction(expr);
@ -1704,7 +1704,7 @@ static std::ostream& operator<<(std::ostream& o, const Case& c) {
using ResolverConstEvalArrayInitTest = ResolverTestWithParam<Case>; using ResolverConstEvalArrayInitTest = ResolverTestWithParam<Case>;
TEST_P(ResolverConstEvalArrayInitTest, Test) { TEST_P(ResolverConstEvalArrayInitTest, Test) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto& param = GetParam(); auto& param = GetParam();
auto* expr = param.input.Expr(*this); auto* expr = param.input.Expr(*this);
auto* a = Const("a", expr); auto* a = Const("a", expr);
@ -1892,7 +1892,7 @@ TEST_F(ResolverConstEvalTest, Array_Struct_f32_Elements) {
} }
TEST_F(ResolverConstEvalTest, Struct_ZeroInit) { TEST_F(ResolverConstEvalTest, Struct_ZeroInit) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* s = Structure("S", utils::Vector{ auto* s = Structure("S", utils::Vector{
Member("a", ty.i32()), Member("a", ty.i32()),
Member("b", ty.u32()), Member("b", ty.u32()),
@ -1937,7 +1937,7 @@ TEST_F(ResolverConstEvalTest, Struct_ZeroInit) {
} }
TEST_F(ResolverConstEvalTest, Struct_Nested_ZeroInit) { TEST_F(ResolverConstEvalTest, Struct_Nested_ZeroInit) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* inner = Structure("Inner", utils::Vector{ auto* inner = Structure("Inner", utils::Vector{
Member("a", ty.i32()), Member("a", ty.i32()),
Member("b", ty.u32()), Member("b", ty.u32()),
@ -2028,7 +2028,7 @@ TEST_F(ResolverConstEvalTest, Struct_I32s_ZeroInit) {
} }
TEST_F(ResolverConstEvalTest, Struct_MixedScalars_ZeroInit) { TEST_F(ResolverConstEvalTest, Struct_MixedScalars_ZeroInit) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Structure("S", utils::Vector{ Structure("S", utils::Vector{
Member("m1", ty.i32()), Member("m1", ty.i32()),
@ -2138,7 +2138,7 @@ TEST_F(ResolverConstEvalTest, Struct_VectorF32s_ZeroInit) {
} }
TEST_F(ResolverConstEvalTest, Struct_MixedVectors_ZeroInit) { TEST_F(ResolverConstEvalTest, Struct_MixedVectors_ZeroInit) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Structure("S", utils::Vector{ Structure("S", utils::Vector{
Member("m1", ty.vec2<i32>()), Member("m1", ty.vec2<i32>()),
@ -2258,7 +2258,7 @@ TEST_F(ResolverConstEvalTest, Struct_Struct_ZeroInit) {
} }
TEST_F(ResolverConstEvalTest, Struct_MixedScalars_Construct) { TEST_F(ResolverConstEvalTest, Struct_MixedScalars_Construct) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Structure("S", utils::Vector{ Structure("S", utils::Vector{
Member("m1", ty.i32()), Member("m1", ty.i32()),
@ -2315,7 +2315,7 @@ TEST_F(ResolverConstEvalTest, Struct_MixedScalars_Construct) {
} }
TEST_F(ResolverConstEvalTest, Struct_MixedVectors_Construct) { TEST_F(ResolverConstEvalTest, Struct_MixedVectors_Construct) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Structure("S", utils::Vector{ Structure("S", utils::Vector{
Member("m1", ty.vec2<i32>()), Member("m1", ty.vec2<i32>()),

View File

@ -289,7 +289,7 @@ TEST_F(ResolverConstEvalTest, Vec3_Convert_u32_to_f32) {
} }
TEST_F(ResolverConstEvalTest, Vec3_Convert_f16_to_i32) { TEST_F(ResolverConstEvalTest, Vec3_Convert_f16_to_i32) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* expr = vec3<i32>(vec3<f16>(1.1_h, 2.2_h, 3.3_h)); auto* expr = vec3<i32>(vec3<f16>(1.1_h, 2.2_h, 3.3_h));
WrapInFunction(expr); WrapInFunction(expr);
@ -324,7 +324,7 @@ TEST_F(ResolverConstEvalTest, Vec3_Convert_f16_to_i32) {
} }
TEST_F(ResolverConstEvalTest, Vec3_Convert_u32_to_f16) { TEST_F(ResolverConstEvalTest, Vec3_Convert_u32_to_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* expr = vec3<f16>(vec3<u32>(10_u, 20_u, 30_u)); auto* expr = vec3<f16>(vec3<u32>(10_u, 20_u, 30_u));
WrapInFunction(expr); WrapInFunction(expr);
@ -425,7 +425,7 @@ TEST_F(ResolverConstEvalTest, Vec3_Convert_Large_f32_to_u32) {
} }
TEST_F(ResolverConstEvalTest, Vec3_Convert_Large_f32_to_f16) { TEST_F(ResolverConstEvalTest, Vec3_Convert_Large_f32_to_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* expr = vec3<f16>(Source{{12, 34}}, vec3<f32>(1e10_f, 0_f, 0_f)); auto* expr = vec3<f16>(Source{{12, 34}}, vec3<f32>(1e10_f, 0_f, 0_f));
WrapInFunction(expr); WrapInFunction(expr);
@ -435,7 +435,7 @@ TEST_F(ResolverConstEvalTest, Vec3_Convert_Large_f32_to_f16) {
} }
TEST_F(ResolverConstEvalTest, Vec3_Convert_Small_f32_to_f16) { TEST_F(ResolverConstEvalTest, Vec3_Convert_Small_f32_to_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* expr = vec3<f16>(vec3<f32>(1e-20_f, -2e-30_f, 3e-40_f)); auto* expr = vec3<f16>(vec3<f32>(1e-20_f, -2e-30_f, 3e-40_f));
WrapInFunction(expr); WrapInFunction(expr);

View File

@ -68,7 +68,7 @@ static std::ostream& operator<<(std::ostream& o, const Case& c) {
using ResolverConstEvalSwizzleTest = ResolverTestWithParam<Case>; using ResolverConstEvalSwizzleTest = ResolverTestWithParam<Case>;
TEST_P(ResolverConstEvalSwizzleTest, Test) { TEST_P(ResolverConstEvalSwizzleTest, Test) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto& param = GetParam(); auto& param = GetParam();
auto* expr = MemberAccessor(param.input.Expr(*this), param.swizzle); auto* expr = MemberAccessor(param.input.Expr(*this), param.swizzle);
auto* a = Const("a", expr); auto* a = Const("a", expr);

View File

@ -263,7 +263,7 @@ static std::ostream& operator<<(std::ostream& o, const Case& c) {
using ResolverConstEvalArrayAccessTest = ResolverTestWithParam<Case>; using ResolverConstEvalArrayAccessTest = ResolverTestWithParam<Case>;
TEST_P(ResolverConstEvalArrayAccessTest, Test) { TEST_P(ResolverConstEvalArrayAccessTest, Test) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto& param = GetParam(); auto& param = GetParam();
auto* expr = param.input.Expr(*this); auto* expr = param.input.Expr(*this);
@ -338,7 +338,7 @@ static std::ostream& operator<<(std::ostream& o, const Case& c) {
using ResolverConstEvalVectorAccessTest = ResolverTestWithParam<Case>; using ResolverConstEvalVectorAccessTest = ResolverTestWithParam<Case>;
TEST_P(ResolverConstEvalVectorAccessTest, Test) { TEST_P(ResolverConstEvalVectorAccessTest, Test) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto& param = GetParam(); auto& param = GetParam();
auto* expr = param.input.Expr(*this); auto* expr = param.input.Expr(*this);

View File

@ -42,7 +42,7 @@ Case C(T input, U expected) {
using ResolverConstEvalUnaryOpTest = ResolverTestWithParam<std::tuple<ast::UnaryOp, Case>>; using ResolverConstEvalUnaryOpTest = ResolverTestWithParam<std::tuple<ast::UnaryOp, Case>>;
TEST_P(ResolverConstEvalUnaryOpTest, Test) { TEST_P(ResolverConstEvalUnaryOpTest, Test) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto op = std::get<0>(GetParam()); auto op = std::get<0>(GetParam());
auto& c = std::get<1>(GetParam()); auto& c = std::get<1>(GetParam());

View File

@ -1094,7 +1094,7 @@ TEST_F(ResolverDependencyGraphOrderedGlobalsTest, DirectiveFirst) {
// a transform may produce such a AST tree that has some declarations before directive nodes. // a transform may produce such a AST tree that has some declarations before directive nodes.
// DependencyGraph should deal with these cases. // DependencyGraph should deal with these cases.
auto* var_1 = GlobalVar("SYMBOL1", ty.i32()); auto* var_1 = GlobalVar("SYMBOL1", ty.i32());
auto* enable = Enable(ast::Extension::kF16); auto* enable = Enable(builtin::Extension::kF16);
auto* var_2 = GlobalVar("SYMBOL2", ty.f32()); auto* var_2 = GlobalVar("SYMBOL2", ty.f32());
auto* diagnostic = DiagnosticDirective(ast::DiagnosticSeverity::kWarning, "foo"); auto* diagnostic = DiagnosticDirective(ast::DiagnosticSeverity::kWarning, "foo");

View File

@ -455,7 +455,7 @@ TEST_F(ResolverEntryPointValidationTest, VertexShaderMustReturnPosition) {
TEST_F(ResolverEntryPointValidationTest, PushConstantAllowedWithEnable) { TEST_F(ResolverEntryPointValidationTest, PushConstantAllowedWithEnable) {
// enable chromium_experimental_push_constant; // enable chromium_experimental_push_constant;
// var<push_constant> a : u32; // var<push_constant> a : u32;
Enable(ast::Extension::kChromiumExperimentalPushConstant); Enable(builtin::Extension::kChromiumExperimentalPushConstant);
GlobalVar("a", ty.u32(), type::AddressSpace::kPushConstant); GlobalVar("a", ty.u32(), type::AddressSpace::kPushConstant);
EXPECT_TRUE(r()->Resolve()); EXPECT_TRUE(r()->Resolve());
@ -485,7 +485,7 @@ TEST_F(ResolverEntryPointValidationTest, PushConstantOneVariableUsedInEntryPoint
// @compute @workgroup_size(1) fn main() { // @compute @workgroup_size(1) fn main() {
// _ = a; // _ = a;
// } // }
Enable(ast::Extension::kChromiumExperimentalPushConstant); Enable(builtin::Extension::kChromiumExperimentalPushConstant);
GlobalVar("a", ty.u32(), type::AddressSpace::kPushConstant); GlobalVar("a", ty.u32(), type::AddressSpace::kPushConstant);
Func("main", {}, ty.void_(), utils::Vector{Assign(Phony(), "a")}, Func("main", {}, ty.void_(), utils::Vector{Assign(Phony(), "a")},
@ -503,7 +503,7 @@ TEST_F(ResolverEntryPointValidationTest, PushConstantTwoVariablesUsedInEntryPoin
// _ = a; // _ = a;
// _ = b; // _ = b;
// } // }
Enable(ast::Extension::kChromiumExperimentalPushConstant); Enable(builtin::Extension::kChromiumExperimentalPushConstant);
GlobalVar(Source{{1, 2}}, "a", ty.u32(), type::AddressSpace::kPushConstant); GlobalVar(Source{{1, 2}}, "a", ty.u32(), type::AddressSpace::kPushConstant);
GlobalVar(Source{{3, 4}}, "b", ty.u32(), type::AddressSpace::kPushConstant); GlobalVar(Source{{3, 4}}, "b", ty.u32(), type::AddressSpace::kPushConstant);
@ -534,7 +534,7 @@ TEST_F(ResolverEntryPointValidationTest,
// uses_a(); // uses_a();
// uses_b(); // uses_b();
// } // }
Enable(ast::Extension::kChromiumExperimentalPushConstant); Enable(builtin::Extension::kChromiumExperimentalPushConstant);
GlobalVar(Source{{1, 2}}, "a", ty.u32(), type::AddressSpace::kPushConstant); GlobalVar(Source{{1, 2}}, "a", ty.u32(), type::AddressSpace::kPushConstant);
GlobalVar(Source{{3, 4}}, "b", ty.u32(), type::AddressSpace::kPushConstant); GlobalVar(Source{{3, 4}}, "b", ty.u32(), type::AddressSpace::kPushConstant);
@ -567,7 +567,7 @@ TEST_F(ResolverEntryPointValidationTest, PushConstantTwoVariablesUsedInDifferent
// @compute @workgroup_size(1) fn uses_b() { // @compute @workgroup_size(1) fn uses_b() {
// _ = a; // _ = a;
// } // }
Enable(ast::Extension::kChromiumExperimentalPushConstant); Enable(builtin::Extension::kChromiumExperimentalPushConstant);
GlobalVar("a", ty.u32(), type::AddressSpace::kPushConstant); GlobalVar("a", ty.u32(), type::AddressSpace::kPushConstant);
GlobalVar("b", ty.u32(), type::AddressSpace::kPushConstant); GlobalVar("b", ty.u32(), type::AddressSpace::kPushConstant);
@ -624,7 +624,7 @@ TEST_P(TypeValidationTest, BareInputs) {
// fn main(@location(0) @interpolate(flat) a : *) {} // fn main(@location(0) @interpolate(flat) a : *) {}
auto params = GetParam(); auto params = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* a = Param("a", params.create_ast_type(*this), auto* a = Param("a", params.create_ast_type(*this),
utils::Vector{ utils::Vector{
@ -655,7 +655,7 @@ TEST_P(TypeValidationTest, StructInputs) {
// fn main(a : Input) {} // fn main(a : Input) {}
auto params = GetParam(); auto params = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* input = Structure("Input", utils::Vector{ auto* input = Structure("Input", utils::Vector{
Member("a", params.create_ast_type(*this), Member("a", params.create_ast_type(*this),
@ -685,7 +685,7 @@ TEST_P(TypeValidationTest, BareOutputs) {
// } // }
auto params = GetParam(); auto params = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Func(Source{{12, 34}}, "main", utils::Empty, params.create_ast_type(*this), Func(Source{{12, 34}}, "main", utils::Empty, params.create_ast_type(*this),
utils::Vector{ utils::Vector{
@ -715,7 +715,7 @@ TEST_P(TypeValidationTest, StructOutputs) {
// } // }
auto params = GetParam(); auto params = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* output = Structure( auto* output = Structure(
"Output", utils::Vector{ "Output", utils::Vector{

View File

@ -220,7 +220,7 @@ TEST_P(ResolverExpressionKindTest, Test) {
GlobalVar("v", ty("texture_storage_2d", "rgba8unorm", expr), Group(0_u), Binding(0_u)); GlobalVar("v", ty("texture_storage_2d", "rgba8unorm", expr), Group(0_u), Binding(0_u));
break; break;
case Use::kAddressSpace: case Use::kAddressSpace:
Enable(ast::Extension::kChromiumExperimentalFullPtrParameters); Enable(builtin::Extension::kChromiumExperimentalFullPtrParameters);
Func("f", utils::Vector{Param("p", ty("ptr", expr, ty.f32()))}, ty.void_(), Func("f", utils::Vector{Param("p", ty("ptr", expr, ty.f32()))}, ty.void_(),
utils::Empty); utils::Empty);
break; break;

View File

@ -27,7 +27,7 @@ using ResolverF16ExtensionTest = ResolverTest;
TEST_F(ResolverF16ExtensionTest, TypeUsedWithExtension) { TEST_F(ResolverF16ExtensionTest, TypeUsedWithExtension) {
// enable f16; // enable f16;
// var<private> v : f16; // var<private> v : f16;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("v", ty.f16(), type::AddressSpace::kPrivate); GlobalVar("v", ty.f16(), type::AddressSpace::kPrivate);
@ -45,7 +45,7 @@ TEST_F(ResolverF16ExtensionTest, TypeUsedWithoutExtension) {
TEST_F(ResolverF16ExtensionTest, Vec2TypeUsedWithExtension) { TEST_F(ResolverF16ExtensionTest, Vec2TypeUsedWithExtension) {
// enable f16; // enable f16;
// var<private> v : vec2<f16>; // var<private> v : vec2<f16>;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("v", ty.vec2<f16>(), type::AddressSpace::kPrivate); GlobalVar("v", ty.vec2<f16>(), type::AddressSpace::kPrivate);
@ -63,7 +63,7 @@ TEST_F(ResolverF16ExtensionTest, Vec2TypeUsedWithoutExtension) {
TEST_F(ResolverF16ExtensionTest, Vec2TypeInitUsedWithExtension) { TEST_F(ResolverF16ExtensionTest, Vec2TypeInitUsedWithExtension) {
// enable f16; // enable f16;
// var<private> v = vec2<f16>(); // var<private> v = vec2<f16>();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("v", vec2<f16>(), type::AddressSpace::kPrivate); GlobalVar("v", vec2<f16>(), type::AddressSpace::kPrivate);
@ -81,7 +81,7 @@ TEST_F(ResolverF16ExtensionTest, Vec2TypeInitUsedWithoutExtension) {
TEST_F(ResolverF16ExtensionTest, Vec2TypeConvUsedWithExtension) { TEST_F(ResolverF16ExtensionTest, Vec2TypeConvUsedWithExtension) {
// enable f16; // enable f16;
// var<private> v = vec2<f16>(vec2<f32>()); // var<private> v = vec2<f16>(vec2<f32>());
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("v", vec2<f16>(vec2<f32>()), type::AddressSpace::kPrivate); GlobalVar("v", vec2<f16>(vec2<f32>()), type::AddressSpace::kPrivate);
@ -99,7 +99,7 @@ TEST_F(ResolverF16ExtensionTest, Vec2TypeConvUsedWithoutExtension) {
TEST_F(ResolverF16ExtensionTest, F16LiteralUsedWithExtension) { TEST_F(ResolverF16ExtensionTest, F16LiteralUsedWithExtension) {
// enable f16; // enable f16;
// var<private> v = 16h; // var<private> v = 16h;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("v", Expr(16_h), type::AddressSpace::kPrivate); GlobalVar("v", Expr(16_h), type::AddressSpace::kPrivate);
@ -119,7 +119,7 @@ using ResolverF16ExtensionBuiltinTypeAliasTest = ResolverTestWithParam<const cha
TEST_P(ResolverF16ExtensionBuiltinTypeAliasTest, Vec2hTypeUsedWithExtension) { TEST_P(ResolverF16ExtensionBuiltinTypeAliasTest, Vec2hTypeUsedWithExtension) {
// enable f16; // enable f16;
// var<private> v : vec2h; // var<private> v : vec2h;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("v", ty(Source{{12, 34}}, GetParam()), type::AddressSpace::kPrivate); GlobalVar("v", ty(Source{{12, 34}}, GetParam()), type::AddressSpace::kPrivate);

View File

@ -1081,7 +1081,7 @@ TEST_P(ResolverFunctionParameterValidationTest, AddressSpaceWithExtension) {
auto& param = GetParam(); auto& param = GetParam();
auto ptr_type = ty("ptr", Ident(Source{{12, 34}}, param.address_space), ty.i32()); auto ptr_type = ty("ptr", Ident(Source{{12, 34}}, param.address_space), ty.i32());
auto* arg = Param(Source{{12, 34}}, "p", ptr_type); auto* arg = Param(Source{{12, 34}}, "p", ptr_type);
Enable(ast::Extension::kChromiumExperimentalFullPtrParameters); Enable(builtin::Extension::kChromiumExperimentalFullPtrParameters);
Func("f", utils::Vector{arg}, ty.void_(), utils::Empty); Func("f", utils::Vector{arg}, ty.void_(), utils::Empty);
if (param.expectation == Expectation::kAlwaysPass || if (param.expectation == Expectation::kAlwaysPass ||

View File

@ -97,7 +97,7 @@ TEST_F(ResolverHostShareableValidationTest, NestedStructures) {
} }
TEST_F(ResolverHostShareableValidationTest, NoError) { TEST_F(ResolverHostShareableValidationTest, NoError) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* i1 = Structure("I1", utils::Vector{ auto* i1 = Structure("I1", utils::Vector{
Member(Source{{1, 1}}, "w1", ty.f32()), Member(Source{{1, 1}}, "w1", ty.f32()),

View File

@ -312,7 +312,7 @@ using MaterializeAbstractNumericToConcreteType =
MaterializeTest<std::tuple<Expectation, Method, Data>>; MaterializeTest<std::tuple<Expectation, Method, Data>>;
TEST_P(MaterializeAbstractNumericToConcreteType, Test) { TEST_P(MaterializeAbstractNumericToConcreteType, Test) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
const auto& param = GetParam(); const auto& param = GetParam();
const auto& expectation = std::get<0>(param); const auto& expectation = std::get<0>(param);
@ -1282,7 +1282,7 @@ TEST_F(MaterializeAbstractStructure, Modf_Vector_DefaultType) {
TEST_F(MaterializeAbstractStructure, Modf_Scalar_ExplicitType) { TEST_F(MaterializeAbstractStructure, Modf_Scalar_ExplicitType) {
// var v = modf(1_h); // v is __modf_result_f16 // var v = modf(1_h); // v is __modf_result_f16
// v = modf(1); // __modf_result_f16 <- __modf_result_abstract // v = modf(1); // __modf_result_f16 <- __modf_result_abstract
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* call = Call("modf", 1_a); auto* call = Call("modf", 1_a);
WrapInFunction(Decl(Var("v", Call("modf", 1_h))), // WrapInFunction(Decl(Var("v", Call("modf", 1_h))), //
Assign("v", call)); Assign("v", call));
@ -1301,7 +1301,7 @@ TEST_F(MaterializeAbstractStructure, Modf_Scalar_ExplicitType) {
TEST_F(MaterializeAbstractStructure, Modf_Vector_ExplicitType) { TEST_F(MaterializeAbstractStructure, Modf_Vector_ExplicitType) {
// var v = modf(vec2(1_h)); // v is __modf_result_vec2_f16 // var v = modf(vec2(1_h)); // v is __modf_result_vec2_f16
// v = modf(vec2(1)); // __modf_result_vec2_f16 <- __modf_result_vec2_abstract // v = modf(vec2(1)); // __modf_result_vec2_f16 <- __modf_result_vec2_abstract
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* call = Call("modf", Call(ty.vec2<Infer>(), 1_a)); auto* call = Call("modf", Call(ty.vec2<Infer>(), 1_a));
WrapInFunction(Decl(Var("v", Call("modf", Call(ty.vec2<Infer>(), 1_h)))), Assign("v", call)); WrapInFunction(Decl(Var("v", Call("modf", Call(ty.vec2<Infer>(), 1_h)))), Assign("v", call));
ASSERT_TRUE(r()->Resolve()) << r()->error(); ASSERT_TRUE(r()->Resolve()) << r()->error();
@ -1363,7 +1363,7 @@ TEST_F(MaterializeAbstractStructure, Frexp_Vector_DefaultType) {
TEST_F(MaterializeAbstractStructure, Frexp_Scalar_ExplicitType) { TEST_F(MaterializeAbstractStructure, Frexp_Scalar_ExplicitType) {
// var v = frexp(1_h); // v is __frexp_result_f16 // var v = frexp(1_h); // v is __frexp_result_f16
// v = frexp(1); // __frexp_result_f16 <- __frexp_result_abstract // v = frexp(1); // __frexp_result_f16 <- __frexp_result_abstract
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* call = Call("frexp", 1_a); auto* call = Call("frexp", 1_a);
WrapInFunction(Decl(Var("v", Call("frexp", 1_h))), // WrapInFunction(Decl(Var("v", Call("frexp", 1_h))), //
Assign("v", call)); Assign("v", call));
@ -1384,7 +1384,7 @@ TEST_F(MaterializeAbstractStructure, Frexp_Scalar_ExplicitType) {
TEST_F(MaterializeAbstractStructure, Frexp_Vector_ExplicitType) { TEST_F(MaterializeAbstractStructure, Frexp_Vector_ExplicitType) {
// var v = frexp(vec2(1_h)); // v is __frexp_result_vec2_f16 // var v = frexp(vec2(1_h)); // v is __frexp_result_vec2_f16
// v = frexp(vec2(1)); // __frexp_result_vec2_f16 <- __frexp_result_vec2_abstract // v = frexp(vec2(1)); // __frexp_result_vec2_f16 <- __frexp_result_vec2_abstract
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* call = Call("frexp", Call(ty.vec2<Infer>(), 1_a)); auto* call = Call("frexp", Call(ty.vec2<Infer>(), 1_a));
WrapInFunction(Decl(Var("v", Call("frexp", Call(ty.vec2<Infer>(), 1_h)))), Assign("v", call)); WrapInFunction(Decl(Var("v", Call("frexp", Call(ty.vec2<Infer>(), 1_h)))), Assign("v", call));
ASSERT_TRUE(r()->Resolve()) << r()->error(); ASSERT_TRUE(r()->Resolve()) << r()->error();

View File

@ -103,7 +103,7 @@ TEST_F(ResolverOverrideTest, IdTooLarge) {
} }
TEST_F(ResolverOverrideTest, F16_TemporallyBan) { TEST_F(ResolverOverrideTest, F16_TemporallyBan) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Override(Source{{12, 34}}, "a", ty.f16(), Expr(1_h), Id(1_u)); Override(Source{{12, 34}}, "a", ty.f16(), Expr(1_h), Id(1_u));

View File

@ -143,7 +143,7 @@ bool Resolver::Resolve() {
if (result) { if (result) {
// Run the uniformity analysis, which requires a complete semantic module. // Run the uniformity analysis, which requires a complete semantic module.
if (!enabled_extensions_.Contains(ast::Extension::kChromiumDisableUniformityAnalysis)) { if (!enabled_extensions_.Contains(builtin::Extension::kChromiumDisableUniformityAnalysis)) {
if (!AnalyzeUniformity(builder_, dependencies_)) { if (!AnalyzeUniformity(builder_, dependencies_)) {
return false; return false;
} }

View File

@ -501,7 +501,7 @@ class Resolver {
DependencyGraph dependencies_; DependencyGraph dependencies_;
SemHelper sem_; SemHelper sem_;
Validator validator_; Validator validator_;
ast::Extensions enabled_extensions_; builtin::Extensions enabled_extensions_;
utils::Vector<sem::Function*, 8> entry_points_; utils::Vector<sem::Function*, 8> entry_points_;
utils::Hashmap<const type::Type*, const Source*, 8> atomic_composite_info_; utils::Hashmap<const type::Type*, const Source*, 8> atomic_composite_info_;
utils::Bitset<0> marked_; utils::Bitset<0> marked_;

View File

@ -15,6 +15,7 @@
#include "src/tint/resolver/resolver.h" #include "src/tint/resolver/resolver.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "src/tint/builtin/extension.h"
#include "src/tint/resolver/resolver_test_helper.h" #include "src/tint/resolver/resolver_test_helper.h"
#include "src/tint/sem/index_accessor_expression.h" #include "src/tint/sem/index_accessor_expression.h"
#include "src/tint/sem/member_accessor_expression.h" #include "src/tint/sem/member_accessor_expression.h"
@ -160,7 +161,7 @@ static std::ostream& operator<<(std::ostream& o, const Case& c) {
using SideEffectsBuiltinTest = resolver::ResolverTestWithParam<Case>; using SideEffectsBuiltinTest = resolver::ResolverTestWithParam<Case>;
TEST_P(SideEffectsBuiltinTest, Test) { TEST_P(SideEffectsBuiltinTest, Test) {
Enable(ast::Extension::kChromiumExperimentalDp4A); Enable(tint::builtin::Extension::kChromiumExperimentalDp4A);
auto& c = GetParam(); auto& c = GetParam();
uint32_t next_binding = 0; uint32_t next_binding = 0;

View File

@ -55,7 +55,7 @@ TEST_F(ResolverStructLayoutTest, Scalars) {
} }
TEST_F(ResolverStructLayoutTest, ScalarsWithF16) { TEST_F(ResolverStructLayoutTest, ScalarsWithF16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* s = Structure("S", utils::Vector{ auto* s = Structure("S", utils::Vector{
Member("a", ty.f32()), Member("a", ty.f32()),
@ -134,7 +134,7 @@ TEST_F(ResolverStructLayoutTest, Alias) {
} }
TEST_F(ResolverStructLayoutTest, ImplicitStrideArrayStaticSize) { TEST_F(ResolverStructLayoutTest, ImplicitStrideArrayStaticSize) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* s = Structure("S", utils::Vector{ auto* s = Structure("S", utils::Vector{
Member("a", ty.array<i32, 3>()), Member("a", ty.array<i32, 3>()),
@ -174,7 +174,7 @@ TEST_F(ResolverStructLayoutTest, ImplicitStrideArrayStaticSize) {
} }
TEST_F(ResolverStructLayoutTest, ExplicitStrideArrayStaticSize) { TEST_F(ResolverStructLayoutTest, ExplicitStrideArrayStaticSize) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* s = Structure("S", utils::Vector{ auto* s = Structure("S", utils::Vector{
Member("a", ty.array<i32, 3>(utils::Vector{Stride(8)})), Member("a", ty.array<i32, 3>(utils::Vector{Stride(8)})),
@ -335,7 +335,7 @@ TEST_F(ResolverStructLayoutTest, Vector) {
} }
TEST_F(ResolverStructLayoutTest, Matrix) { TEST_F(ResolverStructLayoutTest, Matrix) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* s = Structure("S", utils::Vector{ auto* s = Structure("S", utils::Vector{
Member("a_1", ty.mat2x2<f32>()), Member("a_1", ty.mat2x2<f32>()),

View File

@ -85,7 +85,7 @@ TEST_P(InferTypeTest_FromInitializerExpression, All) {
// } // }
auto& params = GetParam(); auto& params = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* initializer_expr = params.create_rhs_ast_value(*this, 0); auto* initializer_expr = params.create_rhs_ast_value(*this, 0);
@ -186,7 +186,7 @@ TEST_P(InferTypeTest_FromCallExpression, All) {
// } // }
auto& params = GetParam(); auto& params = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Func("foo", utils::Empty, params.create_rhs_ast_type(*this), Func("foo", utils::Empty, params.create_rhs_ast_type(*this),
utils::Vector{Return(Call(params.create_rhs_ast_type(*this)))}, {}); utils::Vector{Return(Call(params.create_rhs_ast_type(*this)))}, {});
@ -343,7 +343,7 @@ using ConversionInitializerValidTest = ResolverTestWithParam<Params>;
TEST_P(ConversionInitializerValidTest, All) { TEST_P(ConversionInitializerValidTest, All) {
auto& params = GetParam(); auto& params = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
// var a : <lhs_type1> = <lhs_type2>(<rhs_type>(<rhs_value_expr>)); // var a : <lhs_type1> = <lhs_type2>(<rhs_type>(<rhs_value_expr>));
auto lhs_type1 = params.lhs_type(*this); auto lhs_type1 = params.lhs_type(*this);
@ -449,7 +449,7 @@ TEST_P(ConversionInitializerInvalidTest, All) {
<< FriendlyName(rhs_type) << "(<rhs value expr>))"; << FriendlyName(rhs_type) << "(<rhs value expr>))";
SCOPED_TRACE(ss.str()); SCOPED_TRACE(ss.str());
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* a = Var("a", lhs_type1, Call(lhs_type2, Call(rhs_type, rhs_value_expr))); auto* a = Var("a", lhs_type1, Call(lhs_type2, Call(rhs_type, rhs_value_expr)));
@ -944,7 +944,7 @@ TEST_F(ResolverTypeInitializerValidationTest, F32_Success) {
} }
TEST_F(ResolverTypeInitializerValidationTest, F16_Success) { TEST_F(ResolverTypeInitializerValidationTest, F16_Success) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* expr = Call<f16>(Expr(1.5_h)); auto* expr = Call<f16>(Expr(1.5_h));
WrapInFunction(expr); WrapInFunction(expr);
@ -1000,7 +1000,7 @@ TEST_F(ResolverTypeInitializerValidationTest, Convert_i32_to_u32_Success) {
} }
TEST_F(ResolverTypeInitializerValidationTest, Convert_u32_to_f16_Success) { TEST_F(ResolverTypeInitializerValidationTest, Convert_u32_to_f16_Success) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* expr = Call<f16>(123_u); auto* expr = Call<f16>(123_u);
WrapInFunction(expr); WrapInFunction(expr);
@ -1020,7 +1020,7 @@ TEST_F(ResolverTypeInitializerValidationTest, Convert_u32_to_f16_Success) {
} }
TEST_F(ResolverTypeInitializerValidationTest, Convert_f16_to_f32_Success) { TEST_F(ResolverTypeInitializerValidationTest, Convert_f16_to_f32_Success) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* expr = Call<f32>(123_h); auto* expr = Call<f32>(123_h);
WrapInFunction(expr); WrapInFunction(expr);
@ -1052,7 +1052,7 @@ TEST_F(ResolverTypeInitializerValidationTest, Vec2F32_Error_ScalarArgumentTypeMi
} }
TEST_F(ResolverTypeInitializerValidationTest, Vec2F16_Error_ScalarArgumentTypeMismatch) { TEST_F(ResolverTypeInitializerValidationTest, Vec2F16_Error_ScalarArgumentTypeMismatch) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(vec2<f16>(Source{{12, 34}}, 1_h, 2_f)); WrapInFunction(vec2<f16>(Source{{12, 34}}, 1_h, 2_f));
@ -1175,7 +1175,7 @@ TEST_F(ResolverTypeInitializerValidationTest, Vec2F32_Success_Scalar) {
} }
TEST_F(ResolverTypeInitializerValidationTest, Vec2F16_Success_Scalar) { TEST_F(ResolverTypeInitializerValidationTest, Vec2F16_Success_Scalar) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* tc = vec2<f16>(1_h, 1_h); auto* tc = vec2<f16>(1_h, 1_h);
WrapInFunction(tc); WrapInFunction(tc);
@ -1309,7 +1309,7 @@ TEST_F(ResolverTypeInitializerValidationTest, Vec3F32_Error_ScalarArgumentTypeMi
} }
TEST_F(ResolverTypeInitializerValidationTest, Vec3F16_Error_ScalarArgumentTypeMismatch) { TEST_F(ResolverTypeInitializerValidationTest, Vec3F16_Error_ScalarArgumentTypeMismatch) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(vec3<f16>(Source{{12, 34}}, 1_h, 2_h, 3_f)); WrapInFunction(vec3<f16>(Source{{12, 34}}, 1_h, 2_h, 3_f));
@ -1451,7 +1451,7 @@ TEST_F(ResolverTypeInitializerValidationTest, Vec3F32_Success_Scalar) {
} }
TEST_F(ResolverTypeInitializerValidationTest, Vec3F16_Success_Scalar) { TEST_F(ResolverTypeInitializerValidationTest, Vec3F16_Success_Scalar) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* tc = vec3<f16>(1_h, 1_h, 1_h); auto* tc = vec3<f16>(1_h, 1_h, 1_h);
WrapInFunction(tc); WrapInFunction(tc);
@ -1632,7 +1632,7 @@ TEST_F(ResolverTypeInitializerValidationTest, Vec4F32_Error_ScalarArgumentTypeMi
} }
TEST_F(ResolverTypeInitializerValidationTest, Vec4F16_Error_ScalarArgumentTypeMismatch) { TEST_F(ResolverTypeInitializerValidationTest, Vec4F16_Error_ScalarArgumentTypeMismatch) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(vec4<f16>(Source{{12, 34}}, 1_h, 1_h, 1_f, 1_h)); WrapInFunction(vec4<f16>(Source{{12, 34}}, 1_h, 1_h, 1_f, 1_h));
@ -1799,7 +1799,7 @@ TEST_F(ResolverTypeInitializerValidationTest, Vec4F32_Success_Scalar) {
} }
TEST_F(ResolverTypeInitializerValidationTest, Vec4F16_Success_Scalar) { TEST_F(ResolverTypeInitializerValidationTest, Vec4F16_Success_Scalar) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* tc = vec4<f16>(1_h, 1_h, 1_h, 1_h); auto* tc = vec4<f16>(1_h, 1_h, 1_h, 1_h);
WrapInFunction(tc); WrapInFunction(tc);
@ -2035,7 +2035,7 @@ TEST_F(ResolverTypeInitializerValidationTest, Vector_ArgumentElementTypeAlias_Su
} }
TEST_F(ResolverTypeInitializerValidationTest, InferVec2ElementTypeFromScalars) { TEST_F(ResolverTypeInitializerValidationTest, InferVec2ElementTypeFromScalars) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* vec2_bool = vec2<Infer>(true, false); auto* vec2_bool = vec2<Infer>(true, false);
auto* vec2_i32 = vec2<Infer>(1_i, 2_i); auto* vec2_i32 = vec2<Infer>(1_i, 2_i);
@ -2064,7 +2064,7 @@ TEST_F(ResolverTypeInitializerValidationTest, InferVec2ElementTypeFromScalars) {
} }
TEST_F(ResolverTypeInitializerValidationTest, InferVec2ElementTypeFromVec2) { TEST_F(ResolverTypeInitializerValidationTest, InferVec2ElementTypeFromVec2) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* vec2_bool = vec2<Infer>(vec2<bool>(true, false)); auto* vec2_bool = vec2<Infer>(vec2<bool>(true, false));
auto* vec2_i32 = vec2<Infer>(vec2<i32>(1_i, 2_i)); auto* vec2_i32 = vec2<Infer>(vec2<i32>(1_i, 2_i));
@ -2093,7 +2093,7 @@ TEST_F(ResolverTypeInitializerValidationTest, InferVec2ElementTypeFromVec2) {
} }
TEST_F(ResolverTypeInitializerValidationTest, InferVec3ElementTypeFromScalars) { TEST_F(ResolverTypeInitializerValidationTest, InferVec3ElementTypeFromScalars) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* vec3_bool = vec3<Infer>(Expr(true), Expr(false), Expr(true)); auto* vec3_bool = vec3<Infer>(Expr(true), Expr(false), Expr(true));
auto* vec3_i32 = vec3<Infer>(Expr(1_i), Expr(2_i), Expr(3_i)); auto* vec3_i32 = vec3<Infer>(Expr(1_i), Expr(2_i), Expr(3_i));
@ -2122,7 +2122,7 @@ TEST_F(ResolverTypeInitializerValidationTest, InferVec3ElementTypeFromScalars) {
} }
TEST_F(ResolverTypeInitializerValidationTest, InferVec3ElementTypeFromVec3) { TEST_F(ResolverTypeInitializerValidationTest, InferVec3ElementTypeFromVec3) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* vec3_bool = vec3<Infer>(vec3<bool>(true, false, true)); auto* vec3_bool = vec3<Infer>(vec3<bool>(true, false, true));
auto* vec3_i32 = vec3<Infer>(vec3<i32>(1_i, 2_i, 3_i)); auto* vec3_i32 = vec3<Infer>(vec3<i32>(1_i, 2_i, 3_i));
@ -2151,7 +2151,7 @@ TEST_F(ResolverTypeInitializerValidationTest, InferVec3ElementTypeFromVec3) {
} }
TEST_F(ResolverTypeInitializerValidationTest, InferVec3ElementTypeFromScalarAndVec2) { TEST_F(ResolverTypeInitializerValidationTest, InferVec3ElementTypeFromScalarAndVec2) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* vec3_bool = vec3<Infer>(Expr(true), vec2<bool>(false, true)); auto* vec3_bool = vec3<Infer>(Expr(true), vec2<bool>(false, true));
auto* vec3_i32 = vec3<Infer>(Expr(1_i), vec2<i32>(2_i, 3_i)); auto* vec3_i32 = vec3<Infer>(Expr(1_i), vec2<i32>(2_i, 3_i));
@ -2180,7 +2180,7 @@ TEST_F(ResolverTypeInitializerValidationTest, InferVec3ElementTypeFromScalarAndV
} }
TEST_F(ResolverTypeInitializerValidationTest, InferVec4ElementTypeFromScalars) { TEST_F(ResolverTypeInitializerValidationTest, InferVec4ElementTypeFromScalars) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* vec4_bool = vec4<Infer>(Expr(true), Expr(false), Expr(true), Expr(false)); auto* vec4_bool = vec4<Infer>(Expr(true), Expr(false), Expr(true), Expr(false));
auto* vec4_i32 = vec4<Infer>(Expr(1_i), Expr(2_i), Expr(3_i), Expr(4_i)); auto* vec4_i32 = vec4<Infer>(Expr(1_i), Expr(2_i), Expr(3_i), Expr(4_i));
@ -2209,7 +2209,7 @@ TEST_F(ResolverTypeInitializerValidationTest, InferVec4ElementTypeFromScalars) {
} }
TEST_F(ResolverTypeInitializerValidationTest, InferVec4ElementTypeFromVec4) { TEST_F(ResolverTypeInitializerValidationTest, InferVec4ElementTypeFromVec4) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* vec4_bool = vec4<Infer>(vec4<bool>(true, false, true, false)); auto* vec4_bool = vec4<Infer>(vec4<bool>(true, false, true, false));
auto* vec4_i32 = vec4<Infer>(vec4<i32>(1_i, 2_i, 3_i, 4_i)); auto* vec4_i32 = vec4<Infer>(vec4<i32>(1_i, 2_i, 3_i, 4_i));
@ -2238,7 +2238,7 @@ TEST_F(ResolverTypeInitializerValidationTest, InferVec4ElementTypeFromVec4) {
} }
TEST_F(ResolverTypeInitializerValidationTest, InferVec4ElementTypeFromScalarAndVec3) { TEST_F(ResolverTypeInitializerValidationTest, InferVec4ElementTypeFromScalarAndVec3) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* vec4_bool = vec4<Infer>(Expr(true), vec3<bool>(false, true, false)); auto* vec4_bool = vec4<Infer>(Expr(true), vec3<bool>(false, true, false));
auto* vec4_i32 = vec4<Infer>(Expr(1_i), vec3<i32>(2_i, 3_i, 4_i)); auto* vec4_i32 = vec4<Infer>(Expr(1_i), vec3<i32>(2_i, 3_i, 4_i));
@ -2267,7 +2267,7 @@ TEST_F(ResolverTypeInitializerValidationTest, InferVec4ElementTypeFromScalarAndV
} }
TEST_F(ResolverTypeInitializerValidationTest, InferVec4ElementTypeFromVec2AndVec2) { TEST_F(ResolverTypeInitializerValidationTest, InferVec4ElementTypeFromVec2AndVec2) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* vec4_bool = vec4<Infer>(vec2<bool>(true, false), vec2<bool>(true, false)); auto* vec4_bool = vec4<Infer>(vec2<bool>(true, false), vec2<bool>(true, false));
auto* vec4_i32 = vec4<Infer>(vec2<i32>(1_i, 2_i), vec2<i32>(3_i, 4_i)); auto* vec4_i32 = vec4<Infer>(vec2<i32>(1_i, 2_i), vec2<i32>(3_i, 4_i));
@ -2406,7 +2406,7 @@ TEST_P(MatrixInitializerTest, ColumnInitializer_Error_TooFewArguments) {
const auto param = GetParam(); const auto param = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
const std::string element_type_name = param.get_element_type_name(); const std::string element_type_name = param.get_element_type_name();
std::stringstream args_tys; std::stringstream args_tys;
@ -2435,7 +2435,7 @@ TEST_P(MatrixInitializerTest, ElementInitializer_Error_TooFewArguments) {
const auto param = GetParam(); const auto param = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
const std::string element_type_name = param.get_element_type_name(); const std::string element_type_name = param.get_element_type_name();
std::stringstream args_tys; std::stringstream args_tys;
@ -2463,7 +2463,7 @@ TEST_P(MatrixInitializerTest, ColumnInitializer_Error_TooManyArguments) {
const auto param = GetParam(); const auto param = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
const std::string element_type_name = param.get_element_type_name(); const std::string element_type_name = param.get_element_type_name();
std::stringstream args_tys; std::stringstream args_tys;
@ -2492,7 +2492,7 @@ TEST_P(MatrixInitializerTest, ElementInitializer_Error_TooManyArguments) {
const auto param = GetParam(); const auto param = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
const std::string element_type_name = param.get_element_type_name(); const std::string element_type_name = param.get_element_type_name();
std::stringstream args_tys; std::stringstream args_tys;
@ -2520,7 +2520,7 @@ TEST_P(MatrixInitializerTest, ColumnInitializer_Error_InvalidArgumentType) {
const auto param = GetParam(); const auto param = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
std::stringstream args_tys; std::stringstream args_tys;
utils::Vector<const ast::Expression*, 8> args; utils::Vector<const ast::Expression*, 8> args;
@ -2548,7 +2548,7 @@ TEST_P(MatrixInitializerTest, ElementInitializer_Error_InvalidArgumentType) {
const auto param = GetParam(); const auto param = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
std::stringstream args_tys; std::stringstream args_tys;
utils::Vector<const ast::Expression*, 8> args; utils::Vector<const ast::Expression*, 8> args;
@ -2580,7 +2580,7 @@ TEST_P(MatrixInitializerTest, ColumnInitializer_Error_TooFewRowsInVectorArgument
return; return;
} }
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
const std::string element_type_name = param.get_element_type_name(); const std::string element_type_name = param.get_element_type_name();
std::stringstream args_tys; std::stringstream args_tys;
@ -2618,7 +2618,7 @@ TEST_P(MatrixInitializerTest, ColumnInitializer_Error_TooManyRowsInVectorArgumen
return; return;
} }
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
const std::string element_type_name = param.get_element_type_name(); const std::string element_type_name = param.get_element_type_name();
std::stringstream args_tys; std::stringstream args_tys;
@ -2650,7 +2650,7 @@ TEST_P(MatrixInitializerTest, ZeroValue_Success) {
const auto param = GetParam(); const auto param = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
ast::Type matrix_type = param.create_mat_ast_type(*this); ast::Type matrix_type = param.create_mat_ast_type(*this);
auto* tc = Call(Source{{12, 40}}, matrix_type); auto* tc = Call(Source{{12, 40}}, matrix_type);
@ -2665,7 +2665,7 @@ TEST_P(MatrixInitializerTest, WithColumns_Success) {
const auto param = GetParam(); const auto param = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
utils::Vector<const ast::Expression*, 4> args; utils::Vector<const ast::Expression*, 4> args;
for (uint32_t i = 0; i < param.columns; i++) { for (uint32_t i = 0; i < param.columns; i++) {
@ -2686,7 +2686,7 @@ TEST_P(MatrixInitializerTest, WithElements_Success) {
const auto param = GetParam(); const auto param = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
utils::Vector<const ast::Expression*, 16> args; utils::Vector<const ast::Expression*, 16> args;
for (uint32_t i = 0; i < param.columns * param.rows; i++) { for (uint32_t i = 0; i < param.columns * param.rows; i++) {
@ -2706,7 +2706,7 @@ TEST_P(MatrixInitializerTest, ElementTypeAlias_Error) {
const auto param = GetParam(); const auto param = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* elem_type_alias = Alias("ElemType", param.create_element_ast_type(*this)); auto* elem_type_alias = Alias("ElemType", param.create_element_ast_type(*this));
@ -2736,7 +2736,7 @@ TEST_P(MatrixInitializerTest, ElementTypeAlias_Success) {
const auto param = GetParam(); const auto param = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* elem_type_alias = Alias("ElemType", param.create_element_ast_type(*this)); auto* elem_type_alias = Alias("ElemType", param.create_element_ast_type(*this));
@ -2767,7 +2767,7 @@ TEST_F(ResolverTypeInitializerValidationTest, MatrixInitializer_ArgumentTypeAlia
TEST_P(MatrixInitializerTest, ArgumentTypeAlias_Success) { TEST_P(MatrixInitializerTest, ArgumentTypeAlias_Success) {
const auto param = GetParam(); const auto param = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
ast::Type matrix_type = param.create_mat_ast_type(*this); ast::Type matrix_type = param.create_mat_ast_type(*this);
ast::Type vec_type = param.create_column_ast_type(*this); ast::Type vec_type = param.create_column_ast_type(*this);
@ -2787,7 +2787,7 @@ TEST_P(MatrixInitializerTest, ArgumentTypeAlias_Success) {
TEST_P(MatrixInitializerTest, ArgumentElementTypeAlias_Error) { TEST_P(MatrixInitializerTest, ArgumentElementTypeAlias_Error) {
const auto param = GetParam(); const auto param = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
ast::Type matrix_type = param.create_mat_ast_type(*this); ast::Type matrix_type = param.create_mat_ast_type(*this);
auto* u32_type_alias = Alias("UnsignedInt", ty.u32()); auto* u32_type_alias = Alias("UnsignedInt", ty.u32());
@ -2814,7 +2814,7 @@ TEST_P(MatrixInitializerTest, ArgumentElementTypeAlias_Error) {
TEST_P(MatrixInitializerTest, ArgumentElementTypeAlias_Success) { TEST_P(MatrixInitializerTest, ArgumentElementTypeAlias_Success) {
const auto param = GetParam(); const auto param = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* elem_type_alias = Alias("ElemType", param.create_element_ast_type(*this)); auto* elem_type_alias = Alias("ElemType", param.create_element_ast_type(*this));
@ -2834,7 +2834,7 @@ TEST_P(MatrixInitializerTest, ArgumentElementTypeAlias_Success) {
TEST_P(MatrixInitializerTest, InferElementTypeFromVectors) { TEST_P(MatrixInitializerTest, InferElementTypeFromVectors) {
const auto param = GetParam(); const auto param = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
utils::Vector<const ast::Expression*, 8> args; utils::Vector<const ast::Expression*, 8> args;
for (uint32_t i = 0; i < param.columns; i++) { for (uint32_t i = 0; i < param.columns; i++) {
@ -2851,7 +2851,7 @@ TEST_P(MatrixInitializerTest, InferElementTypeFromVectors) {
TEST_P(MatrixInitializerTest, InferElementTypeFromScalars) { TEST_P(MatrixInitializerTest, InferElementTypeFromScalars) {
const auto param = GetParam(); const auto param = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
utils::Vector<const ast::Expression*, 8> args; utils::Vector<const ast::Expression*, 8> args;
for (uint32_t i = 0; i < param.rows * param.columns; i++) { for (uint32_t i = 0; i < param.rows * param.columns; i++) {
@ -2867,7 +2867,7 @@ TEST_P(MatrixInitializerTest, InferElementTypeFromScalars) {
TEST_P(MatrixInitializerTest, CannotInferElementTypeFromVectors_Mismatch) { TEST_P(MatrixInitializerTest, CannotInferElementTypeFromVectors_Mismatch) {
const auto param = GetParam(); const auto param = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
std::stringstream err; std::stringstream err;
err << "12:34 error: no matching initializer for mat" << param.columns << "x" << param.rows err << "12:34 error: no matching initializer for mat" << param.columns << "x" << param.rows
@ -2898,7 +2898,7 @@ TEST_P(MatrixInitializerTest, CannotInferElementTypeFromVectors_Mismatch) {
TEST_P(MatrixInitializerTest, CannotInferElementTypeFromScalars_Mismatch) { TEST_P(MatrixInitializerTest, CannotInferElementTypeFromScalars_Mismatch) {
const auto param = GetParam(); const auto param = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
std::stringstream err; std::stringstream err;
err << "12:34 error: no matching initializer for mat" << param.columns << "x" << param.rows err << "12:34 error: no matching initializer for mat" << param.columns << "x" << param.rows
@ -2988,7 +2988,7 @@ TEST_P(StructInitializerInputsTest, TooFew) {
auto& str_params = std::get<0>(param); auto& str_params = std::get<0>(param);
uint32_t N = std::get<1>(param); uint32_t N = std::get<1>(param);
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
utils::Vector<const ast::StructMember*, 16> members; utils::Vector<const ast::StructMember*, 16> members;
utils::Vector<const ast::Expression*, 16> values; utils::Vector<const ast::Expression*, 16> values;
@ -3013,7 +3013,7 @@ TEST_P(StructInitializerInputsTest, TooMany) {
auto& str_params = std::get<0>(param); auto& str_params = std::get<0>(param);
uint32_t N = std::get<1>(param); uint32_t N = std::get<1>(param);
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
utils::Vector<const ast::StructMember*, 16> members; utils::Vector<const ast::StructMember*, 16> members;
utils::Vector<const ast::Expression*, 8> values; utils::Vector<const ast::Expression*, 8> values;
@ -3046,7 +3046,7 @@ TEST_P(StructInitializerTypeTest, AllTypes) {
auto& ctor_params = std::get<1>(param); auto& ctor_params = std::get<1>(param);
uint32_t N = std::get<2>(param); uint32_t N = std::get<2>(param);
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
if (str_params.ast == ctor_params.ast) { if (str_params.ast == ctor_params.ast) {
return; return;

View File

@ -1005,7 +1005,7 @@ static constexpr TypeParams type_cases[] = {
using SampledTextureTypeTest = ResolverTestWithParam<TypeParams>; using SampledTextureTypeTest = ResolverTestWithParam<TypeParams>;
TEST_P(SampledTextureTypeTest, All) { TEST_P(SampledTextureTypeTest, All) {
auto& params = GetParam(); auto& params = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar( GlobalVar(
"a", "a",
ty.sampled_texture(Source{{12, 34}}, type::TextureDimension::k2d, params.type_func(*this)), ty.sampled_texture(Source{{12, 34}}, type::TextureDimension::k2d, params.type_func(*this)),
@ -1025,7 +1025,7 @@ INSTANTIATE_TEST_SUITE_P(ResolverTypeValidationTest,
using MultisampledTextureTypeTest = ResolverTestWithParam<TypeParams>; using MultisampledTextureTypeTest = ResolverTestWithParam<TypeParams>;
TEST_P(MultisampledTextureTypeTest, All) { TEST_P(MultisampledTextureTypeTest, All) {
auto& params = GetParam(); auto& params = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("a", GlobalVar("a",
ty.multisampled_texture(Source{{12, 34}}, type::TextureDimension::k2d, ty.multisampled_texture(Source{{12, 34}}, type::TextureDimension::k2d,
params.type_func(*this)), params.type_func(*this)),
@ -1231,7 +1231,7 @@ TEST_P(ValidMatrixTypes, Okay) {
// var a : matNxM<EL_TY>; // var a : matNxM<EL_TY>;
auto& params = GetParam(); auto& params = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
ast::Type el_ty = params.elem_ty(*this); ast::Type el_ty = params.elem_ty(*this);
@ -1271,7 +1271,7 @@ TEST_P(InvalidMatrixElementTypes, InvalidElementType) {
// var a : matNxM<EL_TY>; // var a : matNxM<EL_TY>;
auto& params = GetParam(); auto& params = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
ast::Type el_ty = params.elem_ty(*this); ast::Type el_ty = params.elem_ty(*this);
@ -1316,7 +1316,7 @@ TEST_P(ValidVectorTypes, Okay) {
// var a : vecN<EL_TY>; // var a : vecN<EL_TY>;
auto& params = GetParam(); auto& params = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("a", ty.vec(params.elem_ty(*this), params.width), type::AddressSpace::kPrivate); GlobalVar("a", ty.vec(params.elem_ty(*this), params.width), type::AddressSpace::kPrivate);
EXPECT_TRUE(r()->Resolve()) << r()->error(); EXPECT_TRUE(r()->Resolve()) << r()->error();
@ -1350,7 +1350,7 @@ TEST_P(InvalidVectorElementTypes, InvalidElementType) {
// var a : vecN<EL_TY>; // var a : vecN<EL_TY>;
auto& params = GetParam(); auto& params = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("a", ty.vec(Source{{12, 34}}, params.elem_ty(*this), params.width), GlobalVar("a", ty.vec(Source{{12, 34}}, params.elem_ty(*this), params.width),
type::AddressSpace::kPrivate); type::AddressSpace::kPrivate);
@ -1389,7 +1389,7 @@ TEST_P(BuiltinTypeAliasTest, CheckEquivalent) {
// explicit = aliased; // explicit = aliased;
auto& params = GetParam(); auto& params = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Decl(Var("aliased", ty(params.alias))), WrapInFunction(Decl(Var("aliased", ty(params.alias))),
Decl(Var("explicit", params.type(*this))), // Decl(Var("explicit", params.type(*this))), //
@ -1401,7 +1401,7 @@ TEST_P(BuiltinTypeAliasTest, Construct) {
// var v : vecN<T> = vecTN(); // var v : vecN<T> = vecTN();
auto& params = GetParam(); auto& params = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Decl(Var("v", params.type(*this), Call(params.alias)))); WrapInFunction(Decl(Var("v", params.type(*this), Call(params.alias))));
EXPECT_TRUE(r()->Resolve()) << r()->error(); EXPECT_TRUE(r()->Resolve()) << r()->error();
@ -1449,7 +1449,7 @@ TEST_P(ResolverUntemplatedTypeUsedWithTemplateArgs, Builtin_UseWithTemplateArgs)
// enable f16; // enable f16;
// var<private> v : f32<true>; // var<private> v : f32<true>;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("v", type::AddressSpace::kPrivate, ty(Source{{12, 34}}, GetParam(), true)); GlobalVar("v", type::AddressSpace::kPrivate, ty(Source{{12, 34}}, GetParam(), true));
EXPECT_FALSE(r()->Resolve()); EXPECT_FALSE(r()->Resolve());
@ -1462,7 +1462,7 @@ TEST_P(ResolverUntemplatedTypeUsedWithTemplateArgs, BuiltinAlias_UseWithTemplate
// alias A = f32; // alias A = f32;
// var<private> v : A<true>; // var<private> v : A<true>;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Alias(Source{{56, 78}}, "A", ty(GetParam())); Alias(Source{{56, 78}}, "A", ty(GetParam()));
GlobalVar("v", type::AddressSpace::kPrivate, ty(Source{{12, 34}}, "A", true)); GlobalVar("v", type::AddressSpace::kPrivate, ty(Source{{12, 34}}, "A", true));

View File

@ -149,7 +149,7 @@ void TraverseCallChain(diag::List& diagnostics,
Validator::Validator( Validator::Validator(
ProgramBuilder* builder, ProgramBuilder* builder,
SemHelper& sem, SemHelper& sem,
const ast::Extensions& enabled_extensions, const builtin::Extensions& enabled_extensions,
const utils::Hashmap<const type::Type*, const Source*, 8>& atomic_composite_info, const utils::Hashmap<const type::Type*, const Source*, 8>& atomic_composite_info,
utils::Hashset<TypeAndAddressSpace, 8>& valid_type_storage_layouts) utils::Hashset<TypeAndAddressSpace, 8>& valid_type_storage_layouts)
: symbols_(builder->Symbols()), : symbols_(builder->Symbols()),
@ -829,7 +829,7 @@ bool Validator::Parameter(const ast::Function* func, const sem::Variable* var) c
case type::AddressSpace::kUniform: case type::AddressSpace::kUniform:
case type::AddressSpace::kWorkgroup: case type::AddressSpace::kWorkgroup:
ok = enabled_extensions_.Contains( ok = enabled_extensions_.Contains(
ast::Extension::kChromiumExperimentalFullPtrParameters); builtin::Extension::kChromiumExperimentalFullPtrParameters);
break; break;
default: default:
break; break;
@ -1653,7 +1653,7 @@ bool Validator::RequiredExtensionForBuiltinFunction(const sem::Call* call) const
} }
const auto extension = builtin->RequiredExtension(); const auto extension = builtin->RequiredExtension();
if (extension == ast::Extension::kUndefined) { if (extension == builtin::Extension::kUndefined) {
return true; return true;
} }
@ -1669,7 +1669,7 @@ bool Validator::RequiredExtensionForBuiltinFunction(const sem::Call* call) const
bool Validator::CheckF16Enabled(const Source& source) const { bool Validator::CheckF16Enabled(const Source& source) const {
// Validate if f16 type is allowed. // Validate if f16 type is allowed.
if (!enabled_extensions_.Contains(ast::Extension::kF16)) { if (!enabled_extensions_.Contains(builtin::Extension::kF16)) {
AddError("f16 type used without 'f16' extension enabled", source); AddError("f16 type used without 'f16' extension enabled", source);
return false; return false;
} }
@ -1719,7 +1719,8 @@ bool Validator::FunctionCall(const sem::Call* call, sem::Statement* current_stat
} }
if (param_type->Is<type::Pointer>() && if (param_type->Is<type::Pointer>() &&
!enabled_extensions_.Contains(ast::Extension::kChromiumExperimentalFullPtrParameters)) { !enabled_extensions_.Contains(
builtin::Extension::kChromiumExperimentalFullPtrParameters)) {
// https://gpuweb.github.io/gpuweb/wgsl/#function-restriction // https://gpuweb.github.io/gpuweb/wgsl/#function-restriction
// Each argument of pointer type to a user-defined function must have the same memory // Each argument of pointer type to a user-defined function must have the same memory
// view as its root identifier. // view as its root identifier.
@ -2512,7 +2513,7 @@ bool Validator::CheckTypeAccessAddressSpace(
} }
if (address_space == type::AddressSpace::kPushConstant && if (address_space == type::AddressSpace::kPushConstant &&
!enabled_extensions_.Contains(ast::Extension::kChromiumExperimentalPushConstant) && !enabled_extensions_.Contains(builtin::Extension::kChromiumExperimentalPushConstant) &&
IsValidationEnabled(attributes, ast::DisabledValidation::kIgnoreAddressSpace)) { IsValidationEnabled(attributes, ast::DisabledValidation::kIgnoreAddressSpace)) {
AddError( AddError(
"use of variable address space 'push_constant' requires enabling extension " "use of variable address space 'push_constant' requires enabling extension "

View File

@ -102,7 +102,7 @@ class Validator {
/// @param valid_type_storage_layouts a set of validated type layouts by address space /// @param valid_type_storage_layouts a set of validated type layouts by address space
Validator(ProgramBuilder* builder, Validator(ProgramBuilder* builder,
SemHelper& helper, SemHelper& helper,
const ast::Extensions& enabled_extensions, const builtin::Extensions& enabled_extensions,
const utils::Hashmap<const type::Type*, const Source*, 8>& atomic_composite_info, const utils::Hashmap<const type::Type*, const Source*, 8>& atomic_composite_info,
utils::Hashset<TypeAndAddressSpace, 8>& valid_type_storage_layouts); utils::Hashset<TypeAndAddressSpace, 8>& valid_type_storage_layouts);
~Validator(); ~Validator();
@ -550,7 +550,7 @@ class Validator {
diag::List& diagnostics_; diag::List& diagnostics_;
SemHelper& sem_; SemHelper& sem_;
DiagnosticFilterStack diagnostic_filters_; DiagnosticFilterStack diagnostic_filters_;
const ast::Extensions& enabled_extensions_; const builtin::Extensions& enabled_extensions_;
const utils::Hashmap<const type::Type*, const Source*, 8>& atomic_composite_info_; const utils::Hashmap<const type::Type*, const Source*, 8>& atomic_composite_info_;
utils::Hashset<TypeAndAddressSpace, 8>& valid_type_storage_layouts_; utils::Hashset<TypeAndAddressSpace, 8>& valid_type_storage_layouts_;
}; };

View File

@ -41,7 +41,7 @@ TEST_F(ResolverVariableTest, LocalVar_NoInitializer) {
// var a : A; // var a : A;
// } // }
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* S = Structure("S", utils::Vector{Member("i", ty.i32())}); auto* S = Structure("S", utils::Vector{Member("i", ty.i32())});
auto* A = Alias("A", ty.Of(S)); auto* A = Alias("A", ty.Of(S));
@ -106,7 +106,7 @@ TEST_F(ResolverVariableTest, LocalVar_WithInitializer) {
// var a : A = A(1); // var a : A = A(1);
// } // }
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* S = Structure("S", utils::Vector{Member("i", ty.i32())}); auto* S = Structure("S", utils::Vector{Member("i", ty.i32())});
auto* A = Alias("A", ty.Of(S)); auto* A = Alias("A", ty.Of(S));
@ -399,7 +399,7 @@ TEST_F(ResolverVariableTest, LocalLet) {
// let p : pointer<function, i32> = &v; // let p : pointer<function, i32> = &v;
// } // }
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* S = Structure("S", utils::Vector{Member("i", ty.i32())}); auto* S = Structure("S", utils::Vector{Member("i", ty.i32())});
auto* A = Alias("A", ty.Of(S)); auto* A = Alias("A", ty.Of(S));

View File

@ -488,7 +488,7 @@ TEST_F(ResolverVariableValidationTest, ConstInitWithOverrideExpr) {
TEST_F(ResolverVariableValidationTest, GlobalVariable_PushConstantWithInitializer) { TEST_F(ResolverVariableValidationTest, GlobalVariable_PushConstantWithInitializer) {
// enable chromium_experimental_push_constant; // enable chromium_experimental_push_constant;
// var<push_constant> a : u32 = 0u; // var<push_constant> a : u32 = 0u;
Enable(ast::Extension::kChromiumExperimentalPushConstant); Enable(builtin::Extension::kChromiumExperimentalPushConstant);
GlobalVar(Source{{1u, 2u}}, "a", ty.u32(), type::AddressSpace::kPushConstant, GlobalVar(Source{{1u, 2u}}, "a", ty.u32(), type::AddressSpace::kPushConstant,
Expr(Source{{3u, 4u}}, u32(0))); Expr(Source{{3u, 4u}}, u32(0)));

View File

@ -179,11 +179,11 @@ bool Builtin::HasSideEffects() const {
return false; return false;
} }
ast::Extension Builtin::RequiredExtension() const { builtin::Extension Builtin::RequiredExtension() const {
if (IsDP4a()) { if (IsDP4a()) {
return ast::Extension::kChromiumExperimentalDp4A; return builtin::Extension::kChromiumExperimentalDp4A;
} }
return ast::Extension::kUndefined; return builtin::Extension::kUndefined;
} }
} // namespace tint::sem } // namespace tint::sem

View File

@ -18,7 +18,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "src/tint/ast/extension.h" #include "src/tint/builtin/extension.h"
#include "src/tint/sem/builtin_type.h" #include "src/tint/sem/builtin_type.h"
#include "src/tint/sem/call_target.h" #include "src/tint/sem/call_target.h"
#include "src/tint/sem/pipeline_stage_set.h" #include "src/tint/sem/pipeline_stage_set.h"
@ -147,8 +147,8 @@ class Builtin final : public Castable<Builtin, CallTarget> {
bool HasSideEffects() const; bool HasSideEffects() const;
/// @returns the required extension of this builtin function. Returns /// @returns the required extension of this builtin function. Returns
/// ast::Extension::kNone if no extension is required. /// builtin::Extension::kNone if no extension is required.
ast::Extension RequiredExtension() const; builtin::Extension RequiredExtension() const;
private: private:
const BuiltinType type_; const BuiltinType type_;

View File

@ -21,7 +21,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Module);
namespace tint::sem { namespace tint::sem {
Module::Module(utils::VectorRef<const ast::Node*> dep_ordered_decls, ast::Extensions extensions) Module::Module(utils::VectorRef<const ast::Node*> dep_ordered_decls, builtin::Extensions extensions)
: dep_ordered_decls_(std::move(dep_ordered_decls)), extensions_(std::move(extensions)) {} : dep_ordered_decls_(std::move(dep_ordered_decls)), extensions_(std::move(extensions)) {}
Module::~Module() = default; Module::~Module() = default;

View File

@ -16,7 +16,7 @@
#define SRC_TINT_SEM_MODULE_H_ #define SRC_TINT_SEM_MODULE_H_
#include "src/tint/ast/diagnostic_control.h" #include "src/tint/ast/diagnostic_control.h"
#include "src/tint/ast/extension.h" #include "src/tint/builtin/extension.h"
#include "src/tint/sem/node.h" #include "src/tint/sem/node.h"
#include "src/tint/utils/vector.h" #include "src/tint/utils/vector.h"
@ -34,7 +34,7 @@ class Module final : public Castable<Module, Node> {
/// Constructor /// Constructor
/// @param dep_ordered_decls the dependency-ordered module-scope declarations /// @param dep_ordered_decls the dependency-ordered module-scope declarations
/// @param extensions the list of enabled extensions in the module /// @param extensions the list of enabled extensions in the module
Module(utils::VectorRef<const ast::Node*> dep_ordered_decls, ast::Extensions extensions); Module(utils::VectorRef<const ast::Node*> dep_ordered_decls, builtin::Extensions extensions);
/// Destructor /// Destructor
~Module() override; ~Module() override;
@ -45,7 +45,7 @@ class Module final : public Castable<Module, Node> {
} }
/// @returns the list of enabled extensions in the module /// @returns the list of enabled extensions in the module
const ast::Extensions& Extensions() const { return extensions_; } const builtin::Extensions& Extensions() const { return extensions_; }
/// Modifies the severity of a specific diagnostic rule for this module. /// Modifies the severity of a specific diagnostic rule for this module.
/// @param rule the diagnostic rule /// @param rule the diagnostic rule
@ -61,7 +61,7 @@ class Module final : public Castable<Module, Node> {
private: private:
const utils::Vector<const ast::Node*, 64> dep_ordered_decls_; const utils::Vector<const ast::Node*, 64> dep_ordered_decls_;
ast::Extensions extensions_; builtin::Extensions extensions_;
ast::DiagnosticRuleSeverities diagnostic_severities_; ast::DiagnosticRuleSeverities diagnostic_severities_;
}; };

View File

@ -45,7 +45,7 @@ struct BuiltinPolyfill::State {
State(CloneContext& c, Builtins p) : ctx(c), polyfill(p) { State(CloneContext& c, Builtins p) : ctx(c), polyfill(p) {
has_full_ptr_params = false; has_full_ptr_params = false;
for (auto* enable : c.src->AST().Enables()) { for (auto* enable : c.src->AST().Enables()) {
if (enable->extension == ast::Extension::kChromiumExperimentalFullPtrParameters) { if (enable->extension == builtin::Extension::kChromiumExperimentalFullPtrParameters) {
has_full_ptr_params = true; has_full_ptr_params = true;
} }
} }
@ -673,7 +673,7 @@ struct BuiltinPolyfill::State {
/// @return the polyfill function name /// @return the polyfill function name
Symbol workgroupUniformLoad(const type::Type* type) { Symbol workgroupUniformLoad(const type::Type* type) {
if (!has_full_ptr_params) { if (!has_full_ptr_params) {
b.Enable(ast::Extension::kChromiumExperimentalFullPtrParameters); b.Enable(builtin::Extension::kChromiumExperimentalFullPtrParameters);
has_full_ptr_params = true; has_full_ptr_params = true;
} }
auto name = b.Symbols().New("tint_workgroupUniformLoad"); auto name = b.Symbols().New("tint_workgroupUniformLoad");

View File

@ -117,7 +117,7 @@ Transform::ApplyResult ClampFragDepth::Apply(const Program* src, const DataMap&,
// fn clamp_frag_depth(v : f32) -> f32 { // fn clamp_frag_depth(v : f32) -> f32 {
// return clamp(v, frag_depth_clamp_args.min, frag_depth_clamp_args.max); // return clamp(v, frag_depth_clamp_args.min, frag_depth_clamp_args.max);
// } // }
b.Enable(ast::Extension::kChromiumExperimentalPushConstant); b.Enable(builtin::Extension::kChromiumExperimentalPushConstant);
b.Structure(b.Symbols().New("FragDepthClampArgs"), b.Structure(b.Symbols().New("FragDepthClampArgs"),
utils::Vector{b.Member("min", b.ty.f32()), b.Member("max", b.ty.f32())}); utils::Vector{b.Member("min", b.ty.f32()), b.Member("max", b.ty.f32())});

View File

@ -203,7 +203,7 @@ struct DirectVariableAccess::State {
/// @returns the ApplyResult /// @returns the ApplyResult
ApplyResult Run() { ApplyResult Run() {
if (!ctx.src->Sem().Module()->Extensions().Contains( if (!ctx.src->Sem().Module()->Extensions().Contains(
ast::Extension::kChromiumExperimentalFullPtrParameters)) { builtin::Extension::kChromiumExperimentalFullPtrParameters)) {
// If the 'chromium_experimental_full_ptr_parameters' extension is not enabled, then // If the 'chromium_experimental_full_ptr_parameters' extension is not enabled, then
// there's nothing for this transform to do. // there's nothing for this transform to do.
return SkipTransform; return SkipTransform;

View File

@ -31,13 +31,13 @@ Transform::ApplyResult DisableUniformityAnalysis::Apply(const Program* src,
const DataMap&, const DataMap&,
DataMap&) const { DataMap&) const {
if (src->Sem().Module()->Extensions().Contains( if (src->Sem().Module()->Extensions().Contains(
ast::Extension::kChromiumDisableUniformityAnalysis)) { builtin::Extension::kChromiumDisableUniformityAnalysis)) {
return SkipTransform; return SkipTransform;
} }
ProgramBuilder b; ProgramBuilder b;
CloneContext ctx{&b, src, /* auto_clone_symbols */ true}; CloneContext ctx{&b, src, /* auto_clone_symbols */ true};
b.Enable(ast::Extension::kChromiumDisableUniformityAnalysis); b.Enable(builtin::Extension::kChromiumDisableUniformityAnalysis);
ctx.Clone(); ctx.Clone();
return Program(std::move(b)); return Program(std::move(b));

View File

@ -66,7 +66,7 @@ struct PreservePadding::State {
[&](const ast::Enable* enable) { [&](const ast::Enable* enable) {
// Check if the full pointer parameters extension is already enabled. // Check if the full pointer parameters extension is already enabled.
if (enable->extension == if (enable->extension ==
ast::Extension::kChromiumExperimentalFullPtrParameters) { builtin::Extension::kChromiumExperimentalFullPtrParameters) {
ext_enabled = true; ext_enabled = true;
} }
}); });
@ -197,7 +197,7 @@ struct PreservePadding::State {
/// Enable the full pointer parameters extension, if we have not already done so. /// Enable the full pointer parameters extension, if we have not already done so.
void EnableExtension() { void EnableExtension() {
if (!ext_enabled) { if (!ext_enabled) {
b.Enable(ast::Extension::kChromiumExperimentalFullPtrParameters); b.Enable(builtin::Extension::kChromiumExperimentalFullPtrParameters);
ext_enabled = true; ext_enabled = true;
} }
} }

View File

@ -26,8 +26,8 @@ namespace tint::writer {
bool CheckSupportedExtensions(std::string_view writer_name, bool CheckSupportedExtensions(std::string_view writer_name,
const ast::Module& module, const ast::Module& module,
diag::List& diags, diag::List& diags,
utils::VectorRef<ast::Extension> supported) { utils::VectorRef<builtin::Extension> supported) {
utils::Hashset<ast::Extension, 32> set; utils::Hashset<builtin::Extension, 32> set;
for (auto ext : supported) { for (auto ext : supported) {
set.Add(ext); set.Add(ext);
} }

View File

@ -15,7 +15,7 @@
#ifndef SRC_TINT_WRITER_CHECK_SUPPORTED_EXTENSIONS_H_ #ifndef SRC_TINT_WRITER_CHECK_SUPPORTED_EXTENSIONS_H_
#define SRC_TINT_WRITER_CHECK_SUPPORTED_EXTENSIONS_H_ #define SRC_TINT_WRITER_CHECK_SUPPORTED_EXTENSIONS_H_
#include "src/tint/ast/extension.h" #include "src/tint/builtin/extension.h"
#include "src/tint/utils/vector.h" #include "src/tint/utils/vector.h"
namespace tint::ast { namespace tint::ast {
@ -36,7 +36,7 @@ namespace tint::writer {
bool CheckSupportedExtensions(std::string_view writer_name, bool CheckSupportedExtensions(std::string_view writer_name,
const ast::Module& module, const ast::Module& module,
diag::List& diags, diag::List& diags,
utils::VectorRef<ast::Extension> supported); utils::VectorRef<builtin::Extension> supported);
} // namespace tint::writer } // namespace tint::writer

View File

@ -24,21 +24,21 @@ namespace {
class CheckSupportedExtensionsTest : public ::testing::Test, public ProgramBuilder {}; class CheckSupportedExtensionsTest : public ::testing::Test, public ProgramBuilder {};
TEST_F(CheckSupportedExtensionsTest, Supported) { TEST_F(CheckSupportedExtensionsTest, Supported) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
ASSERT_TRUE(CheckSupportedExtensions("writer", AST(), Diagnostics(), ASSERT_TRUE(CheckSupportedExtensions("writer", AST(), Diagnostics(),
utils::Vector{ utils::Vector{
ast::Extension::kF16, builtin::Extension::kF16,
ast::Extension::kChromiumExperimentalDp4A, builtin::Extension::kChromiumExperimentalDp4A,
})); }));
} }
TEST_F(CheckSupportedExtensionsTest, Unsupported) { TEST_F(CheckSupportedExtensionsTest, Unsupported) {
Enable(Source{{12, 34}}, ast::Extension::kF16); Enable(Source{{12, 34}}, builtin::Extension::kF16);
ASSERT_FALSE(CheckSupportedExtensions("writer", AST(), Diagnostics(), ASSERT_FALSE(CheckSupportedExtensions("writer", AST(), Diagnostics(),
utils::Vector{ utils::Vector{
ast::Extension::kChromiumExperimentalDp4A, builtin::Extension::kChromiumExperimentalDp4A,
})); }));
EXPECT_EQ(Diagnostics().str(), "12:34 error: writer backend does not support extension 'f16'"); EXPECT_EQ(Diagnostics().str(), "12:34 error: writer backend does not support extension 'f16'");
} }

View File

@ -326,7 +326,7 @@ bool GeneratorImpl::Generate() {
bool GeneratorImpl::RecordExtension(const ast::Enable* ext) { bool GeneratorImpl::RecordExtension(const ast::Enable* ext) {
// Deal with extension node here, recording it within the generator for later emition. // Deal with extension node here, recording it within the generator for later emition.
if (ext->extension == ast::Extension::kF16) { if (ext->extension == builtin::Extension::kF16) {
requires_f16_extension_ = true; requires_f16_extension_ = true;
} }

View File

@ -69,7 +69,7 @@ TEST_P(GlslBinaryTest, Emit_f16) {
return; return;
} }
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("left", ty.f16(), type::AddressSpace::kPrivate); GlobalVar("left", ty.f16(), type::AddressSpace::kPrivate);
GlobalVar("right", ty.f16(), type::AddressSpace::kPrivate); GlobalVar("right", ty.f16(), type::AddressSpace::kPrivate);
@ -167,7 +167,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_VectorScalar_f32) {
} }
TEST_F(GlslGeneratorImplTest_Binary, Multiply_VectorScalar_f16) { TEST_F(GlslGeneratorImplTest_Binary, Multiply_VectorScalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("a", vec3<f16>(1_h, 1_h, 1_h), type::AddressSpace::kPrivate); GlobalVar("a", vec3<f16>(1_h, 1_h, 1_h), type::AddressSpace::kPrivate);
auto* lhs = Expr("a"); auto* lhs = Expr("a");
@ -201,7 +201,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_ScalarVector_f32) {
} }
TEST_F(GlslGeneratorImplTest_Binary, Multiply_ScalarVector_f16) { TEST_F(GlslGeneratorImplTest_Binary, Multiply_ScalarVector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("a", vec3<f16>(1_h, 1_h, 1_h), type::AddressSpace::kPrivate); GlobalVar("a", vec3<f16>(1_h, 1_h, 1_h), type::AddressSpace::kPrivate);
auto* lhs = Expr(1_h); auto* lhs = Expr(1_h);
@ -234,7 +234,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixScalar_f32) {
} }
TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixScalar_f16) { TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixScalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("mat", ty.mat3x3<f16>(), type::AddressSpace::kPrivate); GlobalVar("mat", ty.mat3x3<f16>(), type::AddressSpace::kPrivate);
auto* lhs = Expr("mat"); auto* lhs = Expr("mat");
@ -266,7 +266,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_ScalarMatrix_f32) {
} }
TEST_F(GlslGeneratorImplTest_Binary, Multiply_ScalarMatrix_f16) { TEST_F(GlslGeneratorImplTest_Binary, Multiply_ScalarMatrix_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("mat", ty.mat3x3<f16>(), type::AddressSpace::kPrivate); GlobalVar("mat", ty.mat3x3<f16>(), type::AddressSpace::kPrivate);
auto* lhs = Expr(1_h); auto* lhs = Expr(1_h);
@ -298,7 +298,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixVector_f32) {
} }
TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixVector_f16) { TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixVector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("mat", ty.mat3x3<f16>(), type::AddressSpace::kPrivate); GlobalVar("mat", ty.mat3x3<f16>(), type::AddressSpace::kPrivate);
auto* lhs = Expr("mat"); auto* lhs = Expr("mat");
@ -330,7 +330,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_VectorMatrix_f32) {
} }
TEST_F(GlslGeneratorImplTest_Binary, Multiply_VectorMatrix_f16) { TEST_F(GlslGeneratorImplTest_Binary, Multiply_VectorMatrix_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("mat", ty.mat3x3<f16>(), type::AddressSpace::kPrivate); GlobalVar("mat", ty.mat3x3<f16>(), type::AddressSpace::kPrivate);
auto* lhs = vec3<f16>(1_h, 1_h, 1_h); auto* lhs = vec3<f16>(1_h, 1_h, 1_h);
@ -361,7 +361,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixMatrix_f32) {
} }
TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixMatrix_f16) { TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixMatrix_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("lhs", ty.mat3x3<f16>(), type::AddressSpace::kPrivate); GlobalVar("lhs", ty.mat3x3<f16>(), type::AddressSpace::kPrivate);
GlobalVar("rhs", ty.mat3x3<f16>(), type::AddressSpace::kPrivate); GlobalVar("rhs", ty.mat3x3<f16>(), type::AddressSpace::kPrivate);
@ -391,7 +391,7 @@ TEST_F(GlslGeneratorImplTest_Binary, ModF32) {
} }
TEST_F(GlslGeneratorImplTest_Binary, ModF16) { TEST_F(GlslGeneratorImplTest_Binary, ModF16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("a", ty.f16(), type::AddressSpace::kPrivate); GlobalVar("a", ty.f16(), type::AddressSpace::kPrivate);
GlobalVar("b", ty.f16(), type::AddressSpace::kPrivate); GlobalVar("b", ty.f16(), type::AddressSpace::kPrivate);
@ -421,7 +421,7 @@ TEST_F(GlslGeneratorImplTest_Binary, ModVec3F32) {
} }
TEST_F(GlslGeneratorImplTest_Binary, ModVec3F16) { TEST_F(GlslGeneratorImplTest_Binary, ModVec3F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("a", ty.vec3<f16>(), type::AddressSpace::kPrivate); GlobalVar("a", ty.vec3<f16>(), type::AddressSpace::kPrivate);
GlobalVar("b", ty.vec3<f16>(), type::AddressSpace::kPrivate); GlobalVar("b", ty.vec3<f16>(), type::AddressSpace::kPrivate);
@ -451,7 +451,7 @@ TEST_F(GlslGeneratorImplTest_Binary, ModVec3F32ScalarF32) {
} }
TEST_F(GlslGeneratorImplTest_Binary, ModVec3F16ScalarF16) { TEST_F(GlslGeneratorImplTest_Binary, ModVec3F16ScalarF16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("a", ty.vec3<f16>(), type::AddressSpace::kPrivate); GlobalVar("a", ty.vec3<f16>(), type::AddressSpace::kPrivate);
GlobalVar("b", ty.f16(), type::AddressSpace::kPrivate); GlobalVar("b", ty.f16(), type::AddressSpace::kPrivate);
@ -481,7 +481,7 @@ TEST_F(GlslGeneratorImplTest_Binary, ModScalarF32Vec3F32) {
} }
TEST_F(GlslGeneratorImplTest_Binary, ModScalarF16Vec3F16) { TEST_F(GlslGeneratorImplTest_Binary, ModScalarF16Vec3F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("a", ty.f16(), type::AddressSpace::kPrivate); GlobalVar("a", ty.f16(), type::AddressSpace::kPrivate);
GlobalVar("b", ty.vec3<f16>(), type::AddressSpace::kPrivate); GlobalVar("b", ty.vec3<f16>(), type::AddressSpace::kPrivate);
@ -539,7 +539,7 @@ void test_function() {
} }
TEST_F(GlslGeneratorImplTest_Binary, ModMixedVec3ScalarF16) { TEST_F(GlslGeneratorImplTest_Binary, ModMixedVec3ScalarF16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("a", ty.vec3<f16>(), type::AddressSpace::kPrivate); GlobalVar("a", ty.vec3<f16>(), type::AddressSpace::kPrivate);
GlobalVar("b", ty.f16(), type::AddressSpace::kPrivate); GlobalVar("b", ty.f16(), type::AddressSpace::kPrivate);

View File

@ -196,7 +196,7 @@ TEST_P(GlslBuiltinTest, Emit) {
auto param = GetParam(); auto param = GetParam();
if (param.type == CallParamType::kF16) { if (param.type == CallParamType::kF16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("h2", ty.vec2<f16>(), type::AddressSpace::kPrivate); GlobalVar("h2", ty.vec2<f16>(), type::AddressSpace::kPrivate);
GlobalVar("h3", ty.vec3<f16>(), type::AddressSpace::kPrivate); GlobalVar("h3", ty.vec3<f16>(), type::AddressSpace::kPrivate);
@ -399,7 +399,7 @@ TEST_F(GlslGeneratorImplTest_Builtin, FMA_f32) {
} }
TEST_F(GlslGeneratorImplTest_Builtin, FMA_f16) { TEST_F(GlslGeneratorImplTest_Builtin, FMA_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("a", ty.vec3<f16>(), type::AddressSpace::kPrivate); GlobalVar("a", ty.vec3<f16>(), type::AddressSpace::kPrivate);
GlobalVar("b", ty.vec3<f16>(), type::AddressSpace::kPrivate); GlobalVar("b", ty.vec3<f16>(), type::AddressSpace::kPrivate);
@ -451,7 +451,7 @@ void main() {
} }
TEST_F(GlslGeneratorImplTest_Builtin, Runtime_Modf_Scalar_f16) { TEST_F(GlslGeneratorImplTest_Builtin, Runtime_Modf_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Decl(Let("f", Expr(1.5_h))), // WrapInFunction(Decl(Let("f", Expr(1.5_h))), //
Decl(Let("v", Call("modf", "f")))); Decl(Let("v", Call("modf", "f"))));
@ -522,7 +522,7 @@ void main() {
} }
TEST_F(GlslGeneratorImplTest_Builtin, Runtime_Modf_Vector_f16) { TEST_F(GlslGeneratorImplTest_Builtin, Runtime_Modf_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Decl(Let("f", vec3<f16>(1.5_h, 2.5_h, 3.5_h))), // WrapInFunction(Decl(Let("f", vec3<f16>(1.5_h, 2.5_h, 3.5_h))), //
Decl(Let("v", Call("modf", "f")))); Decl(Let("v", Call("modf", "f"))));
@ -585,7 +585,7 @@ void main() {
} }
TEST_F(GlslGeneratorImplTest_Builtin, Const_Modf_Scalar_f16) { TEST_F(GlslGeneratorImplTest_Builtin, Const_Modf_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Decl(Let("v", Call("modf", 1.5_h)))); WrapInFunction(Decl(Let("v", Call("modf", 1.5_h))));
@ -640,7 +640,7 @@ void main() {
} }
TEST_F(GlslGeneratorImplTest_Builtin, Const_Modf_Vector_f16) { TEST_F(GlslGeneratorImplTest_Builtin, Const_Modf_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Decl(Let("v", Call("modf", vec3<f16>(1.5_h, 2.5_h, 3.5_h))))); WrapInFunction(Decl(Let("v", Call("modf", vec3<f16>(1.5_h, 2.5_h, 3.5_h)))));
@ -703,7 +703,7 @@ void main() {
} }
TEST_F(GlslGeneratorImplTest_Builtin, Runtime_Frexp_Scalar_f16) { TEST_F(GlslGeneratorImplTest_Builtin, Runtime_Frexp_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Var("f", Expr(1_h)), // WrapInFunction(Var("f", Expr(1_h)), //
Var("v", Call("frexp", "f"))); Var("v", Call("frexp", "f")));
@ -774,7 +774,7 @@ void main() {
} }
TEST_F(GlslGeneratorImplTest_Builtin, Runtime_Frexp_Vector_f16) { TEST_F(GlslGeneratorImplTest_Builtin, Runtime_Frexp_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Var("f", Expr(vec3<f16>())), // WrapInFunction(Var("f", Expr(vec3<f16>())), //
Var("v", Call("frexp", "f"))); Var("v", Call("frexp", "f")));
@ -837,7 +837,7 @@ void main() {
} }
TEST_F(GlslGeneratorImplTest_Builtin, Const_Frexp_Scalar_f16) { TEST_F(GlslGeneratorImplTest_Builtin, Const_Frexp_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Decl(Let("v", Call("frexp", 1_h)))); WrapInFunction(Decl(Let("v", Call("frexp", 1_h))));
@ -892,7 +892,7 @@ void main() {
} }
TEST_F(GlslGeneratorImplTest_Builtin, Const_Frexp_Vector_f16) { TEST_F(GlslGeneratorImplTest_Builtin, Const_Frexp_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Decl(Let("v", Call("frexp", vec3<f16>())))); WrapInFunction(Decl(Let("v", Call("frexp", vec3<f16>()))));
@ -977,7 +977,7 @@ void main() {
} }
TEST_F(GlslGeneratorImplTest_Builtin, Degrees_Scalar_f16) { TEST_F(GlslGeneratorImplTest_Builtin, Degrees_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* val = Var("val", ty.f16()); auto* val = Var("val", ty.f16());
auto* call = Call("degrees", val); auto* call = Call("degrees", val);
@ -1008,7 +1008,7 @@ void main() {
} }
TEST_F(GlslGeneratorImplTest_Builtin, Degrees_Vector_f16) { TEST_F(GlslGeneratorImplTest_Builtin, Degrees_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* val = Var("val", ty.vec3<f16>()); auto* val = Var("val", ty.vec3<f16>());
auto* call = Call("degrees", val); auto* call = Call("degrees", val);
@ -1095,7 +1095,7 @@ void main() {
} }
TEST_F(GlslGeneratorImplTest_Builtin, Radians_Scalar_f16) { TEST_F(GlslGeneratorImplTest_Builtin, Radians_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* val = Var("val", ty.f16()); auto* val = Var("val", ty.f16());
auto* call = Call("radians", val); auto* call = Call("radians", val);
@ -1126,7 +1126,7 @@ void main() {
} }
TEST_F(GlslGeneratorImplTest_Builtin, Radians_Vector_f16) { TEST_F(GlslGeneratorImplTest_Builtin, Radians_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* val = Var("val", ty.vec3<f16>()); auto* val = Var("val", ty.vec3<f16>());
auto* call = Call("radians", val); auto* call = Call("radians", val);

View File

@ -62,7 +62,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Float) {
} }
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_F16) { TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
// Use a number close to 1<<16 but whose decimal representation ends in 0. // Use a number close to 1<<16 but whose decimal representation ends in 0.
WrapInFunction(Expr(f16((1 << 15) - 8))); WrapInFunction(Expr(f16((1 << 15) - 8)));
@ -83,7 +83,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Float) {
} }
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_F16) { TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Call<f16>(-1.2e-3_h)); WrapInFunction(Call<f16>(-1.2e-3_h));
@ -130,7 +130,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_F32) {
} }
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_F16) { TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(vec3<f16>(1_h, 2_h, 3_h)); WrapInFunction(vec3<f16>(1_h, 2_h, 3_h));
@ -150,7 +150,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_Empty_F32) {
} }
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_Empty_F16) { TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_Empty_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(vec3<f16>()); WrapInFunction(vec3<f16>());
@ -170,7 +170,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_
} }
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F16_Literal) { TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F16_Literal) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(vec3<f16>(2_h)); WrapInFunction(vec3<f16>(2_h));
@ -193,7 +193,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_
} }
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F16_Var) { TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F16_Var) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Var("v", Expr(2_h)); auto* var = Var("v", Expr(2_h));
auto* cast = vec3<f16>(var); auto* cast = vec3<f16>(var);
@ -244,7 +244,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_F32) {
} }
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_F16) { TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(mat2x3<f16>(vec3<f16>(1_h, 2_h, 3_h), vec3<f16>(3_h, 4_h, 5_h))); WrapInFunction(mat2x3<f16>(vec3<f16>(1_h, 2_h, 3_h), vec3<f16>(3_h, 4_h, 5_h)));
@ -290,7 +290,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Complex_F16)
// vec4<f16>(7.0h), // vec4<f16>(7.0h),
// vec4<f16>(vec4<f16>(42.0h, 21.0h, 6.0h, -5.0h)), // vec4<f16>(vec4<f16>(42.0h, 21.0h, 6.0h, -5.0h)),
// ); // );
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* vector_literal = auto* vector_literal =
vec4<f16>(Expr(f16(2.0)), Expr(f16(3.0)), Expr(f16(4.0)), Expr(f16(8.0))); vec4<f16>(Expr(f16(2.0)), Expr(f16(3.0)), Expr(f16(4.0)), Expr(f16(8.0)));
@ -324,7 +324,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Empty_F32) {
} }
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Empty_F16) { TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Empty_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(mat2x3<f16>()); WrapInFunction(mat2x3<f16>());
@ -360,7 +360,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Identity_F16)
// var m_2: mat4x4<f16> = mat4x4<f16>(m_1); // var m_2: mat4x4<f16> = mat4x4<f16>(m_1);
// } // }
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* m_1 = Var("m_1", ty.mat4x4(ty.f16()), mat4x4<f16>()); auto* m_1 = Var("m_1", ty.mat4x4(ty.f16()), mat4x4<f16>());
auto* m_2 = Var("m_2", ty.mat4x4(ty.f16()), mat4x4<f16>(m_1)); auto* m_2 = Var("m_2", ty.mat4x4(ty.f16()), mat4x4<f16>(m_1));

View File

@ -133,7 +133,7 @@ void f() {
} }
TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_f16) { TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = GlobalConst("G", Expr(1_h)); auto* var = GlobalConst("G", Expr(1_h));
Func("f", utils::Empty, ty.void_(), Func("f", utils::Empty, ty.void_(),
@ -216,7 +216,7 @@ void f() {
} }
TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_vec3_f16) { TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_vec3_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = GlobalConst("G", vec3<f16>(1_h, 2_h, 3_h)); auto* var = GlobalConst("G", vec3<f16>(1_h, 2_h, 3_h));
Func("f", utils::Empty, ty.void_(), Func("f", utils::Empty, ty.void_(),
@ -279,7 +279,7 @@ void f() {
} }
TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_mat2x3_f16) { TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_mat2x3_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = GlobalConst("G", mat2x3<f16>(1_h, 2_h, 3_h, 4_h, 5_h, 6_h)); auto* var = GlobalConst("G", mat2x3<f16>(1_h, 2_h, 3_h, 4_h, 5_h, 6_h));
Func("f", utils::Empty, ty.void_(), Func("f", utils::Empty, ty.void_(),

View File

@ -107,7 +107,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_F32) {
} }
TEST_F(GlslGeneratorImplTest_Type, EmitType_F16) { TEST_F(GlslGeneratorImplTest_Type, EmitType_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* f16 = create<type::F16>(); auto* f16 = create<type::F16>();
@ -144,7 +144,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_Matrix_F32) {
} }
TEST_F(GlslGeneratorImplTest_Type, EmitType_Matrix_F16) { TEST_F(GlslGeneratorImplTest_Type, EmitType_Matrix_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* f16 = create<type::F16>(); auto* f16 = create<type::F16>();
auto* vec3 = create<type::Vector>(f16, 3u); auto* vec3 = create<type::Vector>(f16, 3u);
@ -255,7 +255,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_Vector_F32) {
} }
TEST_F(GlslGeneratorImplTest_Type, EmitType_Vector_F16) { TEST_F(GlslGeneratorImplTest_Type, EmitType_Vector_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* f16 = create<type::F16>(); auto* f16 = create<type::F16>();
auto* vec3 = create<type::Vector>(f16, 3u); auto* vec3 = create<type::Vector>(f16, 3u);

View File

@ -170,7 +170,7 @@ void f() {
} }
TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_f16) { TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* C = Const("C", Expr(1_h)); auto* C = Const("C", Expr(1_h));
Func("f", utils::Empty, ty.void_(), Func("f", utils::Empty, ty.void_(),
@ -257,7 +257,7 @@ void f() {
} }
TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_vec3_f16) { TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_vec3_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* C = Const("C", vec3<f16>(1_h, 2_h, 3_h)); auto* C = Const("C", vec3<f16>(1_h, 2_h, 3_h));
Func("f", utils::Empty, ty.void_(), Func("f", utils::Empty, ty.void_(),
@ -323,7 +323,7 @@ void f() {
} }
TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_mat2x3_f16) { TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_mat2x3_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* C = Const("C", mat2x3<f16>(1_h, 2_h, 3_h, 4_h, 5_h, 6_h)); auto* C = Const("C", mat2x3<f16>(1_h, 2_h, 3_h, 4_h, 5_h, 6_h));
Func("f", utils::Empty, ty.void_(), Func("f", utils::Empty, ty.void_(),
@ -501,7 +501,7 @@ TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initialize
} }
TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initializer_ZeroVec_f16) { TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initializer_ZeroVec_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Var("a", ty.vec3<f16>(), vec3<f16>()); auto* var = Var("a", ty.vec3<f16>(), vec3<f16>());
@ -530,7 +530,7 @@ TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initialize
} }
TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initializer_ZeroMat_f16) { TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initializer_ZeroMat_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Var("a", ty.mat2x3<f16>(), mat2x3<f16>()); auto* var = Var("a", ty.mat2x3<f16>(), mat2x3<f16>());

View File

@ -297,11 +297,11 @@ GeneratorImpl::~GeneratorImpl() = default;
bool GeneratorImpl::Generate() { bool GeneratorImpl::Generate() {
if (!CheckSupportedExtensions("HLSL", program_->AST(), diagnostics_, if (!CheckSupportedExtensions("HLSL", program_->AST(), diagnostics_,
utils::Vector{ utils::Vector{
ast::Extension::kChromiumDisableUniformityAnalysis, builtin::Extension::kChromiumDisableUniformityAnalysis,
ast::Extension::kChromiumExperimentalDp4A, builtin::Extension::kChromiumExperimentalDp4A,
ast::Extension::kChromiumExperimentalFullPtrParameters, builtin::Extension::kChromiumExperimentalFullPtrParameters,
ast::Extension::kChromiumExperimentalPushConstant, builtin::Extension::kChromiumExperimentalPushConstant,
ast::Extension::kF16, builtin::Extension::kF16,
})) { })) {
return false; return false;
} }

View File

@ -80,7 +80,7 @@ TEST_P(HlslBinaryTest, Emit_f16) {
return; return;
} }
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("left", ty.f16(), type::AddressSpace::kPrivate); GlobalVar("left", ty.f16(), type::AddressSpace::kPrivate);
GlobalVar("right", ty.f16(), type::AddressSpace::kPrivate); GlobalVar("right", ty.f16(), type::AddressSpace::kPrivate);
@ -188,7 +188,7 @@ TEST_F(HlslGeneratorImplTest_Binary, Multiply_VectorScalar_f32) {
} }
TEST_F(HlslGeneratorImplTest_Binary, Multiply_VectorScalar_f16) { TEST_F(HlslGeneratorImplTest_Binary, Multiply_VectorScalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* lhs = vec3<f16>(1_h, 1_h, 1_h); auto* lhs = vec3<f16>(1_h, 1_h, 1_h);
auto* rhs = Expr(1_h); auto* rhs = Expr(1_h);
@ -220,7 +220,7 @@ TEST_F(HlslGeneratorImplTest_Binary, Multiply_ScalarVector_f32) {
} }
TEST_F(HlslGeneratorImplTest_Binary, Multiply_ScalarVector_f16) { TEST_F(HlslGeneratorImplTest_Binary, Multiply_ScalarVector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* lhs = Expr(1_h); auto* lhs = Expr(1_h);
auto* rhs = vec3<f16>(1_h, 1_h, 1_h); auto* rhs = vec3<f16>(1_h, 1_h, 1_h);
@ -252,7 +252,7 @@ TEST_F(HlslGeneratorImplTest_Binary, Multiply_MatrixScalar_f32) {
} }
TEST_F(HlslGeneratorImplTest_Binary, Multiply_MatrixScalar_f16) { TEST_F(HlslGeneratorImplTest_Binary, Multiply_MatrixScalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("mat", ty.mat3x3<f16>(), type::AddressSpace::kPrivate); GlobalVar("mat", ty.mat3x3<f16>(), type::AddressSpace::kPrivate);
auto* lhs = Expr("mat"); auto* lhs = Expr("mat");
@ -284,7 +284,7 @@ TEST_F(HlslGeneratorImplTest_Binary, Multiply_ScalarMatrix_f32) {
} }
TEST_F(HlslGeneratorImplTest_Binary, Multiply_ScalarMatrix_f16) { TEST_F(HlslGeneratorImplTest_Binary, Multiply_ScalarMatrix_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("mat", ty.mat3x3<f16>(), type::AddressSpace::kPrivate); GlobalVar("mat", ty.mat3x3<f16>(), type::AddressSpace::kPrivate);
auto* lhs = Expr(1_h); auto* lhs = Expr(1_h);
@ -316,7 +316,7 @@ TEST_F(HlslGeneratorImplTest_Binary, Multiply_MatrixVector_f32) {
} }
TEST_F(HlslGeneratorImplTest_Binary, Multiply_MatrixVector_f16) { TEST_F(HlslGeneratorImplTest_Binary, Multiply_MatrixVector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("mat", ty.mat3x3<f16>(), type::AddressSpace::kPrivate); GlobalVar("mat", ty.mat3x3<f16>(), type::AddressSpace::kPrivate);
auto* lhs = Expr("mat"); auto* lhs = Expr("mat");
@ -348,7 +348,7 @@ TEST_F(HlslGeneratorImplTest_Binary, Multiply_VectorMatrix_f32) {
} }
TEST_F(HlslGeneratorImplTest_Binary, Multiply_VectorMatrix_f16) { TEST_F(HlslGeneratorImplTest_Binary, Multiply_VectorMatrix_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("mat", ty.mat3x3<f16>(), type::AddressSpace::kPrivate); GlobalVar("mat", ty.mat3x3<f16>(), type::AddressSpace::kPrivate);
auto* lhs = vec3<f16>(1_h, 1_h, 1_h); auto* lhs = vec3<f16>(1_h, 1_h, 1_h);
@ -379,7 +379,7 @@ TEST_F(HlslGeneratorImplTest_Binary, Multiply_MatrixMatrix_f32) {
} }
TEST_F(HlslGeneratorImplTest_Binary, Multiply_MatrixMatrix_f16) { TEST_F(HlslGeneratorImplTest_Binary, Multiply_MatrixMatrix_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("lhs", ty.mat3x3<f16>(), type::AddressSpace::kPrivate); GlobalVar("lhs", ty.mat3x3<f16>(), type::AddressSpace::kPrivate);
GlobalVar("rhs", ty.mat3x3<f16>(), type::AddressSpace::kPrivate); GlobalVar("rhs", ty.mat3x3<f16>(), type::AddressSpace::kPrivate);

View File

@ -195,7 +195,7 @@ TEST_P(HlslBuiltinTest, Emit) {
auto param = GetParam(); auto param = GetParam();
if (param.type == CallParamType::kF16) { if (param.type == CallParamType::kF16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("h2", ty.vec2<f16>(), type::AddressSpace::kPrivate); GlobalVar("h2", ty.vec2<f16>(), type::AddressSpace::kPrivate);
GlobalVar("h3", ty.vec3<f16>(), type::AddressSpace::kPrivate); GlobalVar("h3", ty.vec3<f16>(), type::AddressSpace::kPrivate);
@ -405,7 +405,7 @@ void test_function() {
} }
TEST_F(HlslGeneratorImplTest_Builtin, Runtime_Modf_Scalar_f16) { TEST_F(HlslGeneratorImplTest_Builtin, Runtime_Modf_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Decl(Let("f", Expr(1.5_h))), // WrapInFunction(Decl(Let("f", Expr(1.5_h))), //
Decl(Let("v", Call("modf", "f")))); Decl(Let("v", Call("modf", "f"))));
@ -459,7 +459,7 @@ void test_function() {
} }
TEST_F(HlslGeneratorImplTest_Builtin, Runtime_Modf_Vector_f16) { TEST_F(HlslGeneratorImplTest_Builtin, Runtime_Modf_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Decl(Let("f", vec3<f16>(1.5_h, 2.5_h, 3.5_h))), // WrapInFunction(Decl(Let("f", vec3<f16>(1.5_h, 2.5_h, 3.5_h))), //
Decl(Let("v", Call("modf", "f")))); Decl(Let("v", Call("modf", "f"))));
@ -505,7 +505,7 @@ void test_function() {
} }
TEST_F(HlslGeneratorImplTest_Builtin, Const_Modf_Scalar_f16) { TEST_F(HlslGeneratorImplTest_Builtin, Const_Modf_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Decl(Let("v", Call("modf", 1.5_h)))); WrapInFunction(Decl(Let("v", Call("modf", 1.5_h))));
@ -543,7 +543,7 @@ void test_function() {
} }
TEST_F(HlslGeneratorImplTest_Builtin, Const_Modf_Vector_f16) { TEST_F(HlslGeneratorImplTest_Builtin, Const_Modf_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Decl(Let("v", Call("modf", vec3<f16>(1.5_h, 2.5_h, 3.5_h))))); WrapInFunction(Decl(Let("v", Call("modf", vec3<f16>(1.5_h, 2.5_h, 3.5_h)))));
@ -616,7 +616,7 @@ void test_function() {
} }
TEST_F(HlslGeneratorImplTest_Builtin, Runtime_Frexp_Scalar_f16) { TEST_F(HlslGeneratorImplTest_Builtin, Runtime_Frexp_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Var("f", Expr(1_h)), // WrapInFunction(Var("f", Expr(1_h)), //
Var("v", Call("frexp", "f"))); Var("v", Call("frexp", "f")));
@ -672,7 +672,7 @@ void test_function() {
} }
TEST_F(HlslGeneratorImplTest_Builtin, Runtime_Frexp_Vector_f16) { TEST_F(HlslGeneratorImplTest_Builtin, Runtime_Frexp_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Var("f", Expr(vec3<f16>())), // WrapInFunction(Var("f", Expr(vec3<f16>())), //
Var("v", Call("frexp", "f"))); Var("v", Call("frexp", "f")));
@ -719,7 +719,7 @@ void test_function() {
} }
TEST_F(HlslGeneratorImplTest_Builtin, Const_Frexp_Scalar_f16) { TEST_F(HlslGeneratorImplTest_Builtin, Const_Frexp_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Decl(Let("v", Call("frexp", 1_h)))); WrapInFunction(Decl(Let("v", Call("frexp", 1_h))));
@ -757,7 +757,7 @@ void test_function() {
} }
TEST_F(HlslGeneratorImplTest_Builtin, Const_Frexp_Vector_f16) { TEST_F(HlslGeneratorImplTest_Builtin, Const_Frexp_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Decl(Let("v", Call("frexp", vec3<f16>())))); WrapInFunction(Decl(Let("v", Call("frexp", vec3<f16>()))));
@ -845,7 +845,7 @@ void test_function() {
} }
TEST_F(HlslGeneratorImplTest_Builtin, Degrees_Scalar_f16) { TEST_F(HlslGeneratorImplTest_Builtin, Degrees_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* val = Var("val", ty.f16()); auto* val = Var("val", ty.f16());
auto* call = Call("degrees", val); auto* call = Call("degrees", val);
@ -868,7 +868,7 @@ void test_function() {
} }
TEST_F(HlslGeneratorImplTest_Builtin, Degrees_Vector_f16) { TEST_F(HlslGeneratorImplTest_Builtin, Degrees_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* val = Var("val", ty.vec3<f16>()); auto* val = Var("val", ty.vec3<f16>());
auto* call = Call("degrees", val); auto* call = Call("degrees", val);
@ -933,7 +933,7 @@ void test_function() {
} }
TEST_F(HlslGeneratorImplTest_Builtin, Radians_Scalar_f16) { TEST_F(HlslGeneratorImplTest_Builtin, Radians_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* val = Var("val", ty.f16()); auto* val = Var("val", ty.f16());
auto* call = Call("radians", val); auto* call = Call("radians", val);
@ -956,7 +956,7 @@ void test_function() {
} }
TEST_F(HlslGeneratorImplTest_Builtin, Radians_Vector_f16) { TEST_F(HlslGeneratorImplTest_Builtin, Radians_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* val = Var("val", ty.vec3<f16>()); auto* val = Var("val", ty.vec3<f16>());
auto* call = Call("radians", val); auto* call = Call("radians", val);
@ -1047,7 +1047,7 @@ void test_function() {
} }
TEST_F(HlslGeneratorImplTest_Builtin, Sign_Scalar_f16) { TEST_F(HlslGeneratorImplTest_Builtin, Sign_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* val = Var("val", ty.f16()); auto* val = Var("val", ty.f16());
auto* call = Call("sign", val); auto* call = Call("sign", val);
@ -1066,7 +1066,7 @@ void test_function() {
} }
TEST_F(HlslGeneratorImplTest_Builtin, Sign_Vector_f16) { TEST_F(HlslGeneratorImplTest_Builtin, Sign_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* val = Var("val", ty.vec3<f16>()); auto* val = Var("val", ty.vec3<f16>());
auto* call = Call("sign", val); auto* call = Call("sign", val);
@ -1351,7 +1351,7 @@ void main() {
} }
TEST_F(HlslGeneratorImplTest_Builtin, Dot4I8Packed) { TEST_F(HlslGeneratorImplTest_Builtin, Dot4I8Packed) {
Enable(ast::Extension::kChromiumExperimentalDp4A); Enable(builtin::Extension::kChromiumExperimentalDp4A);
auto* val1 = Var("val1", ty.u32()); auto* val1 = Var("val1", ty.u32());
auto* val2 = Var("val2", ty.u32()); auto* val2 = Var("val2", ty.u32());
@ -1377,7 +1377,7 @@ void test_function() {
} }
TEST_F(HlslGeneratorImplTest_Builtin, Dot4U8Packed) { TEST_F(HlslGeneratorImplTest_Builtin, Dot4U8Packed) {
Enable(ast::Extension::kChromiumExperimentalDp4A); Enable(builtin::Extension::kChromiumExperimentalDp4A);
auto* val1 = Var("val1", ty.u32()); auto* val1 = Var("val1", ty.u32());
auto* val2 = Var("val2", ty.u32()); auto* val2 = Var("val2", ty.u32());

View File

@ -62,7 +62,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Float) {
} }
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_F16) { TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
// Use a number close to 1<<16 but whose decimal representation ends in 0. // Use a number close to 1<<16 but whose decimal representation ends in 0.
WrapInFunction(Expr(f16((1 << 15) - 8))); WrapInFunction(Expr(f16((1 << 15) - 8)));
@ -83,7 +83,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Float) {
} }
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_F16) { TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Call<f16>(-1.2e-3_h)); WrapInFunction(Call<f16>(-1.2e-3_h));
@ -130,7 +130,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_F32) {
} }
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_F16) { TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(vec3<f16>(1_h, 2_h, 3_h)); WrapInFunction(vec3<f16>(1_h, 2_h, 3_h));
@ -152,7 +152,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_Empty_F32) {
} }
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_Empty_F16) { TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_Empty_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(vec3<f16>()); WrapInFunction(vec3<f16>());
@ -172,7 +172,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_
} }
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F16_Literal) { TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F16_Literal) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(vec3<f16>(2_h)); WrapInFunction(vec3<f16>(2_h));
@ -195,7 +195,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_
} }
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F16_Var) { TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F16_Var) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Var("v", Expr(2_h)); auto* var = Var("v", Expr(2_h));
auto* cast = vec3<f16>(var); auto* cast = vec3<f16>(var);
@ -259,7 +259,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_F32) {
} }
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_F16) { TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(mat2x3<f16>(vec3<f16>(1_h, 2_h, 3_h), vec3<f16>(3_h, 4_h, 5_h))); WrapInFunction(mat2x3<f16>(vec3<f16>(1_h, 2_h, 3_h), vec3<f16>(3_h, 4_h, 5_h)));
@ -307,7 +307,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Complex_F16)
// vec4<f16>(7.0h), // vec4<f16>(7.0h),
// vec4<f16>(vec4<f16>(42.0h, 21.0h, 6.0h, -5.0h)), // vec4<f16>(vec4<f16>(42.0h, 21.0h, 6.0h, -5.0h)),
// ); // );
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* vector_literal = auto* vector_literal =
vec4<f16>(Expr(f16(2.0)), Expr(f16(3.0)), Expr(f16(4.0)), Expr(f16(8.0))); vec4<f16>(Expr(f16(2.0)), Expr(f16(3.0)), Expr(f16(4.0)), Expr(f16(8.0)));
@ -344,7 +344,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Empty_F32) {
} }
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Empty_F16) { TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Empty_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(mat2x3<f16>()); WrapInFunction(mat2x3<f16>());
@ -380,7 +380,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Identity_F16)
// var m_2: mat4x4<f16> = mat4x4<f16>(m_1); // var m_2: mat4x4<f16> = mat4x4<f16>(m_1);
// } // }
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* m_1 = Var("m_1", ty.mat4x4(ty.f16()), mat4x4<f16>()); auto* m_1 = Var("m_1", ty.mat4x4(ty.f16()), mat4x4<f16>());
auto* m_2 = Var("m_2", ty.mat4x4(ty.f16()), mat4x4<f16>(m_1)); auto* m_2 = Var("m_2", ty.mat4x4(ty.f16()), mat4x4<f16>(m_1));

View File

@ -165,7 +165,7 @@ TEST_P(HlslGeneratorImplTest_MemberAccessor_StorageBufferLoad_ConstantOffset, Te
auto p = GetParam(); auto p = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
SetupStorageBuffer(utils::Vector{ SetupStorageBuffer(utils::Vector{
Member("a", ty.i32()), Member("a", ty.i32()),
@ -300,7 +300,7 @@ TEST_P(HlslGeneratorImplTest_MemberAccessor_StorageBufferLoad_DynamicOffset, Tes
auto p = GetParam(); auto p = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* inner = Structure("Inner", utils::Vector{ auto* inner = Structure("Inner", utils::Vector{
Member("a", ty.i32()), Member("a", ty.i32()),
@ -439,7 +439,7 @@ TEST_P(HlslGeneratorImplTest_MemberAccessor_UniformBufferLoad_ConstantOffset, Te
auto p = GetParam(); auto p = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
SetupUniformBuffer(utils::Vector{ SetupUniformBuffer(utils::Vector{
Member("a", ty.i32()), Member("a", ty.i32()),
@ -707,7 +707,7 @@ TEST_P(HlslGeneratorImplTest_MemberAccessor_UniformBufferLoad_DynamicOffset, Tes
auto p = GetParam(); auto p = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* inner = Structure("Inner", utils::Vector{ auto* inner = Structure("Inner", utils::Vector{
Member("a", ty.i32()), Member("a", ty.i32()),
@ -989,7 +989,7 @@ TEST_P(HlslGeneratorImplTest_MemberAccessor_StorageBufferStore, Test) {
auto p = GetParam(); auto p = GetParam();
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
SetupStorageBuffer(utils::Vector{ SetupStorageBuffer(utils::Vector{
Member("a", ty.i32()), Member("a", ty.i32()),
@ -1192,7 +1192,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, StorageBuffer_Load_Matrix_F16_Singl
// var<storage> data : Data; // var<storage> data : Data;
// data.a[2i][1i]; // data.a[2i][1i];
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
SetupStorageBuffer(utils::Vector{ SetupStorageBuffer(utils::Vector{
Member("z", ty.f16()), Member("z", ty.f16()),
@ -1258,7 +1258,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, UniformBuffer_Load_Matrix_F16_Singl
// var<uniform> data : Data; // var<uniform> data : Data;
// data.a[2i][1i]; // data.a[2i][1i];
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
SetupUniformBuffer(utils::Vector{ SetupUniformBuffer(utils::Vector{
Member("z", ty.f16()), Member("z", ty.f16()),

View File

@ -93,7 +93,7 @@ TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_f32) {
} }
TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_f16) { TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = GlobalConst("G", Expr(1_h)); auto* var = GlobalConst("G", Expr(1_h));
Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
@ -151,7 +151,7 @@ TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_vec3_f32) {
} }
TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_vec3_f16) { TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_vec3_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = GlobalConst("G", vec3<f16>(1_h, 2_h, 3_h)); auto* var = GlobalConst("G", vec3<f16>(1_h, 2_h, 3_h));
Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
@ -195,7 +195,7 @@ TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_mat2x3_f32) {
} }
TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_mat2x3_f16) { TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_mat2x3_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = GlobalConst("G", mat2x3<f16>(1_h, 2_h, 3_h, 4_h, 5_h, 6_h)); auto* var = GlobalConst("G", mat2x3<f16>(1_h, 2_h, 3_h, 4_h, 5_h, 6_h));
Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});

View File

@ -29,7 +29,7 @@ TEST_F(HlslGeneratorImplTest, InvalidProgram) {
} }
TEST_F(HlslGeneratorImplTest, UnsupportedExtension) { TEST_F(HlslGeneratorImplTest, UnsupportedExtension) {
Enable(Source{{12, 34}}, ast::Extension::kUndefined); Enable(Source{{12, 34}}, builtin::Extension::kUndefined);
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();

View File

@ -155,7 +155,7 @@ TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_f32)
} }
TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_f16) { TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* C = Const("C", Expr(1_h)); auto* C = Const("C", Expr(1_h));
Func("f", utils::Empty, ty.void_(), Func("f", utils::Empty, ty.void_(),
@ -229,7 +229,7 @@ TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_vec3
} }
TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_vec3_f16) { TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_vec3_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* C = Const("C", vec3<f16>(1_h, 2_h, 3_h)); auto* C = Const("C", vec3<f16>(1_h, 2_h, 3_h));
Func("f", utils::Empty, ty.void_(), Func("f", utils::Empty, ty.void_(),
@ -285,7 +285,7 @@ TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_mat2
} }
TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_mat2x3_f16) { TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_mat2x3_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* C = Const("C", mat2x3<f16>(1_h, 2_h, 3_h, 4_h, 5_h, 6_h)); auto* C = Const("C", mat2x3<f16>(1_h, 2_h, 3_h, 4_h, 5_h, 6_h));
Func("f", utils::Empty, ty.void_(), Func("f", utils::Empty, ty.void_(),
@ -383,7 +383,7 @@ TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initialize
} }
TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initializer_ZeroVec_F16) { TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initializer_ZeroVec_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Var("a", ty.vec3<f16>(), vec3<f16>()); auto* var = Var("a", ty.vec3<f16>(), vec3<f16>());
@ -412,7 +412,7 @@ TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initialize
} }
TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initializer_ZeroMat_F16) { TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initializer_ZeroMat_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Var("a", ty.mat2x3<f16>(), mat2x3<f16>()); auto* var = Var("a", ty.mat2x3<f16>(), mat2x3<f16>());

View File

@ -270,10 +270,10 @@ GeneratorImpl::~GeneratorImpl() = default;
bool GeneratorImpl::Generate() { bool GeneratorImpl::Generate() {
if (!CheckSupportedExtensions("MSL", program_->AST(), diagnostics_, if (!CheckSupportedExtensions("MSL", program_->AST(), diagnostics_,
utils::Vector{ utils::Vector{
ast::Extension::kChromiumDisableUniformityAnalysis, builtin::Extension::kChromiumDisableUniformityAnalysis,
ast::Extension::kChromiumExperimentalFullPtrParameters, builtin::Extension::kChromiumExperimentalFullPtrParameters,
ast::Extension::kChromiumExperimentalPushConstant, builtin::Extension::kChromiumExperimentalPushConstant,
ast::Extension::kF16, builtin::Extension::kF16,
})) { })) {
return false; return false;
} }

View File

@ -155,7 +155,7 @@ TEST_F(MslBinaryTest, ModF32) {
} }
TEST_F(MslBinaryTest, ModF16) { TEST_F(MslBinaryTest, ModF16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* left = Var("left", ty.f16()); auto* left = Var("left", ty.f16());
auto* right = Var("right", ty.f16()); auto* right = Var("right", ty.f16());
@ -183,7 +183,7 @@ TEST_F(MslBinaryTest, ModVec3F32) {
} }
TEST_F(MslBinaryTest, ModVec3F16) { TEST_F(MslBinaryTest, ModVec3F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* left = Var("left", ty.vec3<f16>()); auto* left = Var("left", ty.vec3<f16>());
auto* right = Var("right", ty.vec3<f16>()); auto* right = Var("right", ty.vec3<f16>());

View File

@ -214,7 +214,7 @@ TEST_P(MslBuiltinTest, Emit) {
auto param = GetParam(); auto param = GetParam();
if (param.type == CallParamType::kF16) { if (param.type == CallParamType::kF16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
GlobalVar("h2", ty.vec2<f16>(), type::AddressSpace::kPrivate); GlobalVar("h2", ty.vec2<f16>(), type::AddressSpace::kPrivate);
GlobalVar("h3", ty.vec3<f16>(), type::AddressSpace::kPrivate); GlobalVar("h3", ty.vec3<f16>(), type::AddressSpace::kPrivate);
@ -436,7 +436,7 @@ kernel void test_function() {
} }
TEST_F(MslGeneratorImplTest, Runtime_Modf_Scalar_f16) { TEST_F(MslGeneratorImplTest, Runtime_Modf_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Decl(Let("f", Expr(1.5_h))), // WrapInFunction(Decl(Let("f", Expr(1.5_h))), //
Decl(Let("v", Call("modf", "f")))); Decl(Let("v", Call("modf", "f"))));
@ -498,7 +498,7 @@ kernel void test_function() {
} }
TEST_F(MslGeneratorImplTest, Runtime_Modf_Vector_f16) { TEST_F(MslGeneratorImplTest, Runtime_Modf_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Decl(Let("f", vec3<f16>(1.5_h, 2.5_h, 3.5_h))), // WrapInFunction(Decl(Let("f", vec3<f16>(1.5_h, 2.5_h, 3.5_h))), //
Decl(Let("v", Call("modf", "f")))); Decl(Let("v", Call("modf", "f"))));
@ -552,7 +552,7 @@ kernel void test_function() {
} }
TEST_F(MslGeneratorImplTest, Const_Modf_Scalar_f16) { TEST_F(MslGeneratorImplTest, Const_Modf_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Decl(Let("v", Call("modf", 1.5_h)))); WrapInFunction(Decl(Let("v", Call("modf", 1.5_h))));
@ -598,7 +598,7 @@ kernel void test_function() {
} }
TEST_F(MslGeneratorImplTest, Const_Modf_Vector_f16) { TEST_F(MslGeneratorImplTest, Const_Modf_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Decl(Let("v", Call("modf", vec3<f16>(1.5_h, 2.5_h, 3.5_h))))); WrapInFunction(Decl(Let("v", Call("modf", vec3<f16>(1.5_h, 2.5_h, 3.5_h)))));
@ -652,7 +652,7 @@ kernel void test_function() {
} }
TEST_F(MslGeneratorImplTest, Runtime_Frexp_Scalar_f16) { TEST_F(MslGeneratorImplTest, Runtime_Frexp_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Var("f", Expr(1_h)), // WrapInFunction(Var("f", Expr(1_h)), //
Var("v", Call("frexp", "f"))); Var("v", Call("frexp", "f")));
@ -714,7 +714,7 @@ kernel void test_function() {
} }
TEST_F(MslGeneratorImplTest, Runtime_Frexp_Vector_f16) { TEST_F(MslGeneratorImplTest, Runtime_Frexp_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Var("f", Expr(vec3<f16>())), // WrapInFunction(Var("f", Expr(vec3<f16>())), //
Var("v", Call("frexp", "f"))); Var("v", Call("frexp", "f")));
@ -768,7 +768,7 @@ kernel void test_function() {
} }
TEST_F(MslGeneratorImplTest, Const_Frexp_Scalar_f16) { TEST_F(MslGeneratorImplTest, Const_Frexp_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Decl(Let("v", Call("frexp", 1_h)))); WrapInFunction(Decl(Let("v", Call("frexp", 1_h))));
@ -814,7 +814,7 @@ kernel void test_function() {
} }
TEST_F(MslGeneratorImplTest, Const_Frexp_Vector_f16) { TEST_F(MslGeneratorImplTest, Const_Frexp_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Decl(Let("v", Call("frexp", vec3<f16>())))); WrapInFunction(Decl(Let("v", Call("frexp", vec3<f16>()))));
@ -888,7 +888,7 @@ kernel void test_function() {
} }
TEST_F(MslGeneratorImplTest, Degrees_Scalar_f16) { TEST_F(MslGeneratorImplTest, Degrees_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* val = Var("val", ty.f16()); auto* val = Var("val", ty.f16());
auto* call = Call("degrees", val); auto* call = Call("degrees", val);
@ -915,7 +915,7 @@ kernel void test_function() {
} }
TEST_F(MslGeneratorImplTest, Degrees_Vector_f16) { TEST_F(MslGeneratorImplTest, Degrees_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* val = Var("val", ty.vec3<f16>()); auto* val = Var("val", ty.vec3<f16>());
auto* call = Call("degrees", val); auto* call = Call("degrees", val);
@ -992,7 +992,7 @@ kernel void test_function() {
} }
TEST_F(MslGeneratorImplTest, Radians_Scalar_f16) { TEST_F(MslGeneratorImplTest, Radians_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* val = Var("val", ty.f16()); auto* val = Var("val", ty.f16());
auto* call = Call("radians", val); auto* call = Call("radians", val);
@ -1019,7 +1019,7 @@ kernel void test_function() {
} }
TEST_F(MslGeneratorImplTest, Radians_Vector_f16) { TEST_F(MslGeneratorImplTest, Radians_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* val = Var("val", ty.vec3<f16>()); auto* val = Var("val", ty.vec3<f16>());
auto* call = Call("radians", val); auto* call = Call("radians", val);

View File

@ -62,7 +62,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Float) {
} }
TEST_F(MslGeneratorImplTest, EmitInitializer_F16) { TEST_F(MslGeneratorImplTest, EmitInitializer_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
// Use a number close to 1<<16 but whose decimal representation ends in 0. // Use a number close to 1<<16 but whose decimal representation ends in 0.
WrapInFunction(Expr(f16((1 << 15) - 8))); WrapInFunction(Expr(f16((1 << 15) - 8)));
@ -83,7 +83,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Float) {
} }
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_F16) { TEST_F(MslGeneratorImplTest, EmitInitializer_Type_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Call<f16>(-1.2e-3_h)); WrapInFunction(Call<f16>(-1.2e-3_h));
@ -130,7 +130,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_F32) {
} }
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_F16) { TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(vec3<f16>(1_h, 2_h, 3_h)); WrapInFunction(vec3<f16>(1_h, 2_h, 3_h));
@ -150,7 +150,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_Empty_F32) {
} }
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_Empty_F16) { TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_Empty_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(vec3<f16>()); WrapInFunction(vec3<f16>());
@ -170,7 +170,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_F32_Literal)
} }
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_F16_Literal) { TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_F16_Literal) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(vec3<f16>(2_h)); WrapInFunction(vec3<f16>(2_h));
@ -193,7 +193,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_F32_Var) {
} }
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_F16_Var) { TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_F16_Var) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Var("v", Expr(2_h)); auto* var = Var("v", Expr(2_h));
auto* cast = vec3<f16>(var); auto* cast = vec3<f16>(var);
@ -245,7 +245,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_F32) {
} }
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_F16) { TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(mat2x3<f16>(vec3<f16>(1_h, 2_h, 3_h), vec3<f16>(3_h, 4_h, 5_h))); WrapInFunction(mat2x3<f16>(vec3<f16>(1_h, 2_h, 3_h), vec3<f16>(3_h, 4_h, 5_h)));
@ -291,7 +291,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Complex_F16) {
// vec4<f16>(7.0h), // vec4<f16>(7.0h),
// vec4<f16>(vec4<f16>(42.0h, 21.0h, 6.0h, -5.0h)), // vec4<f16>(vec4<f16>(42.0h, 21.0h, 6.0h, -5.0h)),
// ); // );
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* vector_literal = auto* vector_literal =
vec4<f16>(Expr(f16(2.0)), Expr(f16(3.0)), Expr(f16(4.0)), Expr(f16(8.0))); vec4<f16>(Expr(f16(2.0)), Expr(f16(3.0)), Expr(f16(4.0)), Expr(f16(8.0)));
@ -325,7 +325,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Empty_F32) {
} }
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Empty_F16) { TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Empty_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(mat2x3<f16>()); WrapInFunction(mat2x3<f16>());
@ -361,7 +361,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Identity_F16) {
// var m_2: mat4x4<f16> = mat4x4<f16>(m_1); // var m_2: mat4x4<f16> = mat4x4<f16>(m_1);
// } // }
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* m_1 = Var("m_1", ty.mat4x4(ty.f16()), mat4x4<f16>()); auto* m_1 = Var("m_1", ty.mat4x4(ty.f16()), mat4x4<f16>());
auto* m_2 = Var("m_2", ty.mat4x4(ty.f16()), mat4x4<f16>(m_1)); auto* m_2 = Var("m_2", ty.mat4x4(ty.f16()), mat4x4<f16>(m_1));

View File

@ -113,7 +113,7 @@ void f() {
} }
TEST_F(MslGeneratorImplTest, Emit_GlobalConst_f16) { TEST_F(MslGeneratorImplTest, Emit_GlobalConst_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = GlobalConst("G", Expr(1_h)); auto* var = GlobalConst("G", Expr(1_h));
Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
@ -187,7 +187,7 @@ void f() {
} }
TEST_F(MslGeneratorImplTest, Emit_GlobalConst_vec3_f16) { TEST_F(MslGeneratorImplTest, Emit_GlobalConst_vec3_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = GlobalConst("G", vec3<f16>(1_h, 2_h, 3_h)); auto* var = GlobalConst("G", vec3<f16>(1_h, 2_h, 3_h));
Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});
@ -243,7 +243,7 @@ void f() {
} }
TEST_F(MslGeneratorImplTest, Emit_GlobalConst_mat2x3_f16) { TEST_F(MslGeneratorImplTest, Emit_GlobalConst_mat2x3_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = GlobalConst("G", mat2x3<f16>(1_h, 2_h, 3_h, 4_h, 5_h, 6_h)); auto* var = GlobalConst("G", mat2x3<f16>(1_h, 2_h, 3_h, 4_h, 5_h, 6_h));
Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))});

View File

@ -32,7 +32,7 @@ TEST_F(MslGeneratorImplTest, InvalidProgram) {
} }
TEST_F(MslGeneratorImplTest, UnsupportedExtension) { TEST_F(MslGeneratorImplTest, UnsupportedExtension) {
Enable(Source{{12, 34}}, ast::Extension::kUndefined); Enable(Source{{12, 34}}, builtin::Extension::kUndefined);
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();

View File

@ -155,7 +155,7 @@ void f() {
} }
TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const_f16) { TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* C = Const("C", Expr(1_h)); auto* C = Const("C", Expr(1_h));
Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))}); Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))});
@ -229,7 +229,7 @@ void f() {
} }
TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const_vec3_f16) { TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const_vec3_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* C = Const("C", vec3<f16>(1_h, 2_h, 3_h)); auto* C = Const("C", vec3<f16>(1_h, 2_h, 3_h));
Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))}); Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))});
@ -285,7 +285,7 @@ void f() {
} }
TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const_mat2x3_f16) { TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const_mat2x3_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* C = Const("C", mat2x3<f16>(1_h, 2_h, 3_h, 4_h, 5_h, 6_h)); auto* C = Const("C", mat2x3<f16>(1_h, 2_h, 3_h, 4_h, 5_h, 6_h));
Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))}); Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))});
@ -415,7 +415,7 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Vector_f32) {
} }
TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Vector_f16) { TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Var("a", ty.vec2<f16>()); auto* var = Var("a", ty.vec2<f16>());
auto* stmt = Decl(var); auto* stmt = Decl(var);
@ -444,7 +444,7 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Matrix_f32) {
} }
TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Matrix_f16) { TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Matrix_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Var("a", ty.mat3x2<f16>()); auto* var = Var("a", ty.mat3x2<f16>());
@ -473,7 +473,7 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Initializer_ZeroVec_f32)
} }
TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Initializer_ZeroVec_f16) { TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Initializer_ZeroVec_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Var("a", ty.vec3<f16>(), vec3<f16>()); auto* var = Var("a", ty.vec3<f16>(), vec3<f16>());
@ -502,7 +502,7 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Initializer_ZeroMat_f32)
} }
TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Initializer_ZeroMat_f16) { TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Initializer_ZeroMat_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Var("a", ty.mat2x3<f16>(), mat2x3<f16>()); auto* var = Var("a", ty.mat2x3<f16>(), mat2x3<f16>());

View File

@ -265,11 +265,11 @@ Builder::~Builder() = default;
bool Builder::Build() { bool Builder::Build() {
if (!CheckSupportedExtensions("SPIR-V", builder_.AST(), builder_.Diagnostics(), if (!CheckSupportedExtensions("SPIR-V", builder_.AST(), builder_.Diagnostics(),
utils::Vector{ utils::Vector{
ast::Extension::kChromiumDisableUniformityAnalysis, builtin::Extension::kChromiumDisableUniformityAnalysis,
ast::Extension::kChromiumExperimentalDp4A, builtin::Extension::kChromiumExperimentalDp4A,
ast::Extension::kChromiumExperimentalFullPtrParameters, builtin::Extension::kChromiumExperimentalFullPtrParameters,
ast::Extension::kChromiumExperimentalPushConstant, builtin::Extension::kChromiumExperimentalPushConstant,
ast::Extension::kF16, builtin::Extension::kF16,
})) { })) {
error_ = builder_.Diagnostics().str(); error_ = builder_.Diagnostics().str();
return false; return false;
@ -394,14 +394,14 @@ void Builder::push_extension(const char* extension) {
extensions_.push_back(Instruction{spv::Op::OpExtension, {Operand(extension)}}); extensions_.push_back(Instruction{spv::Op::OpExtension, {Operand(extension)}});
} }
bool Builder::GenerateExtension(ast::Extension extension) { bool Builder::GenerateExtension(builtin::Extension extension) {
switch (extension) { switch (extension) {
case ast::Extension::kChromiumExperimentalDp4A: case builtin::Extension::kChromiumExperimentalDp4A:
push_extension("SPV_KHR_integer_dot_product"); push_extension("SPV_KHR_integer_dot_product");
push_capability(SpvCapabilityDotProductKHR); push_capability(SpvCapabilityDotProductKHR);
push_capability(SpvCapabilityDotProductInput4x8BitPackedKHR); push_capability(SpvCapabilityDotProductInput4x8BitPackedKHR);
break; break;
case ast::Extension::kF16: case builtin::Extension::kF16:
push_capability(SpvCapabilityFloat16); push_capability(SpvCapabilityFloat16);
push_capability(SpvCapabilityUniformAndStorageBuffer16BitAccess); push_capability(SpvCapabilityUniformAndStorageBuffer16BitAccess);
push_capability(SpvCapabilityStorageBuffer16BitAccess); push_capability(SpvCapabilityStorageBuffer16BitAccess);

View File

@ -228,7 +228,7 @@ class Builder {
/// not supported. /// not supported.
/// @param ext the extension to generate /// @param ext the extension to generate
/// @returns true on success. /// @returns true on success.
bool GenerateExtension(ast::Extension ext); bool GenerateExtension(builtin::Extension ext);
/// Generates a label for the given id. Emits an error and returns false if /// Generates a label for the given id. Emits an error and returns false if
/// we're currently outside a function. /// we're currently outside a function.
/// @param id the id to use for the label /// @param id the id to use for the label

View File

@ -248,7 +248,7 @@ INSTANTIATE_TEST_SUITE_P(BuilderTest,
using BinaryArithF16Test = TestParamHelper<BinaryData>; using BinaryArithF16Test = TestParamHelper<BinaryData>;
TEST_P(BinaryArithF16Test, Scalar) { TEST_P(BinaryArithF16Test, Scalar) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto param = GetParam(); auto param = GetParam();
@ -273,7 +273,7 @@ TEST_P(BinaryArithF16Test, Scalar) {
} }
TEST_P(BinaryArithF16Test, Vector) { TEST_P(BinaryArithF16Test, Vector) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto param = GetParam(); auto param = GetParam();
@ -543,7 +543,7 @@ INSTANTIATE_TEST_SUITE_P(
using BinaryCompareF16Test = TestParamHelper<BinaryData>; using BinaryCompareF16Test = TestParamHelper<BinaryData>;
TEST_P(BinaryCompareF16Test, Scalar) { TEST_P(BinaryCompareF16Test, Scalar) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto param = GetParam(); auto param = GetParam();
@ -569,7 +569,7 @@ TEST_P(BinaryCompareF16Test, Scalar) {
} }
TEST_P(BinaryCompareF16Test, Vector) { TEST_P(BinaryCompareF16Test, Vector) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto param = GetParam(); auto param = GetParam();
@ -629,7 +629,7 @@ TEST_F(BuilderTest, Binary_Multiply_VectorScalar_F32) {
} }
TEST_F(BuilderTest, Binary_Multiply_VectorScalar_F16) { TEST_F(BuilderTest, Binary_Multiply_VectorScalar_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* lhs = vec3<f16>(1_h, 1_h, 1_h); auto* lhs = vec3<f16>(1_h, 1_h, 1_h);
auto* rhs = Expr(1_h); auto* rhs = Expr(1_h);
@ -677,7 +677,7 @@ TEST_F(BuilderTest, Binary_Multiply_ScalarVector_F32) {
} }
TEST_F(BuilderTest, Binary_Multiply_ScalarVector_F16) { TEST_F(BuilderTest, Binary_Multiply_ScalarVector_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* lhs = Expr(1_h); auto* lhs = Expr(1_h);
auto* rhs = vec3<f16>(1_h, 1_h, 1_h); auto* rhs = vec3<f16>(1_h, 1_h, 1_h);
@ -728,7 +728,7 @@ TEST_F(BuilderTest, Binary_Multiply_MatrixScalar_F32) {
} }
TEST_F(BuilderTest, Binary_Multiply_MatrixScalar_F16) { TEST_F(BuilderTest, Binary_Multiply_MatrixScalar_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Var("mat", ty.mat3x3<f16>()); auto* var = Var("mat", ty.mat3x3<f16>());
auto* expr = create<ast::BinaryExpression>(ast::BinaryOp::kMultiply, Expr("mat"), Expr(1_h)); auto* expr = create<ast::BinaryExpression>(ast::BinaryOp::kMultiply, Expr("mat"), Expr(1_h));
@ -782,7 +782,7 @@ TEST_F(BuilderTest, Binary_Multiply_ScalarMatrix_F32) {
} }
TEST_F(BuilderTest, Binary_Multiply_ScalarMatrix_F16) { TEST_F(BuilderTest, Binary_Multiply_ScalarMatrix_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Var("mat", ty.mat3x3<f16>()); auto* var = Var("mat", ty.mat3x3<f16>());
auto* expr = create<ast::BinaryExpression>(ast::BinaryOp::kMultiply, Expr(1_h), Expr("mat")); auto* expr = create<ast::BinaryExpression>(ast::BinaryOp::kMultiply, Expr(1_h), Expr("mat"));
@ -838,7 +838,7 @@ TEST_F(BuilderTest, Binary_Multiply_MatrixVector_F32) {
} }
TEST_F(BuilderTest, Binary_Multiply_MatrixVector_F16) { TEST_F(BuilderTest, Binary_Multiply_MatrixVector_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Var("mat", ty.mat3x3<f16>()); auto* var = Var("mat", ty.mat3x3<f16>());
auto* rhs = vec3<f16>(1_h, 1_h, 1_h); auto* rhs = vec3<f16>(1_h, 1_h, 1_h);
@ -896,7 +896,7 @@ TEST_F(BuilderTest, Binary_Multiply_VectorMatrix_F32) {
} }
TEST_F(BuilderTest, Binary_Multiply_VectorMatrix_F16) { TEST_F(BuilderTest, Binary_Multiply_VectorMatrix_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Var("mat", ty.mat3x3<f16>()); auto* var = Var("mat", ty.mat3x3<f16>());
auto* lhs = vec3<f16>(1_h, 1_h, 1_h); auto* lhs = vec3<f16>(1_h, 1_h, 1_h);
@ -953,7 +953,7 @@ TEST_F(BuilderTest, Binary_Multiply_MatrixMatrix_F32) {
} }
TEST_F(BuilderTest, Binary_Multiply_MatrixMatrix_F16) { TEST_F(BuilderTest, Binary_Multiply_MatrixMatrix_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Var("mat", ty.mat3x3<f16>()); auto* var = Var("mat", ty.mat3x3<f16>());
auto* expr = create<ast::BinaryExpression>(ast::BinaryOp::kMultiply, Expr("mat"), Expr("mat")); auto* expr = create<ast::BinaryExpression>(ast::BinaryOp::kMultiply, Expr("mat"), Expr("mat"));
@ -1341,7 +1341,7 @@ TEST_P(BinaryArithVectorScalarTest, VectorScalar) {
auto& param = GetParam(); auto& param = GetParam();
if (param.type == Type::f16) { if (param.type == Type::f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
} }
const ast::Expression* lhs = MakeVectorExpr(this, param.type); const ast::Expression* lhs = MakeVectorExpr(this, param.type);
@ -1393,7 +1393,7 @@ TEST_P(BinaryArithVectorScalarTest, ScalarVector) {
auto& param = GetParam(); auto& param = GetParam();
if (param.type == Type::f16) { if (param.type == Type::f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
} }
const ast::Expression* lhs = MakeScalarExpr(this, param.type); const ast::Expression* lhs = MakeScalarExpr(this, param.type);
@ -1473,7 +1473,7 @@ TEST_P(BinaryArithVectorScalarMultiplyTest, VectorScalar) {
auto& param = GetParam(); auto& param = GetParam();
if (param.type == Type::f16) { if (param.type == Type::f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
} }
const ast::Expression* lhs = MakeVectorExpr(this, param.type); const ast::Expression* lhs = MakeVectorExpr(this, param.type);
@ -1521,7 +1521,7 @@ TEST_P(BinaryArithVectorScalarMultiplyTest, ScalarVector) {
auto& param = GetParam(); auto& param = GetParam();
if (param.type == Type::f16) { if (param.type == Type::f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
} }
const ast::Expression* lhs = MakeScalarExpr(this, param.type); const ast::Expression* lhs = MakeScalarExpr(this, param.type);
@ -1636,7 +1636,7 @@ TEST_P(BinaryArithMatrixMatrix, AddOrSubtract) {
auto& param = GetParam(); auto& param = GetParam();
if (param.type == Type::f16) { if (param.type == Type::f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
} }
const ast::Expression* lhs = MakeMat3x4Expr(this, param.type); const ast::Expression* lhs = MakeMat3x4Expr(this, param.type);
@ -1699,7 +1699,7 @@ TEST_P(BinaryArithMatrixMatrixMultiply, Multiply) {
auto& param = GetParam(); auto& param = GetParam();
if (param.type == Type::f16) { if (param.type == Type::f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
} }
const ast::Expression* lhs = MakeMat3x4Expr(this, param.type); const ast::Expression* lhs = MakeMat3x4Expr(this, param.type);

View File

@ -132,7 +132,7 @@ OpFunctionEnd
} }
TEST_F(BuiltinBuilderTest, Call_GLSLMethod_WithLoad_f16) { TEST_F(BuiltinBuilderTest, Call_GLSLMethod_WithLoad_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = GlobalVar("ident", ty.f16(), type::AddressSpace::kPrivate); auto* var = GlobalVar("ident", ty.f16(), type::AddressSpace::kPrivate);
auto* expr = Call("round", "ident"); auto* expr = Call("round", "ident");
@ -516,7 +516,7 @@ OpFunctionEnd
} }
TEST_P(Builtin_Builder_SingleParam_Float_Test, Call_Scalar_f16) { TEST_P(Builtin_Builder_SingleParam_Float_Test, Call_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto param = GetParam(); auto param = GetParam();
// Use a variable to prevent the function being evaluated as constant. // Use a variable to prevent the function being evaluated as constant.
@ -599,7 +599,7 @@ OpFunctionEnd
} }
TEST_P(Builtin_Builder_SingleParam_Float_Test, Call_Vector_f16) { TEST_P(Builtin_Builder_SingleParam_Float_Test, Call_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto param = GetParam(); auto param = GetParam();
@ -705,7 +705,7 @@ OpFunctionEnd
} }
TEST_F(BuiltinBuilderTest, Call_Length_Scalar_f16) { TEST_F(BuiltinBuilderTest, Call_Length_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* scalar = Var("a", Expr(1_h)); auto* scalar = Var("a", Expr(1_h));
auto* expr = Call("length", scalar); auto* expr = Call("length", scalar);
@ -779,7 +779,7 @@ OpFunctionEnd
} }
TEST_F(BuiltinBuilderTest, Call_Length_Vector_f16) { TEST_F(BuiltinBuilderTest, Call_Length_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* vec = Var("a", vec2<f16>(1_h, 1_h)); auto* vec = Var("a", vec2<f16>(1_h, 1_h));
auto* expr = Call("length", vec); auto* expr = Call("length", vec);
@ -855,7 +855,7 @@ OpFunctionEnd
} }
TEST_F(BuiltinBuilderTest, Call_Normalize_f16) { TEST_F(BuiltinBuilderTest, Call_Normalize_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* vec = Var("a", vec2<f16>(1_h, 1_h)); auto* vec = Var("a", vec2<f16>(1_h, 1_h));
auto* expr = Call("normalize", vec); auto* expr = Call("normalize", vec);
@ -934,7 +934,7 @@ OpFunctionEnd
} }
TEST_P(Builtin_Builder_DualParam_Float_Test, Call_Scalar_f16) { TEST_P(Builtin_Builder_DualParam_Float_Test, Call_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto param = GetParam(); auto param = GetParam();
auto* scalar = Var("scalar", Expr(1_h)); auto* scalar = Var("scalar", Expr(1_h));
@ -1016,7 +1016,7 @@ OpFunctionEnd
} }
TEST_P(Builtin_Builder_DualParam_Float_Test, Call_Vector_f16) { TEST_P(Builtin_Builder_DualParam_Float_Test, Call_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto param = GetParam(); auto param = GetParam();
auto* vec = Var("vec", vec2<f16>(1_h, 1_h)); auto* vec = Var("vec", vec2<f16>(1_h, 1_h));
@ -1105,7 +1105,7 @@ OpFunctionEnd
} }
TEST_F(BuiltinBuilderTest, Call_Reflect_Vector_f16) { TEST_F(BuiltinBuilderTest, Call_Reflect_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* vec = Var("vec", vec2<f16>(1_h, 1_h)); auto* vec = Var("vec", vec2<f16>(1_h, 1_h));
auto* expr = Call("reflect", vec, vec); auto* expr = Call("reflect", vec, vec);
@ -1181,7 +1181,7 @@ OpFunctionEnd
} }
TEST_F(BuiltinBuilderTest, Call_Distance_Scalar_f16) { TEST_F(BuiltinBuilderTest, Call_Distance_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* scalar = Var("scalar", Expr(1_h)); auto* scalar = Var("scalar", Expr(1_h));
auto* expr = Call("distance", scalar, scalar); auto* expr = Call("distance", scalar, scalar);
@ -1257,7 +1257,7 @@ OpFunctionEnd
} }
TEST_F(BuiltinBuilderTest, Call_Distance_Vector_f16) { TEST_F(BuiltinBuilderTest, Call_Distance_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* vec = Var("vec", vec2<f16>(1_h, 1_h)); auto* vec = Var("vec", vec2<f16>(1_h, 1_h));
auto* expr = Call("distance", vec, vec); auto* expr = Call("distance", vec, vec);
@ -1335,7 +1335,7 @@ OpFunctionEnd
} }
TEST_F(BuiltinBuilderTest, Call_Cross_f16) { TEST_F(BuiltinBuilderTest, Call_Cross_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* vec = Var("vec", vec3<f16>(1_h, 1_h, 1_h)); auto* vec = Var("vec", vec3<f16>(1_h, 1_h, 1_h));
auto* expr = Call("cross", vec, vec); auto* expr = Call("cross", vec, vec);
@ -1416,7 +1416,7 @@ OpFunctionEnd
} }
TEST_P(Builtin_Builder_ThreeParam_Float_Test, Call_Scalar_f16) { TEST_P(Builtin_Builder_ThreeParam_Float_Test, Call_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto param = GetParam(); auto param = GetParam();
auto* scalar = Var("scalar", Expr(1_h)); auto* scalar = Var("scalar", Expr(1_h));
@ -1500,7 +1500,7 @@ OpFunctionEnd
} }
TEST_P(Builtin_Builder_ThreeParam_Float_Test, Call_Vector_f16) { TEST_P(Builtin_Builder_ThreeParam_Float_Test, Call_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto param = GetParam(); auto param = GetParam();
auto* vec = Var("vec", vec2<f16>(1_h, 1_h)); auto* vec = Var("vec", vec2<f16>(1_h, 1_h));
@ -1591,7 +1591,7 @@ OpFunctionEnd
} }
TEST_F(BuiltinBuilderTest, Call_FaceForward_Vector_f16) { TEST_F(BuiltinBuilderTest, Call_FaceForward_Vector_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* vec = Var("vec", vec2<f16>(1_h, 1_h)); auto* vec = Var("vec", vec2<f16>(1_h, 1_h));
auto* expr = Call("faceForward", vec, vec, vec); auto* expr = Call("faceForward", vec, vec, vec);
@ -1684,7 +1684,7 @@ OpFunctionEnd
} }
TEST_F(BuiltinBuilderTest, Runtime_Call_Modf_f16) { TEST_F(BuiltinBuilderTest, Runtime_Call_Modf_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* vec = Var("vec", vec2<f16>(1_h, 2_h)); auto* vec = Var("vec", vec2<f16>(1_h, 2_h));
auto* expr = Call("modf", vec); auto* expr = Call("modf", vec);
@ -1786,7 +1786,7 @@ OpFunctionEnd
} }
TEST_F(BuiltinBuilderTest, Const_Call_Modf_f16) { TEST_F(BuiltinBuilderTest, Const_Call_Modf_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* expr = Call("modf", vec2<f16>(1_h, 2_h)); auto* expr = Call("modf", vec2<f16>(1_h, 2_h));
Func("a_func", utils::Empty, ty.void_(), Func("a_func", utils::Empty, ty.void_(),
@ -1890,7 +1890,7 @@ OpFunctionEnd
} }
TEST_F(BuiltinBuilderTest, Runtime_Call_Frexp_f16) { TEST_F(BuiltinBuilderTest, Runtime_Call_Frexp_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* vec = Var("vec", vec2<f16>(1_h, 2_h)); auto* vec = Var("vec", vec2<f16>(1_h, 2_h));
auto* expr = Call("frexp", vec); auto* expr = Call("frexp", vec);
@ -1995,7 +1995,7 @@ OpFunctionEnd
} }
TEST_F(BuiltinBuilderTest, Const_Call_Frexp_f16) { TEST_F(BuiltinBuilderTest, Const_Call_Frexp_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
Func("a_func", utils::Empty, ty.void_(), Func("a_func", utils::Empty, ty.void_(),
utils::Vector{ utils::Vector{
@ -3149,7 +3149,7 @@ OpFunctionEnd
} }
TEST_F(BuiltinBuilderTest, Call_Determinant_f16) { TEST_F(BuiltinBuilderTest, Call_Determinant_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = GlobalVar("var", ty.mat3x3<f16>(), type::AddressSpace::kPrivate); auto* var = GlobalVar("var", ty.mat3x3<f16>(), type::AddressSpace::kPrivate);
auto* expr = Call("determinant", "var"); auto* expr = Call("determinant", "var");
@ -3222,7 +3222,7 @@ OpFunctionEnd
} }
TEST_F(BuiltinBuilderTest, Call_Transpose_f16) { TEST_F(BuiltinBuilderTest, Call_Transpose_f16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = GlobalVar("var", ty.mat2x3<f16>(), type::AddressSpace::kPrivate); auto* var = GlobalVar("var", ty.mat2x3<f16>(), type::AddressSpace::kPrivate);
auto* expr = Call("transpose", "var"); auto* expr = Call("transpose", "var");
@ -3294,7 +3294,7 @@ OpReturn
} }
TEST_F(BuiltinBuilderTest, Call_Dot_F16) { TEST_F(BuiltinBuilderTest, Call_Dot_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = GlobalVar("v", ty.vec3<f16>(), type::AddressSpace::kPrivate); auto* var = GlobalVar("v", ty.vec3<f16>(), type::AddressSpace::kPrivate);
auto* expr = Call("dot", "v", "v"); auto* expr = Call("dot", "v", "v");
@ -4153,7 +4153,7 @@ namespace DP4A_builtin_tests {
TEST_F(BuiltinBuilderTest, Call_Dot4I8Packed) { TEST_F(BuiltinBuilderTest, Call_Dot4I8Packed) {
auto* ext = auto* ext =
create<ast::Enable>(Source{Source::Range{Source::Location{10, 2}, Source::Location{10, 5}}}, create<ast::Enable>(Source{Source::Range{Source::Location{10, 2}, Source::Location{10, 5}}},
ast::Extension::kChromiumExperimentalDp4A); builtin::Extension::kChromiumExperimentalDp4A);
AST().AddEnable(ext); AST().AddEnable(ext);
auto* val1 = Var("val1", ty.u32()); auto* val1 = Var("val1", ty.u32());
@ -4193,7 +4193,7 @@ OpFunctionEnd
TEST_F(BuiltinBuilderTest, Call_Dot4U8Packed) { TEST_F(BuiltinBuilderTest, Call_Dot4U8Packed) {
auto* ext = auto* ext =
create<ast::Enable>(Source{Source::Range{Source::Location{10, 2}, Source::Location{10, 5}}}, create<ast::Enable>(Source{Source::Range{Source::Location{10, 2}, Source::Location{10, 5}}},
ast::Extension::kChromiumExperimentalDp4A); builtin::Extension::kChromiumExperimentalDp4A);
AST().AddEnable(ext); AST().AddEnable(ext);
auto* val1 = Var("val1", ty.u32()); auto* val1 = Var("val1", ty.u32());

View File

@ -119,7 +119,7 @@ TEST_F(BuilderTest, GlobalConst_Vec_Initializer) {
TEST_F(BuilderTest, GlobalConst_Vec_F16_Initializer) { TEST_F(BuilderTest, GlobalConst_Vec_F16_Initializer) {
// const c = vec3<f16>(1h, 2h, 3h); // const c = vec3<f16>(1h, 2h, 3h);
// var v = c; // var v = c;
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* c = GlobalConst("c", vec3<f16>(1_h, 2_h, 3_h)); auto* c = GlobalConst("c", vec3<f16>(1_h, 2_h, 3_h));
GlobalVar("v", type::AddressSpace::kPrivate, Expr(c)); GlobalVar("v", type::AddressSpace::kPrivate, Expr(c));

View File

@ -213,7 +213,7 @@ TEST_F(SpvBuilderInitializerTest, Type_F32_With_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_F16_With_F16) { TEST_F(SpvBuilderInitializerTest, Type_F16_With_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = Call<f16>(2_h); auto* cast = Call<f16>(2_h);
WrapInFunction(cast); WrapInFunction(cast);
@ -288,7 +288,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec2_With_F32_Literal) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec2_With_F16_Literal) { TEST_F(SpvBuilderInitializerTest, Type_Vec2_With_F16_Literal) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec2<f16>(2_h); auto* cast = vec2<f16>(2_h);
WrapInFunction(cast); WrapInFunction(cast);
@ -332,7 +332,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec2_With_F32_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec2_With_F16_F16) { TEST_F(SpvBuilderInitializerTest, Type_Vec2_With_F16_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.f16(), Expr(2_h))); auto* var = Decl(Var("x", ty.f16(), Expr(2_h)));
auto* cast = vec2<f16>("x", "x"); auto* cast = vec2<f16>("x", "x");
@ -377,7 +377,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec2_With_F32_F32_Const) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec2_With_F16_F16_Const) { TEST_F(SpvBuilderInitializerTest, Type_Vec2_With_F16_F16_Const) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec2<f16>(1_h, 2_h); auto* cast = vec2<f16>(1_h, 2_h);
WrapInFunction(cast); WrapInFunction(cast);
@ -422,7 +422,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec2_F32_With_Vec2) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec2_F16_With_Vec2) { TEST_F(SpvBuilderInitializerTest, Type_Vec2_F16_With_Vec2) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.vec2<f16>(), vec2<f16>(1_h, 2_h))); auto* var = Decl(Var("x", ty.vec2<f16>(), vec2<f16>(1_h, 2_h)));
auto* cast = vec2<f16>("x"); auto* cast = vec2<f16>("x");
@ -467,7 +467,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec2_F32_With_Vec2_Const) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec2_F16_With_Vec2_Const) { TEST_F(SpvBuilderInitializerTest, Type_Vec2_F16_With_Vec2_Const) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec2<f16>(vec2<f16>(1_h, 2_h)); auto* cast = vec2<f16>(vec2<f16>(1_h, 2_h));
WrapInFunction(cast); WrapInFunction(cast);
@ -513,7 +513,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F16) { TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.f16(), Expr(2_h))); auto* var = Decl(Var("x", ty.f16(), Expr(2_h)));
auto* cast = vec3<f16>("x", "x", "x"); auto* cast = vec3<f16>("x", "x", "x");
@ -560,7 +560,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F32_Const) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F16_Const) { TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F16_Const) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(1_h, 2_h, 3_h); auto* cast = vec3<f16>(1_h, 2_h, 3_h);
WrapInFunction(cast); WrapInFunction(cast);
@ -651,7 +651,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F32_F32_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F16_F16_F16) { TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F16_F16_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.f16(), Expr(2_h))); auto* var = Decl(Var("x", ty.f16(), Expr(2_h)));
auto* cast = vec3<f16>("x", "x", "x"); auto* cast = vec3<f16>("x", "x", "x");
@ -698,7 +698,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F32_F32_F32_Const) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F16_F16_F16_Const) { TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F16_F16_F16_Const) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(1_h, 2_h, 3_h); auto* cast = vec3<f16>(1_h, 2_h, 3_h);
WrapInFunction(cast); WrapInFunction(cast);
@ -749,7 +749,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F32_Vec2) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F16_Vec2) { TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F16_Vec2) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.vec2<f16>(), vec2<f16>(2_h, 3_h))); auto* var = Decl(Var("x", ty.vec2<f16>(), vec2<f16>(2_h, 3_h)));
auto* cast = vec3<f16>(1_h, "x"); auto* cast = vec3<f16>(1_h, "x");
@ -800,7 +800,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F32_Vec2_Const) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F16_Vec2_Const) { TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F16_Vec2_Const) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(1_h, vec2<f16>(2_h, 3_h)); auto* cast = vec3<f16>(1_h, vec2<f16>(2_h, 3_h));
WrapInFunction(cast); WrapInFunction(cast);
@ -851,7 +851,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_Vec2_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_Vec2_F16) { TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_Vec2_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.vec2<f16>(), vec2<f16>(1_h, 2_h))); auto* var = Decl(Var("x", ty.vec2<f16>(), vec2<f16>(1_h, 2_h)));
auto* cast = vec3<f16>("x", 3_h); auto* cast = vec3<f16>("x", 3_h);
@ -902,7 +902,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_Vec2_F32_Const) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_Vec2_F16_Const) { TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_Vec2_F16_Const) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(vec2<f16>(1_h, 2_h), 3_h); auto* cast = vec3<f16>(vec2<f16>(1_h, 2_h), 3_h);
WrapInFunction(cast); WrapInFunction(cast);
@ -949,7 +949,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec3_F32_With_Vec3) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec3_F16_With_Vec3) { TEST_F(SpvBuilderInitializerTest, Type_Vec3_F16_With_Vec3) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.vec3<f16>(), vec3<f16>(1_h, 2_h, 3_h))); auto* var = Decl(Var("x", ty.vec3<f16>(), vec3<f16>(1_h, 2_h, 3_h)));
auto* cast = vec3<f16>("x"); auto* cast = vec3<f16>("x");
@ -996,7 +996,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec3_F32_With_Vec3_Const) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec3_F16_With_Vec3_Const) { TEST_F(SpvBuilderInitializerTest, Type_Vec3_F16_With_Vec3_Const) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(vec3<f16>(1_h, 2_h, 3_h)); auto* cast = vec3<f16>(vec3<f16>(1_h, 2_h, 3_h));
WrapInFunction(cast); WrapInFunction(cast);
@ -1082,7 +1082,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16) { TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.f16(), Expr(2_h))); auto* var = Decl(Var("x", ty.f16(), Expr(2_h)));
auto* cast = vec4<f16>("x"); auto* cast = vec4<f16>("x");
@ -1125,7 +1125,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_Const) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_Const) { TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_Const) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(2_h); auto* cast = vec4<f16>(2_h);
WrapInFunction(cast); WrapInFunction(cast);
@ -1171,7 +1171,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_F32_F32_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_F16_F16_F16) { TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_F16_F16_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.f16(), Expr(2_h))); auto* var = Decl(Var("x", ty.f16(), Expr(2_h)));
auto* cast = vec4<f16>("x", "x", "x", "x"); auto* cast = vec4<f16>("x", "x", "x", "x");
@ -1220,7 +1220,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_F32_F32_F32_Const) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_F16_F16_F16_Const) { TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_F16_F16_F16_Const) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(1_h, 2_h, 3_h, 4_h); auto* cast = vec4<f16>(1_h, 2_h, 3_h, 4_h);
WrapInFunction(cast); WrapInFunction(cast);
@ -1271,7 +1271,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_F32_Vec2) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_F16_Vec2) { TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_F16_Vec2) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.vec2<f16>(), vec2<f16>(1_h, 2_h))); auto* var = Decl(Var("x", ty.vec2<f16>(), vec2<f16>(1_h, 2_h)));
auto* cast = vec4<f16>(1_h, 2_h, "x"); auto* cast = vec4<f16>(1_h, 2_h, "x");
@ -1322,7 +1322,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_F32_Vec2_Const) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_F16_Vec2_Const) { TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_F16_Vec2_Const) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(1_h, 2_h, vec2<f16>(3_h, 4_h)); auto* cast = vec4<f16>(1_h, 2_h, vec2<f16>(3_h, 4_h));
WrapInFunction(cast); WrapInFunction(cast);
@ -1375,7 +1375,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_Vec2_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_Vec2_F16) { TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_Vec2_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.vec2<f16>(), vec2<f16>(2_h, 3_h))); auto* var = Decl(Var("x", ty.vec2<f16>(), vec2<f16>(2_h, 3_h)));
auto* cast = vec4<f16>(1_h, "x", 4_h); auto* cast = vec4<f16>(1_h, "x", 4_h);
@ -1428,7 +1428,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_Vec2_F32_Const) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_Vec2_F16_Const) { TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_Vec2_F16_Const) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(1_h, vec2<f16>(2_h, 3_h), 4_h); auto* cast = vec4<f16>(1_h, vec2<f16>(2_h, 3_h), 4_h);
WrapInFunction(cast); WrapInFunction(cast);
@ -1481,7 +1481,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec2_F32_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec2_F16_F16) { TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec2_F16_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.vec2<f16>(), vec2<f16>(1_h, 2_h))); auto* var = Decl(Var("x", ty.vec2<f16>(), vec2<f16>(1_h, 2_h)));
auto* cast = vec4<f16>("x", 3_h, 4_h); auto* cast = vec4<f16>("x", 3_h, 4_h);
@ -1534,7 +1534,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec2_F32_F32_Const) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec2_F16_F16_Const) { TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec2_F16_F16_Const) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(vec2<f16>(1_h, 2_h), 3_h, 4_h); auto* cast = vec4<f16>(vec2<f16>(1_h, 2_h), 3_h, 4_h);
WrapInFunction(cast); WrapInFunction(cast);
@ -1588,7 +1588,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_F32_With_Vec2_Vec2) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec4_F16_With_Vec2_Vec2) { TEST_F(SpvBuilderInitializerTest, Type_Vec4_F16_With_Vec2_Vec2) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.vec2<f16>(), vec2<f16>(1_h, 2_h))); auto* var = Decl(Var("x", ty.vec2<f16>(), vec2<f16>(1_h, 2_h)));
auto* cast = vec4<f16>("x", "x"); auto* cast = vec4<f16>("x", "x");
@ -1640,7 +1640,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_F32_With_Vec2_Vec2_Const) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec4_F16_With_Vec2_Vec2_Const) { TEST_F(SpvBuilderInitializerTest, Type_Vec4_F16_With_Vec2_Vec2_Const) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(vec2<f16>(1_h, 2_h), vec2<f16>(1_h, 2_h)); auto* cast = vec4<f16>(vec2<f16>(1_h, 2_h), vec2<f16>(1_h, 2_h));
WrapInFunction(cast); WrapInFunction(cast);
@ -1689,7 +1689,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_Vec3) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_Vec3) { TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_Vec3) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.vec3<f16>(), vec3<f16>(2_h, 2_h, 2_h))); auto* var = Decl(Var("x", ty.vec3<f16>(), vec3<f16>(2_h, 2_h, 2_h)));
auto* cast = vec4<f16>(2_h, "x"); auto* cast = vec4<f16>(2_h, "x");
@ -1737,7 +1737,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_Vec3_Const) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_Vec3_Const) { TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_Vec3_Const) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(2_h, vec3<f16>(2_h, 2_h, 2_h)); auto* cast = vec4<f16>(2_h, vec3<f16>(2_h, 2_h, 2_h));
WrapInFunction(cast); WrapInFunction(cast);
@ -1785,7 +1785,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec3_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec3_F16) { TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec3_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.vec3<f16>(), vec3<f16>(2_h, 2_h, 2_h))); auto* var = Decl(Var("x", ty.vec3<f16>(), vec3<f16>(2_h, 2_h, 2_h)));
auto* cast = vec4<f16>("x", 2_h); auto* cast = vec4<f16>("x", 2_h);
@ -1833,7 +1833,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec3_F32_Const) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec3_F16_Const) { TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec3_F16_Const) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(vec3<f16>(2_h, 2_h, 2_h), 2_h); auto* cast = vec4<f16>(vec3<f16>(2_h, 2_h, 2_h), 2_h);
WrapInFunction(cast); WrapInFunction(cast);
@ -1870,7 +1870,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_F32_With_Vec4) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Vec4_F16_With_Vec4) { TEST_F(SpvBuilderInitializerTest, Type_Vec4_F16_With_Vec4) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* value = vec4<f16>(2_h, 2_h, 2_h, 2_h); auto* value = vec4<f16>(2_h, 2_h, 2_h, 2_h);
auto* cast = vec4<f16>(value); auto* cast = vec4<f16>(value);
@ -1911,7 +1911,7 @@ OpReturn
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_F16_With_F16) { TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_F16_With_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* ctor = Call<f16>(2_h); auto* ctor = Call<f16>(2_h);
GlobalConst("g", ty.f16(), ctor); GlobalConst("g", ty.f16(), ctor);
@ -1951,7 +1951,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_F32_With_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_F16_With_F16) { TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_F16_With_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* ctor = Call<f16>(2_h); auto* ctor = Call<f16>(2_h);
GlobalVar("g", ty.f16(), type::AddressSpace::kPrivate, ctor); GlobalVar("g", ty.f16(), type::AddressSpace::kPrivate, ctor);
@ -1991,7 +1991,7 @@ OpReturn
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_U32_With_F16) { TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_U32_With_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* ctor = Call<u32>(1.5_h); auto* ctor = Call<u32>(1.5_h);
GlobalConst("g", ty.u32(), ctor); GlobalConst("g", ty.u32(), ctor);
@ -2031,7 +2031,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_U32_With_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_U32_With_F16) { TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_U32_With_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* ctor = Call<u32>(1.5_h); auto* ctor = Call<u32>(1.5_h);
GlobalVar("g", ty.u32(), type::AddressSpace::kPrivate, ctor); GlobalVar("g", ty.u32(), type::AddressSpace::kPrivate, ctor);
@ -2073,7 +2073,7 @@ OpReturn
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec2_With_F16) { TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec2_With_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec2<f16>(2_h); auto* cast = vec2<f16>(2_h);
GlobalConst("g", ty.vec2<f16>(), cast); GlobalConst("g", ty.vec2<f16>(), cast);
@ -2114,7 +2114,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec2_With_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec2_With_F16) { TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec2_With_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec2<f16>(2_h); auto* cast = vec2<f16>(2_h);
auto* g = GlobalVar("g", ty.vec2<f16>(), type::AddressSpace::kPrivate, cast); auto* g = GlobalVar("g", ty.vec2<f16>(), type::AddressSpace::kPrivate, cast);
@ -2155,7 +2155,7 @@ OpReturn
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec2_F16_With_Vec2) { TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec2_F16_With_Vec2) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec2<f16>(vec2<f16>(2_h, 2_h)); auto* cast = vec2<f16>(vec2<f16>(2_h, 2_h));
GlobalConst("g", ty.vec2<f16>(), cast); GlobalConst("g", ty.vec2<f16>(), cast);
@ -2200,7 +2200,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec2_F32_With_Vec2) {
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec2_F16_With_Vec2) { TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec2_F16_With_Vec2) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec2<f16>(vec2<f16>(2_h, 2_h)); auto* cast = vec2<f16>(vec2<f16>(2_h, 2_h));
GlobalVar("a", ty.vec2<f16>(), type::AddressSpace::kPrivate, cast); GlobalVar("a", ty.vec2<f16>(), type::AddressSpace::kPrivate, cast);
@ -2245,7 +2245,7 @@ OpReturn
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec3_F16_With_Vec3) { TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec3_F16_With_Vec3) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(vec3<f16>(2_h, 2_h, 2_h)); auto* cast = vec3<f16>(vec3<f16>(2_h, 2_h, 2_h));
GlobalConst("g", ty.vec3<f16>(), cast); GlobalConst("g", ty.vec3<f16>(), cast);
@ -2290,7 +2290,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_F32_With_Vec3) {
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_F16_With_Vec3) { TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_F16_With_Vec3) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(vec3<f16>(2_h, 2_h, 2_h)); auto* cast = vec3<f16>(vec3<f16>(2_h, 2_h, 2_h));
GlobalVar("a", ty.vec3<f16>(), type::AddressSpace::kPrivate, cast); GlobalVar("a", ty.vec3<f16>(), type::AddressSpace::kPrivate, cast);
@ -2335,7 +2335,7 @@ OpReturn
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_F16_With_Vec4) { TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_F16_With_Vec4) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(vec4<f16>(2_h, 2_h, 2_h, 2_h)); auto* cast = vec4<f16>(vec4<f16>(2_h, 2_h, 2_h, 2_h));
GlobalConst("g", ty.vec4<f16>(), cast); GlobalConst("g", ty.vec4<f16>(), cast);
@ -2380,7 +2380,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_F32_With_Vec4) {
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_F16_With_Vec4) { TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_F16_With_Vec4) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(vec4<f16>(2_h, 2_h, 2_h, 2_h)); auto* cast = vec4<f16>(vec4<f16>(2_h, 2_h, 2_h, 2_h));
GlobalVar("a", ty.vec4<f16>(), type::AddressSpace::kPrivate, cast); GlobalVar("a", ty.vec4<f16>(), type::AddressSpace::kPrivate, cast);
@ -2425,7 +2425,7 @@ OpReturn
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec3_With_F16) { TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec3_With_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(2_h); auto* cast = vec3<f16>(2_h);
GlobalConst("g", ty.vec3<f16>(), cast); GlobalConst("g", ty.vec3<f16>(), cast);
@ -2466,7 +2466,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_With_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_With_F16) { TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_With_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(2_h); auto* cast = vec3<f16>(2_h);
auto* g = GlobalVar("g", ty.vec3<f16>(), type::AddressSpace::kPrivate, cast); auto* g = GlobalVar("g", ty.vec3<f16>(), type::AddressSpace::kPrivate, cast);
@ -2507,7 +2507,7 @@ OpReturn
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec3_With_F16_Vec2) { TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec3_With_F16_Vec2) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(2_h, vec2<f16>(2_h, 2_h)); auto* cast = vec3<f16>(2_h, vec2<f16>(2_h, 2_h));
GlobalConst("g", ty.vec3<f16>(), cast); GlobalConst("g", ty.vec3<f16>(), cast);
@ -2548,7 +2548,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_With_F32_Vec2) {
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_With_F16_Vec2) { TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_With_F16_Vec2) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(2_h, vec2<f16>(2_h, 2_h)); auto* cast = vec3<f16>(2_h, vec2<f16>(2_h, 2_h));
auto* g = GlobalVar("g", ty.vec3<f16>(), type::AddressSpace::kPrivate, cast); auto* g = GlobalVar("g", ty.vec3<f16>(), type::AddressSpace::kPrivate, cast);
@ -2589,7 +2589,7 @@ OpReturn
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec3_With_Vec2_F16) { TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec3_With_Vec2_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(vec2<f16>(2_h, 2_h), 2_h); auto* cast = vec3<f16>(vec2<f16>(2_h, 2_h), 2_h);
GlobalConst("g", ty.vec3<f16>(), cast); GlobalConst("g", ty.vec3<f16>(), cast);
@ -2630,7 +2630,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_With_Vec2_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_With_Vec2_F16) { TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_With_Vec2_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(vec2<f16>(2_h, 2_h), 2_h); auto* cast = vec3<f16>(vec2<f16>(2_h, 2_h), 2_h);
auto* g = GlobalVar("g", ty.vec3<f16>(), type::AddressSpace::kPrivate, cast); auto* g = GlobalVar("g", ty.vec3<f16>(), type::AddressSpace::kPrivate, cast);
@ -2671,7 +2671,7 @@ OpReturn
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_With_F16) { TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_With_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(2_h); auto* cast = vec4<f16>(2_h);
GlobalConst("g", ty.vec4<f16>(), cast); GlobalConst("g", ty.vec4<f16>(), cast);
@ -2712,7 +2712,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F16) { TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(2_h); auto* cast = vec4<f16>(2_h);
auto* g = GlobalVar("g", ty.vec4<f16>(), type::AddressSpace::kPrivate, cast); auto* g = GlobalVar("g", ty.vec4<f16>(), type::AddressSpace::kPrivate, cast);
@ -2753,7 +2753,7 @@ OpReturn
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_With_F16_F16_Vec2) { TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_With_F16_F16_Vec2) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(2_h, 2_h, vec2<f16>(2_h, 2_h)); auto* cast = vec4<f16>(2_h, 2_h, vec2<f16>(2_h, 2_h));
GlobalConst("g", ty.vec4<f16>(), cast); GlobalConst("g", ty.vec4<f16>(), cast);
@ -2794,7 +2794,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F32_F32_Vec2) {
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F16_F16_Vec2) { TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F16_F16_Vec2) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(2_h, 2_h, vec2<f16>(2_h, 2_h)); auto* cast = vec4<f16>(2_h, 2_h, vec2<f16>(2_h, 2_h));
auto* g = GlobalVar("g", ty.vec4<f16>(), type::AddressSpace::kPrivate, cast); auto* g = GlobalVar("g", ty.vec4<f16>(), type::AddressSpace::kPrivate, cast);
@ -2835,7 +2835,7 @@ OpReturn
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_With_F16_Vec2_F16) { TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_With_F16_Vec2_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(2_h, vec2<f16>(2_h, 2_h), 2_h); auto* cast = vec4<f16>(2_h, vec2<f16>(2_h, 2_h), 2_h);
GlobalConst("g", ty.vec4<f16>(), cast); GlobalConst("g", ty.vec4<f16>(), cast);
@ -2876,7 +2876,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F32_Vec2_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F16_Vec2_F16) { TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F16_Vec2_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(2_h, vec2<f16>(2_h, 2_h), 2_h); auto* cast = vec4<f16>(2_h, vec2<f16>(2_h, 2_h), 2_h);
auto* g = GlobalVar("g", ty.vec4<f16>(), type::AddressSpace::kPrivate, cast); auto* g = GlobalVar("g", ty.vec4<f16>(), type::AddressSpace::kPrivate, cast);
@ -2917,7 +2917,7 @@ OpReturn
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_With_Vec2_F16_F16) { TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_With_Vec2_F16_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(vec2<f16>(2_h, 2_h), 2_h, 2_h); auto* cast = vec4<f16>(vec2<f16>(2_h, 2_h), 2_h, 2_h);
GlobalConst("g", ty.vec4<f16>(), cast); GlobalConst("g", ty.vec4<f16>(), cast);
@ -2958,7 +2958,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_Vec2_F32_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_Vec2_F16_F16) { TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_Vec2_F16_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(vec2<f16>(2_h, 2_h), 2_h, 2_h); auto* cast = vec4<f16>(vec2<f16>(2_h, 2_h), 2_h, 2_h);
auto* g = GlobalVar("g", ty.vec4<f16>(), type::AddressSpace::kPrivate, cast); auto* g = GlobalVar("g", ty.vec4<f16>(), type::AddressSpace::kPrivate, cast);
@ -2999,7 +2999,7 @@ OpReturn
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_F16_With_Vec2_Vec2) { TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_F16_With_Vec2_Vec2) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(vec2<f16>(2_h, 2_h), vec2<f16>(2_h, 2_h)); auto* cast = vec4<f16>(vec2<f16>(2_h, 2_h), vec2<f16>(2_h, 2_h));
GlobalConst("g", ty.vec4<f16>(), cast); GlobalConst("g", ty.vec4<f16>(), cast);
@ -3040,7 +3040,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_F32_With_Vec2_Vec2) {
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_F16_With_Vec2_Vec2) { TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_F16_With_Vec2_Vec2) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(vec2<f16>(2_h, 2_h), vec2<f16>(2_h, 2_h)); auto* cast = vec4<f16>(vec2<f16>(2_h, 2_h), vec2<f16>(2_h, 2_h));
auto* g = GlobalVar("g", ty.vec4<f16>(), type::AddressSpace::kPrivate, cast); auto* g = GlobalVar("g", ty.vec4<f16>(), type::AddressSpace::kPrivate, cast);
@ -3097,7 +3097,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F32_Vec3) {
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F16_Vec3) { TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F16_Vec3) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(2_h, vec3<f16>(2_h, 2_h, 2_h)); auto* cast = vec4<f16>(2_h, vec3<f16>(2_h, 2_h, 2_h));
auto* g = GlobalVar("g", ty.vec4<f16>(), type::AddressSpace::kPrivate, cast); auto* g = GlobalVar("g", ty.vec4<f16>(), type::AddressSpace::kPrivate, cast);
@ -3138,7 +3138,7 @@ OpReturn
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_With_Vec3_F16) { TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_With_Vec3_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(vec3<f16>(2_h, 2_h, 2_h), 2_h); auto* cast = vec4<f16>(vec3<f16>(2_h, 2_h, 2_h), 2_h);
GlobalConst("g", ty.vec4<f16>(), cast); GlobalConst("g", ty.vec4<f16>(), cast);
@ -3179,7 +3179,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_Vec3_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_Vec3_F16) { TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_Vec3_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec4<f16>(vec3<f16>(2_h, 2_h, 2_h), 2_h); auto* cast = vec4<f16>(vec3<f16>(2_h, 2_h, 2_h), 2_h);
auto* g = GlobalVar("g", ty.vec4<f16>(), type::AddressSpace::kPrivate, cast); auto* g = GlobalVar("g", ty.vec4<f16>(), type::AddressSpace::kPrivate, cast);
@ -3215,7 +3215,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Mat2x2_F32_With_Vec2_Vec2) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Mat2x2_F16_With_Vec2_Vec2) { TEST_F(SpvBuilderInitializerTest, Type_Mat2x2_F16_With_Vec2_Vec2) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = mat2x2<f16>(vec2<f16>(2_h, 2_h), vec2<f16>(2_h, 2_h)); auto* cast = mat2x2<f16>(vec2<f16>(2_h, 2_h), vec2<f16>(2_h, 2_h));
WrapInFunction(cast); WrapInFunction(cast);
@ -3253,7 +3253,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Mat3x2_F32_With_Vec2_Vec2_Vec2) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Mat3x2_F16_With_Vec2_Vec2_Vec2) { TEST_F(SpvBuilderInitializerTest, Type_Mat3x2_F16_With_Vec2_Vec2_Vec2) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = mat3x2<f16>(vec2<f16>(2_h, 2_h), vec2<f16>(2_h, 2_h), vec2<f16>(2_h, 2_h)); auto* cast = mat3x2<f16>(vec2<f16>(2_h, 2_h), vec2<f16>(2_h, 2_h), vec2<f16>(2_h, 2_h));
WrapInFunction(cast); WrapInFunction(cast);
@ -3292,7 +3292,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Mat4x2_F32_With_Vec2_Vec2_Vec2_Vec2) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Mat4x2_F16_With_Vec2_Vec2_Vec2_Vec2) { TEST_F(SpvBuilderInitializerTest, Type_Mat4x2_F16_With_Vec2_Vec2_Vec2_Vec2) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = mat4x2<f16>(vec2<f16>(2_h, 2_h), vec2<f16>(2_h, 2_h), vec2<f16>(2_h, 2_h), auto* cast = mat4x2<f16>(vec2<f16>(2_h, 2_h), vec2<f16>(2_h, 2_h), vec2<f16>(2_h, 2_h),
vec2<f16>(2_h, 2_h)); vec2<f16>(2_h, 2_h));
@ -3331,7 +3331,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Mat2x3_F32_With_Vec3_Vec3) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Mat2x3_F16_With_Vec3_Vec3) { TEST_F(SpvBuilderInitializerTest, Type_Mat2x3_F16_With_Vec3_Vec3) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = mat2x3<f16>(vec3<f16>(2_h, 2_h, 2_h), vec3<f16>(2_h, 2_h, 2_h)); auto* cast = mat2x3<f16>(vec3<f16>(2_h, 2_h, 2_h), vec3<f16>(2_h, 2_h, 2_h));
WrapInFunction(cast); WrapInFunction(cast);
@ -3370,7 +3370,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Mat3x3_F32_With_Vec3_Vec3_Vec3) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Mat3x3_F16_With_Vec3_Vec3_Vec3) { TEST_F(SpvBuilderInitializerTest, Type_Mat3x3_F16_With_Vec3_Vec3_Vec3) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = auto* cast =
mat3x3<f16>(vec3<f16>(2_h, 2_h, 2_h), vec3<f16>(2_h, 2_h, 2_h), vec3<f16>(2_h, 2_h, 2_h)); mat3x3<f16>(vec3<f16>(2_h, 2_h, 2_h), vec3<f16>(2_h, 2_h, 2_h), vec3<f16>(2_h, 2_h, 2_h));
@ -3410,7 +3410,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Mat4x3_F32_With_Vec3_Vec3_Vec3_Vec3) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Mat4x3_F16_With_Vec3_Vec3_Vec3_Vec3) { TEST_F(SpvBuilderInitializerTest, Type_Mat4x3_F16_With_Vec3_Vec3_Vec3_Vec3) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = mat4x3<f16>(vec3<f16>(2_h, 2_h, 2_h), vec3<f16>(2_h, 2_h, 2_h), auto* cast = mat4x3<f16>(vec3<f16>(2_h, 2_h, 2_h), vec3<f16>(2_h, 2_h, 2_h),
vec3<f16>(2_h, 2_h, 2_h), vec3<f16>(2_h, 2_h, 2_h)); vec3<f16>(2_h, 2_h, 2_h), vec3<f16>(2_h, 2_h, 2_h));
@ -3449,7 +3449,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Mat2x4_F32_With_Vec4_Vec4) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Mat2x4_F16_With_Vec4_Vec4) { TEST_F(SpvBuilderInitializerTest, Type_Mat2x4_F16_With_Vec4_Vec4) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = mat2x4<f16>(vec4<f16>(2_h, 2_h, 2_h, 2_h), vec4<f16>(2_h, 2_h, 2_h, 2_h)); auto* cast = mat2x4<f16>(vec4<f16>(2_h, 2_h, 2_h, 2_h), vec4<f16>(2_h, 2_h, 2_h, 2_h));
WrapInFunction(cast); WrapInFunction(cast);
@ -3488,7 +3488,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Mat3x4_F32_With_Vec4_Vec4_Vec4) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Mat3x4_F16_With_Vec4_Vec4_Vec4) { TEST_F(SpvBuilderInitializerTest, Type_Mat3x4_F16_With_Vec4_Vec4_Vec4) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = mat3x4<f16>(vec4<f16>(2_h, 2_h, 2_h, 2_h), vec4<f16>(2_h, 2_h, 2_h, 2_h), auto* cast = mat3x4<f16>(vec4<f16>(2_h, 2_h, 2_h, 2_h), vec4<f16>(2_h, 2_h, 2_h, 2_h),
vec4<f16>(2_h, 2_h, 2_h, 2_h)); vec4<f16>(2_h, 2_h, 2_h, 2_h));
@ -3528,7 +3528,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Mat4x4_F32_With_Vec4_Vec4_Vec4_Vec4) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Mat4x4_F16_With_Vec4_Vec4_Vec4_Vec4) { TEST_F(SpvBuilderInitializerTest, Type_Mat4x4_F16_With_Vec4_Vec4_Vec4_Vec4) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = mat4x4<f16>(vec4<f16>(2_h, 2_h, 2_h, 2_h), vec4<f16>(2_h, 2_h, 2_h, 2_h), auto* cast = mat4x4<f16>(vec4<f16>(2_h, 2_h, 2_h, 2_h), vec4<f16>(2_h, 2_h, 2_h, 2_h),
vec4<f16>(2_h, 2_h, 2_h, 2_h), vec4<f16>(2_h, 2_h, 2_h, 2_h)); vec4<f16>(2_h, 2_h, 2_h, 2_h), vec4<f16>(2_h, 2_h, 2_h, 2_h));
@ -3567,7 +3567,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Array_5_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Array_5_F16) { TEST_F(SpvBuilderInitializerTest, Type_Array_5_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = array<f16, 5>(2_h, 2_h, 2_h, 2_h, 2_h); auto* cast = array<f16, 5>(2_h, 2_h, 2_h, 2_h, 2_h);
WrapInFunction(cast); WrapInFunction(cast);
@ -3609,7 +3609,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Array_2_Vec3_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Array_2_Vec3_F16) { TEST_F(SpvBuilderInitializerTest, Type_Array_2_Vec3_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* first = vec3<f16>(1_h, 2_h, 3_h); auto* first = vec3<f16>(1_h, 2_h, 3_h);
auto* second = vec3<f16>(1_h, 2_h, 3_h); auto* second = vec3<f16>(1_h, 2_h, 3_h);
@ -3738,7 +3738,7 @@ TEST_F(SpvBuilderInitializerTest, Type_ZeroInit_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_ZeroInit_F16) { TEST_F(SpvBuilderInitializerTest, Type_ZeroInit_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* t = Call<f16>(); auto* t = Call<f16>();
@ -3845,7 +3845,7 @@ TEST_F(SpvBuilderInitializerTest, Type_ZeroInit_Matrix_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_ZeroInit_Matrix_F16) { TEST_F(SpvBuilderInitializerTest, Type_ZeroInit_Matrix_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* t = mat4x2<f16>(); auto* t = mat4x2<f16>();
@ -3952,7 +3952,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Convert_F32_To_I32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Convert_F16_To_I32) { TEST_F(SpvBuilderInitializerTest, Type_Convert_F16_To_I32) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.f16(), Expr(2.4_h))); auto* var = Decl(Var("x", ty.f16(), Expr(2.4_h)));
auto* cast = Call<i32>("x"); auto* cast = Call<i32>("x");
@ -4026,7 +4026,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Convert_F32_To_U32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Convert_F16_To_U32) { TEST_F(SpvBuilderInitializerTest, Type_Convert_F16_To_U32) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.f16(), Expr(2.4_h))); auto* var = Decl(Var("x", ty.f16(), Expr(2.4_h)));
auto* cast = Call<u32>("x"); auto* cast = Call<u32>("x");
@ -4100,7 +4100,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Convert_U32_To_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Convert_F16_To_F32) { TEST_F(SpvBuilderInitializerTest, Type_Convert_F16_To_F32) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.f16(), Expr(2_h))); auto* var = Decl(Var("x", ty.f16(), Expr(2_h)));
auto* cast = Call<f32>("x"); auto* cast = Call<f32>("x");
@ -4126,7 +4126,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Convert_F16_To_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Convert_I32_To_F16) { TEST_F(SpvBuilderInitializerTest, Type_Convert_I32_To_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.i32(), Expr(2_i))); auto* var = Decl(Var("x", ty.i32(), Expr(2_i)));
auto* cast = Call<f16>("x"); auto* cast = Call<f16>("x");
@ -4152,7 +4152,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Convert_I32_To_F16) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Convert_U32_To_F16) { TEST_F(SpvBuilderInitializerTest, Type_Convert_U32_To_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.u32(), Expr(2_u))); auto* var = Decl(Var("x", ty.u32(), Expr(2_u)));
auto* cast = Call<f16>("x"); auto* cast = Call<f16>("x");
@ -4178,7 +4178,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Convert_U32_To_F16) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Convert_F32_To_F16) { TEST_F(SpvBuilderInitializerTest, Type_Convert_F32_To_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = Decl(Var("x", ty.f32(), Expr(2_f))); auto* var = Decl(Var("x", ty.f32(), Expr(2_f)));
auto* cast = Call<f16>("x"); auto* cast = Call<f16>("x");
@ -4256,7 +4256,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_F32_to_I32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_F16_to_I32) { TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_F16_to_I32) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = GlobalVar("i", ty.vec3<f16>(), type::AddressSpace::kPrivate); auto* var = GlobalVar("i", ty.vec3<f16>(), type::AddressSpace::kPrivate);
@ -4336,7 +4336,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_F32_to_U32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_F16_to_U32) { TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_F16_to_U32) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = GlobalVar("i", ty.vec3<f16>(), type::AddressSpace::kPrivate); auto* var = GlobalVar("i", ty.vec3<f16>(), type::AddressSpace::kPrivate);
@ -4416,7 +4416,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_U32_to_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_F16_to_F32) { TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_F16_to_F32) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = GlobalVar("i", ty.vec3<f16>(), type::AddressSpace::kPrivate); auto* var = GlobalVar("i", ty.vec3<f16>(), type::AddressSpace::kPrivate);
@ -4444,7 +4444,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_F16_to_F32) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_I32_to_F16) { TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_I32_to_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = GlobalVar("i", ty.vec3<i32>(), type::AddressSpace::kPrivate); auto* var = GlobalVar("i", ty.vec3<i32>(), type::AddressSpace::kPrivate);
@ -4472,7 +4472,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_I32_to_F16) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_U32_to_F16) { TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_U32_to_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = GlobalVar("i", ty.vec3<u32>(), type::AddressSpace::kPrivate); auto* var = GlobalVar("i", ty.vec3<u32>(), type::AddressSpace::kPrivate);
@ -4500,7 +4500,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_U32_to_F16) {
} }
TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_F32_to_F16) { TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_F32_to_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* var = GlobalVar("i", ty.vec3<f32>(), type::AddressSpace::kPrivate); auto* var = GlobalVar("i", ty.vec3<f32>(), type::AddressSpace::kPrivate);

View File

@ -164,7 +164,7 @@ TEST_F(BuilderTest, Literal_F32_Dedup) {
} }
TEST_F(BuilderTest, Literal_F16) { TEST_F(BuilderTest, Literal_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* i = create<ast::FloatLiteralExpression>(23.245, ast::FloatLiteralExpression::Suffix::kH); auto* i = create<ast::FloatLiteralExpression>(23.245, ast::FloatLiteralExpression::Suffix::kH);
WrapInFunction(i); WrapInFunction(i);
@ -181,7 +181,7 @@ TEST_F(BuilderTest, Literal_F16) {
} }
TEST_F(BuilderTest, Literal_F16_Dedup) { TEST_F(BuilderTest, Literal_F16_Dedup) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* i1 = create<ast::FloatLiteralExpression>(23.245, ast::FloatLiteralExpression::Suffix::kH); auto* i1 = create<ast::FloatLiteralExpression>(23.245, ast::FloatLiteralExpression::Suffix::kH);
auto* i2 = create<ast::FloatLiteralExpression>(23.245, ast::FloatLiteralExpression::Suffix::kH); auto* i2 = create<ast::FloatLiteralExpression>(23.245, ast::FloatLiteralExpression::Suffix::kH);

View File

@ -30,7 +30,7 @@ TEST_F(BuilderTest, InvalidProgram) {
} }
TEST_F(BuilderTest, UnsupportedExtension) { TEST_F(BuilderTest, UnsupportedExtension) {
Enable(Source{{12, 34}}, ast::Extension::kUndefined); Enable(Source{{12, 34}}, builtin::Extension::kUndefined);
auto program = std::make_unique<Program>(std::move(*this)); auto program = std::make_unique<Program>(std::move(*this));
auto result = Generate(program.get(), Options{}); auto result = Generate(program.get(), Options{});

View File

@ -320,7 +320,7 @@ TEST_F(BuilderTest_Type, ReturnsGeneratedPtr) {
} }
TEST_F(BuilderTest_Type, GenerateStruct) { TEST_F(BuilderTest_Type, GenerateStruct) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* s = Structure("my_struct", utils::Vector{Member("a", ty.f32()), Member("b", ty.f16())}); auto* s = Structure("my_struct", utils::Vector{Member("a", ty.f32()), Member("b", ty.f16())});
@ -341,7 +341,7 @@ OpMemberName %1 1 "b"
} }
TEST_F(BuilderTest_Type, GenerateStruct_DecoratedMembers) { TEST_F(BuilderTest_Type, GenerateStruct_DecoratedMembers) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* s = Structure("S", utils::Vector{ auto* s = Structure("S", utils::Vector{
Member("a", ty.f32()), Member("a", ty.f32()),
@ -374,7 +374,7 @@ OpMemberDecorate %1 3 Offset 18
} }
TEST_F(BuilderTest_Type, GenerateStruct_DecoratedMembers_Matrix) { TEST_F(BuilderTest_Type, GenerateStruct_DecoratedMembers_Matrix) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* s = auto* s =
Structure("S", utils::Vector{ Structure("S", utils::Vector{
@ -438,7 +438,7 @@ OpMemberDecorate %1 5 MatrixStride 8
} }
TEST_F(BuilderTest_Type, GenerateStruct_DecoratedMembers_ArraysOfMatrix) { TEST_F(BuilderTest_Type, GenerateStruct_DecoratedMembers_ArraysOfMatrix) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto arr_mat2x2_f32 = ty.array(ty.mat2x2<f32>(), 1_u); // Singly nested array auto arr_mat2x2_f32 = ty.array(ty.mat2x2<f32>(), 1_u); // Singly nested array
auto arr_mat2x2_f16 = ty.array(ty.mat2x2<f16>(), 1_u); // Singly nested array auto arr_mat2x2_f16 = ty.array(ty.mat2x2<f16>(), 1_u); // Singly nested array

View File

@ -33,7 +33,7 @@ TEST_F(WgslGeneratorImplTest, EmitExpression_Cast_Scalar_F32_From_I32) {
} }
TEST_F(WgslGeneratorImplTest, EmitExpression_Cast_Scalar_F16_From_I32) { TEST_F(WgslGeneratorImplTest, EmitExpression_Cast_Scalar_F16_From_I32) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = Call<f16>(1_i); auto* cast = Call<f16>(1_i);
WrapInFunction(cast); WrapInFunction(cast);
@ -57,7 +57,7 @@ TEST_F(WgslGeneratorImplTest, EmitExpression_Cast_Vector_F32_From_I32) {
} }
TEST_F(WgslGeneratorImplTest, EmitExpression_Cast_Vector_F16_From_I32) { TEST_F(WgslGeneratorImplTest, EmitExpression_Cast_Vector_F16_From_I32) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* cast = vec3<f16>(vec3<i32>(1_i, 2_i, 3_i)); auto* cast = vec3<f16>(vec3<i32>(1_i, 2_i, 3_i));
WrapInFunction(cast); WrapInFunction(cast);

View File

@ -20,7 +20,7 @@ namespace {
using WgslGeneratorImplTest = TestHelper; using WgslGeneratorImplTest = TestHelper;
TEST_F(WgslGeneratorImplTest, Emit_Enable) { TEST_F(WgslGeneratorImplTest, Emit_Enable) {
auto* enable = Enable(ast::Extension::kF16); auto* enable = Enable(builtin::Extension::kF16);
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();

View File

@ -62,7 +62,7 @@ TEST_F(WgslGeneratorImplTest, EmitInitializer_F32) {
} }
TEST_F(WgslGeneratorImplTest, EmitInitializer_F16) { TEST_F(WgslGeneratorImplTest, EmitInitializer_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
// Use a number close to 1<<16 but whose decimal representation ends in 0. // Use a number close to 1<<16 but whose decimal representation ends in 0.
WrapInFunction(Expr(f16((1 << 15) - 8))); WrapInFunction(Expr(f16((1 << 15) - 8)));
@ -83,7 +83,7 @@ TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_F32) {
} }
TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_F16) { TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(Call<f16>(Expr(-1.2e-5_h))); WrapInFunction(Call<f16>(Expr(-1.2e-5_h)));
@ -130,7 +130,7 @@ TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Vec_F32) {
} }
TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Vec_F16) { TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Vec_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(vec3<f16>(1_h, 2_h, 3_h)); WrapInFunction(vec3<f16>(1_h, 2_h, 3_h));
@ -151,7 +151,7 @@ TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Mat_F32) {
} }
TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Mat_F16) { TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Mat_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
WrapInFunction(mat2x3<f16>(vec3<f16>(1_h, 2_h, 3_h), vec3<f16>(3_h, 4_h, 5_h))); WrapInFunction(mat2x3<f16>(vec3<f16>(1_h, 2_h, 3_h), vec3<f16>(3_h, 4_h, 5_h)));

View File

@ -155,7 +155,7 @@ INSTANTIATE_TEST_SUITE_P(Infinity,
using WgslGenerator_F16LiteralTest = TestParamHelper<F16Data>; using WgslGenerator_F16LiteralTest = TestParamHelper<F16Data>;
TEST_P(WgslGenerator_F16LiteralTest, Emit) { TEST_P(WgslGenerator_F16LiteralTest, Emit) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto* v = Expr(GetParam().value); auto* v = Expr(GetParam().value);

View File

@ -88,7 +88,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_F32) {
} }
TEST_F(WgslGeneratorImplTest, EmitType_F16) { TEST_F(WgslGeneratorImplTest, EmitType_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto type = Alias("make_type_reachable", ty.f16())->type; auto type = Alias("make_type_reachable", ty.f16())->type;
@ -120,7 +120,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_Matrix_F32) {
} }
TEST_F(WgslGeneratorImplTest, EmitType_Matrix_F16) { TEST_F(WgslGeneratorImplTest, EmitType_Matrix_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto type = Alias("make_type_reachable", ty.mat2x3<f16>())->type; auto type = Alias("make_type_reachable", ty.mat2x3<f16>())->type;
@ -305,7 +305,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_Vector_F32) {
} }
TEST_F(WgslGeneratorImplTest, EmitType_Vector_F16) { TEST_F(WgslGeneratorImplTest, EmitType_Vector_F16) {
Enable(ast::Extension::kF16); Enable(builtin::Extension::kF16);
auto type = Alias("make_type_reachable", ty.vec3<f16>())->type; auto type = Alias("make_type_reachable", ty.vec3<f16>())->type;

Some files were not shown because too many files have changed in this diff Show More