tint: Update constructor / conversion terminology
Rename: * "type initializer" -> "value constructor" * "type conversion" -> "value conversion" Fixed: tint:1848 Change-Id: I3e86a4e944971cea970f0d137641517c36cb807d Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121060 Auto-Submit: Ben Clayton <bclayton@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Dan Sinclair <dsinclair@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
cce5f48f0e
commit
54a104e28f
|
@ -249,10 +249,10 @@ libtint_source_set("libtint_program_src") {
|
||||||
"program_builder.cc",
|
"program_builder.cc",
|
||||||
"resolver/const_eval.cc",
|
"resolver/const_eval.cc",
|
||||||
"resolver/const_eval.h",
|
"resolver/const_eval.h",
|
||||||
|
"resolver/ctor_conv_intrinsic.cc",
|
||||||
|
"resolver/ctor_conv_intrinsic.h",
|
||||||
"resolver/dependency_graph.cc",
|
"resolver/dependency_graph.cc",
|
||||||
"resolver/dependency_graph.h",
|
"resolver/dependency_graph.h",
|
||||||
"resolver/init_conv_intrinsic.cc",
|
|
||||||
"resolver/init_conv_intrinsic.h",
|
|
||||||
"resolver/intrinsic_table.cc",
|
"resolver/intrinsic_table.cc",
|
||||||
"resolver/intrinsic_table.h",
|
"resolver/intrinsic_table.h",
|
||||||
"resolver/intrinsic_table.inl",
|
"resolver/intrinsic_table.inl",
|
||||||
|
@ -671,13 +671,13 @@ libtint_source_set("libtint_sem_src") {
|
||||||
"sem/struct.h",
|
"sem/struct.h",
|
||||||
"sem/switch_statement.cc",
|
"sem/switch_statement.cc",
|
||||||
"sem/switch_statement.h",
|
"sem/switch_statement.h",
|
||||||
"sem/type_conversion.cc",
|
|
||||||
"sem/type_conversion.h",
|
|
||||||
"sem/type_expression.cc",
|
"sem/type_expression.cc",
|
||||||
"sem/type_expression.h",
|
"sem/type_expression.h",
|
||||||
"sem/type_initializer.cc",
|
|
||||||
"sem/type_initializer.h",
|
|
||||||
"sem/type_mappings.h",
|
"sem/type_mappings.h",
|
||||||
|
"sem/value_constructor.cc",
|
||||||
|
"sem/value_constructor.h",
|
||||||
|
"sem/value_conversion.cc",
|
||||||
|
"sem/value_conversion.h",
|
||||||
"sem/value_expression.cc",
|
"sem/value_expression.cc",
|
||||||
"sem/value_expression.h",
|
"sem/value_expression.h",
|
||||||
"sem/variable.cc",
|
"sem/variable.cc",
|
||||||
|
@ -1400,12 +1400,12 @@ if (tint_build_unittests) {
|
||||||
"resolver/struct_address_space_use_test.cc",
|
"resolver/struct_address_space_use_test.cc",
|
||||||
"resolver/struct_layout_test.cc",
|
"resolver/struct_layout_test.cc",
|
||||||
"resolver/struct_pipeline_stage_use_test.cc",
|
"resolver/struct_pipeline_stage_use_test.cc",
|
||||||
"resolver/type_initializer_validation_test.cc",
|
|
||||||
"resolver/type_validation_test.cc",
|
"resolver/type_validation_test.cc",
|
||||||
"resolver/uniformity_test.cc",
|
"resolver/uniformity_test.cc",
|
||||||
"resolver/unresolved_identifier_test.cc",
|
"resolver/unresolved_identifier_test.cc",
|
||||||
"resolver/validation_test.cc",
|
"resolver/validation_test.cc",
|
||||||
"resolver/validator_is_storeable_test.cc",
|
"resolver/validator_is_storeable_test.cc",
|
||||||
|
"resolver/value_constructor_validation_test.cc",
|
||||||
"resolver/variable_test.cc",
|
"resolver/variable_test.cc",
|
||||||
"resolver/variable_validation_test.cc",
|
"resolver/variable_validation_test.cc",
|
||||||
]
|
]
|
||||||
|
@ -1639,6 +1639,7 @@ if (tint_build_unittests) {
|
||||||
"writer/spirv/builder_builtin_texture_test.cc",
|
"writer/spirv/builder_builtin_texture_test.cc",
|
||||||
"writer/spirv/builder_call_test.cc",
|
"writer/spirv/builder_call_test.cc",
|
||||||
"writer/spirv/builder_const_assert_test.cc",
|
"writer/spirv/builder_const_assert_test.cc",
|
||||||
|
"writer/spirv/builder_constructor_expression_test.cc",
|
||||||
"writer/spirv/builder_discard_test.cc",
|
"writer/spirv/builder_discard_test.cc",
|
||||||
"writer/spirv/builder_entry_point_test.cc",
|
"writer/spirv/builder_entry_point_test.cc",
|
||||||
"writer/spirv/builder_format_conversion_test.cc",
|
"writer/spirv/builder_format_conversion_test.cc",
|
||||||
|
@ -1648,7 +1649,6 @@ if (tint_build_unittests) {
|
||||||
"writer/spirv/builder_global_variable_test.cc",
|
"writer/spirv/builder_global_variable_test.cc",
|
||||||
"writer/spirv/builder_ident_expression_test.cc",
|
"writer/spirv/builder_ident_expression_test.cc",
|
||||||
"writer/spirv/builder_if_test.cc",
|
"writer/spirv/builder_if_test.cc",
|
||||||
"writer/spirv/builder_initializer_expression_test.cc",
|
|
||||||
"writer/spirv/builder_literal_test.cc",
|
"writer/spirv/builder_literal_test.cc",
|
||||||
"writer/spirv/builder_loop_test.cc",
|
"writer/spirv/builder_loop_test.cc",
|
||||||
"writer/spirv/builder_return_test.cc",
|
"writer/spirv/builder_return_test.cc",
|
||||||
|
@ -1767,6 +1767,7 @@ if (tint_build_unittests) {
|
||||||
"writer/wgsl/generator_impl_case_test.cc",
|
"writer/wgsl/generator_impl_case_test.cc",
|
||||||
"writer/wgsl/generator_impl_cast_test.cc",
|
"writer/wgsl/generator_impl_cast_test.cc",
|
||||||
"writer/wgsl/generator_impl_const_assert_test.cc",
|
"writer/wgsl/generator_impl_const_assert_test.cc",
|
||||||
|
"writer/wgsl/generator_impl_constructor_test.cc",
|
||||||
"writer/wgsl/generator_impl_continue_test.cc",
|
"writer/wgsl/generator_impl_continue_test.cc",
|
||||||
"writer/wgsl/generator_impl_diagnostic_test.cc",
|
"writer/wgsl/generator_impl_diagnostic_test.cc",
|
||||||
"writer/wgsl/generator_impl_discard_test.cc",
|
"writer/wgsl/generator_impl_discard_test.cc",
|
||||||
|
@ -1775,7 +1776,6 @@ if (tint_build_unittests) {
|
||||||
"writer/wgsl/generator_impl_global_decl_test.cc",
|
"writer/wgsl/generator_impl_global_decl_test.cc",
|
||||||
"writer/wgsl/generator_impl_identifier_test.cc",
|
"writer/wgsl/generator_impl_identifier_test.cc",
|
||||||
"writer/wgsl/generator_impl_if_test.cc",
|
"writer/wgsl/generator_impl_if_test.cc",
|
||||||
"writer/wgsl/generator_impl_initializer_test.cc",
|
|
||||||
"writer/wgsl/generator_impl_literal_test.cc",
|
"writer/wgsl/generator_impl_literal_test.cc",
|
||||||
"writer/wgsl/generator_impl_loop_test.cc",
|
"writer/wgsl/generator_impl_loop_test.cc",
|
||||||
"writer/wgsl/generator_impl_member_accessor_test.cc",
|
"writer/wgsl/generator_impl_member_accessor_test.cc",
|
||||||
|
@ -1810,13 +1810,13 @@ if (tint_build_unittests) {
|
||||||
"writer/msl/generator_impl_case_test.cc",
|
"writer/msl/generator_impl_case_test.cc",
|
||||||
"writer/msl/generator_impl_cast_test.cc",
|
"writer/msl/generator_impl_cast_test.cc",
|
||||||
"writer/msl/generator_impl_const_assert_test.cc",
|
"writer/msl/generator_impl_const_assert_test.cc",
|
||||||
|
"writer/msl/generator_impl_constructor_test.cc",
|
||||||
"writer/msl/generator_impl_continue_test.cc",
|
"writer/msl/generator_impl_continue_test.cc",
|
||||||
"writer/msl/generator_impl_discard_test.cc",
|
"writer/msl/generator_impl_discard_test.cc",
|
||||||
"writer/msl/generator_impl_function_test.cc",
|
"writer/msl/generator_impl_function_test.cc",
|
||||||
"writer/msl/generator_impl_identifier_test.cc",
|
"writer/msl/generator_impl_identifier_test.cc",
|
||||||
"writer/msl/generator_impl_if_test.cc",
|
"writer/msl/generator_impl_if_test.cc",
|
||||||
"writer/msl/generator_impl_import_test.cc",
|
"writer/msl/generator_impl_import_test.cc",
|
||||||
"writer/msl/generator_impl_initializer_test.cc",
|
|
||||||
"writer/msl/generator_impl_loop_test.cc",
|
"writer/msl/generator_impl_loop_test.cc",
|
||||||
"writer/msl/generator_impl_member_accessor_test.cc",
|
"writer/msl/generator_impl_member_accessor_test.cc",
|
||||||
"writer/msl/generator_impl_module_constant_test.cc",
|
"writer/msl/generator_impl_module_constant_test.cc",
|
||||||
|
@ -1850,13 +1850,13 @@ if (tint_build_unittests) {
|
||||||
"writer/hlsl/generator_impl_case_test.cc",
|
"writer/hlsl/generator_impl_case_test.cc",
|
||||||
"writer/hlsl/generator_impl_cast_test.cc",
|
"writer/hlsl/generator_impl_cast_test.cc",
|
||||||
"writer/hlsl/generator_impl_const_assert_test.cc",
|
"writer/hlsl/generator_impl_const_assert_test.cc",
|
||||||
|
"writer/hlsl/generator_impl_constructor_test.cc",
|
||||||
"writer/hlsl/generator_impl_continue_test.cc",
|
"writer/hlsl/generator_impl_continue_test.cc",
|
||||||
"writer/hlsl/generator_impl_discard_test.cc",
|
"writer/hlsl/generator_impl_discard_test.cc",
|
||||||
"writer/hlsl/generator_impl_function_test.cc",
|
"writer/hlsl/generator_impl_function_test.cc",
|
||||||
"writer/hlsl/generator_impl_identifier_test.cc",
|
"writer/hlsl/generator_impl_identifier_test.cc",
|
||||||
"writer/hlsl/generator_impl_if_test.cc",
|
"writer/hlsl/generator_impl_if_test.cc",
|
||||||
"writer/hlsl/generator_impl_import_test.cc",
|
"writer/hlsl/generator_impl_import_test.cc",
|
||||||
"writer/hlsl/generator_impl_initializer_test.cc",
|
|
||||||
"writer/hlsl/generator_impl_loop_test.cc",
|
"writer/hlsl/generator_impl_loop_test.cc",
|
||||||
"writer/hlsl/generator_impl_member_accessor_test.cc",
|
"writer/hlsl/generator_impl_member_accessor_test.cc",
|
||||||
"writer/hlsl/generator_impl_module_constant_test.cc",
|
"writer/hlsl/generator_impl_module_constant_test.cc",
|
||||||
|
@ -1891,13 +1891,13 @@ if (tint_build_unittests) {
|
||||||
"writer/glsl/generator_impl_call_test.cc",
|
"writer/glsl/generator_impl_call_test.cc",
|
||||||
"writer/glsl/generator_impl_case_test.cc",
|
"writer/glsl/generator_impl_case_test.cc",
|
||||||
"writer/glsl/generator_impl_cast_test.cc",
|
"writer/glsl/generator_impl_cast_test.cc",
|
||||||
|
"writer/glsl/generator_impl_constructor_test.cc",
|
||||||
"writer/glsl/generator_impl_continue_test.cc",
|
"writer/glsl/generator_impl_continue_test.cc",
|
||||||
"writer/glsl/generator_impl_discard_test.cc",
|
"writer/glsl/generator_impl_discard_test.cc",
|
||||||
"writer/glsl/generator_impl_function_test.cc",
|
"writer/glsl/generator_impl_function_test.cc",
|
||||||
"writer/glsl/generator_impl_identifier_test.cc",
|
"writer/glsl/generator_impl_identifier_test.cc",
|
||||||
"writer/glsl/generator_impl_if_test.cc",
|
"writer/glsl/generator_impl_if_test.cc",
|
||||||
"writer/glsl/generator_impl_import_test.cc",
|
"writer/glsl/generator_impl_import_test.cc",
|
||||||
"writer/glsl/generator_impl_initializer_test.cc",
|
|
||||||
"writer/glsl/generator_impl_loop_test.cc",
|
"writer/glsl/generator_impl_loop_test.cc",
|
||||||
"writer/glsl/generator_impl_member_accessor_test.cc",
|
"writer/glsl/generator_impl_member_accessor_test.cc",
|
||||||
"writer/glsl/generator_impl_module_constant_test.cc",
|
"writer/glsl/generator_impl_module_constant_test.cc",
|
||||||
|
|
|
@ -331,12 +331,12 @@ list(APPEND TINT_LIB_SRCS
|
||||||
sem/switch_statement.h
|
sem/switch_statement.h
|
||||||
sem/type_expression.cc
|
sem/type_expression.cc
|
||||||
sem/type_expression.h
|
sem/type_expression.h
|
||||||
sem/type_initializer.cc
|
|
||||||
sem/type_initializer.h
|
|
||||||
sem/type_conversion.cc
|
|
||||||
sem/type_conversion.h
|
|
||||||
sem/type_mappings.h
|
sem/type_mappings.h
|
||||||
sem/variable.cc
|
sem/variable.cc
|
||||||
|
sem/value_constructor.cc
|
||||||
|
sem/value_constructor.h
|
||||||
|
sem/value_conversion.cc
|
||||||
|
sem/value_conversion.h
|
||||||
sem/value_expression.cc
|
sem/value_expression.cc
|
||||||
sem/value_expression.h
|
sem/value_expression.h
|
||||||
sem/while_statement.cc
|
sem/while_statement.cc
|
||||||
|
@ -564,7 +564,7 @@ tint_generated(builtin/interpolation_sampling BENCH TEST)
|
||||||
tint_generated(builtin/interpolation_type BENCH TEST)
|
tint_generated(builtin/interpolation_type BENCH TEST)
|
||||||
tint_generated(builtin/texel_format BENCH TEST)
|
tint_generated(builtin/texel_format BENCH TEST)
|
||||||
|
|
||||||
tint_generated(resolver/init_conv_intrinsic)
|
tint_generated(resolver/ctor_conv_intrinsic)
|
||||||
tint_generated(sem/builtin_type)
|
tint_generated(sem/builtin_type)
|
||||||
tint_generated(sem/parameter_usage)
|
tint_generated(sem/parameter_usage)
|
||||||
|
|
||||||
|
@ -926,11 +926,11 @@ if(TINT_BUILD_TESTS)
|
||||||
resolver/struct_layout_test.cc
|
resolver/struct_layout_test.cc
|
||||||
resolver/struct_pipeline_stage_use_test.cc
|
resolver/struct_pipeline_stage_use_test.cc
|
||||||
resolver/struct_address_space_use_test.cc
|
resolver/struct_address_space_use_test.cc
|
||||||
resolver/type_initializer_validation_test.cc
|
|
||||||
resolver/type_validation_test.cc
|
resolver/type_validation_test.cc
|
||||||
resolver/unresolved_identifier_test.cc
|
resolver/unresolved_identifier_test.cc
|
||||||
resolver/validation_test.cc
|
resolver/validation_test.cc
|
||||||
resolver/validator_is_storeable_test.cc
|
resolver/validator_is_storeable_test.cc
|
||||||
|
resolver/value_constructor_validation_test.cc
|
||||||
resolver/variable_test.cc
|
resolver/variable_test.cc
|
||||||
resolver/variable_validation_test.cc
|
resolver/variable_validation_test.cc
|
||||||
scope_stack_test.cc
|
scope_stack_test.cc
|
||||||
|
@ -1140,6 +1140,7 @@ if(TINT_BUILD_TESTS)
|
||||||
writer/spirv/builder_builtin_texture_test.cc
|
writer/spirv/builder_builtin_texture_test.cc
|
||||||
writer/spirv/builder_call_test.cc
|
writer/spirv/builder_call_test.cc
|
||||||
writer/spirv/builder_const_assert_test.cc
|
writer/spirv/builder_const_assert_test.cc
|
||||||
|
writer/spirv/builder_constructor_expression_test.cc
|
||||||
writer/spirv/builder_discard_test.cc
|
writer/spirv/builder_discard_test.cc
|
||||||
writer/spirv/builder_entry_point_test.cc
|
writer/spirv/builder_entry_point_test.cc
|
||||||
writer/spirv/builder_format_conversion_test.cc
|
writer/spirv/builder_format_conversion_test.cc
|
||||||
|
@ -1149,7 +1150,6 @@ if(TINT_BUILD_TESTS)
|
||||||
writer/spirv/builder_global_variable_test.cc
|
writer/spirv/builder_global_variable_test.cc
|
||||||
writer/spirv/builder_ident_expression_test.cc
|
writer/spirv/builder_ident_expression_test.cc
|
||||||
writer/spirv/builder_if_test.cc
|
writer/spirv/builder_if_test.cc
|
||||||
writer/spirv/builder_initializer_expression_test.cc
|
|
||||||
writer/spirv/builder_literal_test.cc
|
writer/spirv/builder_literal_test.cc
|
||||||
writer/spirv/builder_loop_test.cc
|
writer/spirv/builder_loop_test.cc
|
||||||
writer/spirv/builder_return_test.cc
|
writer/spirv/builder_return_test.cc
|
||||||
|
@ -1180,6 +1180,7 @@ if(TINT_BUILD_TESTS)
|
||||||
writer/wgsl/generator_impl_case_test.cc
|
writer/wgsl/generator_impl_case_test.cc
|
||||||
writer/wgsl/generator_impl_cast_test.cc
|
writer/wgsl/generator_impl_cast_test.cc
|
||||||
writer/wgsl/generator_impl_const_assert_test.cc
|
writer/wgsl/generator_impl_const_assert_test.cc
|
||||||
|
writer/wgsl/generator_impl_constructor_test.cc
|
||||||
writer/wgsl/generator_impl_continue_test.cc
|
writer/wgsl/generator_impl_continue_test.cc
|
||||||
writer/wgsl/generator_impl_diagnostic_test.cc
|
writer/wgsl/generator_impl_diagnostic_test.cc
|
||||||
writer/wgsl/generator_impl_discard_test.cc
|
writer/wgsl/generator_impl_discard_test.cc
|
||||||
|
@ -1188,7 +1189,6 @@ if(TINT_BUILD_TESTS)
|
||||||
writer/wgsl/generator_impl_global_decl_test.cc
|
writer/wgsl/generator_impl_global_decl_test.cc
|
||||||
writer/wgsl/generator_impl_identifier_test.cc
|
writer/wgsl/generator_impl_identifier_test.cc
|
||||||
writer/wgsl/generator_impl_if_test.cc
|
writer/wgsl/generator_impl_if_test.cc
|
||||||
writer/wgsl/generator_impl_initializer_test.cc
|
|
||||||
writer/wgsl/generator_impl_loop_test.cc
|
writer/wgsl/generator_impl_loop_test.cc
|
||||||
writer/wgsl/generator_impl_literal_test.cc
|
writer/wgsl/generator_impl_literal_test.cc
|
||||||
writer/wgsl/generator_impl_member_accessor_test.cc
|
writer/wgsl/generator_impl_member_accessor_test.cc
|
||||||
|
@ -1276,12 +1276,12 @@ if(TINT_BUILD_TESTS)
|
||||||
writer/msl/generator_impl_case_test.cc
|
writer/msl/generator_impl_case_test.cc
|
||||||
writer/msl/generator_impl_cast_test.cc
|
writer/msl/generator_impl_cast_test.cc
|
||||||
writer/msl/generator_impl_const_assert_test.cc
|
writer/msl/generator_impl_const_assert_test.cc
|
||||||
|
writer/msl/generator_impl_constructor_test.cc
|
||||||
writer/msl/generator_impl_continue_test.cc
|
writer/msl/generator_impl_continue_test.cc
|
||||||
writer/msl/generator_impl_discard_test.cc
|
writer/msl/generator_impl_discard_test.cc
|
||||||
writer/msl/generator_impl_function_test.cc
|
writer/msl/generator_impl_function_test.cc
|
||||||
writer/msl/generator_impl_identifier_test.cc
|
writer/msl/generator_impl_identifier_test.cc
|
||||||
writer/msl/generator_impl_if_test.cc
|
writer/msl/generator_impl_if_test.cc
|
||||||
writer/msl/generator_impl_initializer_test.cc
|
|
||||||
writer/msl/generator_impl_import_test.cc
|
writer/msl/generator_impl_import_test.cc
|
||||||
writer/msl/generator_impl_loop_test.cc
|
writer/msl/generator_impl_loop_test.cc
|
||||||
writer/msl/generator_impl_member_accessor_test.cc
|
writer/msl/generator_impl_member_accessor_test.cc
|
||||||
|
@ -1310,7 +1310,7 @@ if(TINT_BUILD_TESTS)
|
||||||
writer/glsl/generator_impl_call_test.cc
|
writer/glsl/generator_impl_call_test.cc
|
||||||
writer/glsl/generator_impl_case_test.cc
|
writer/glsl/generator_impl_case_test.cc
|
||||||
writer/glsl/generator_impl_cast_test.cc
|
writer/glsl/generator_impl_cast_test.cc
|
||||||
writer/glsl/generator_impl_initializer_test.cc
|
writer/glsl/generator_impl_constructor_test.cc
|
||||||
writer/glsl/generator_impl_continue_test.cc
|
writer/glsl/generator_impl_continue_test.cc
|
||||||
writer/glsl/generator_impl_discard_test.cc
|
writer/glsl/generator_impl_discard_test.cc
|
||||||
writer/glsl/generator_impl_function_test.cc
|
writer/glsl/generator_impl_function_test.cc
|
||||||
|
@ -1348,12 +1348,12 @@ if(TINT_BUILD_TESTS)
|
||||||
writer/hlsl/generator_impl_case_test.cc
|
writer/hlsl/generator_impl_case_test.cc
|
||||||
writer/hlsl/generator_impl_cast_test.cc
|
writer/hlsl/generator_impl_cast_test.cc
|
||||||
writer/hlsl/generator_impl_const_assert_test.cc
|
writer/hlsl/generator_impl_const_assert_test.cc
|
||||||
|
writer/hlsl/generator_impl_constructor_test.cc
|
||||||
writer/hlsl/generator_impl_continue_test.cc
|
writer/hlsl/generator_impl_continue_test.cc
|
||||||
writer/hlsl/generator_impl_discard_test.cc
|
writer/hlsl/generator_impl_discard_test.cc
|
||||||
writer/hlsl/generator_impl_function_test.cc
|
writer/hlsl/generator_impl_function_test.cc
|
||||||
writer/hlsl/generator_impl_identifier_test.cc
|
writer/hlsl/generator_impl_identifier_test.cc
|
||||||
writer/hlsl/generator_impl_if_test.cc
|
writer/hlsl/generator_impl_if_test.cc
|
||||||
writer/hlsl/generator_impl_initializer_test.cc
|
|
||||||
writer/hlsl/generator_impl_import_test.cc
|
writer/hlsl/generator_impl_import_test.cc
|
||||||
writer/hlsl/generator_impl_loop_test.cc
|
writer/hlsl/generator_impl_loop_test.cc
|
||||||
writer/hlsl/generator_impl_member_accessor_test.cc
|
writer/hlsl/generator_impl_member_accessor_test.cc
|
||||||
|
|
|
@ -27,8 +27,8 @@ namespace tint::ast {
|
||||||
/// A call expression - represents either a:
|
/// A call expression - represents either a:
|
||||||
/// * sem::Function
|
/// * sem::Function
|
||||||
/// * sem::Builtin
|
/// * sem::Builtin
|
||||||
/// * sem::TypeConstructor
|
/// * sem::ValueConstructor
|
||||||
/// * sem::TypeConversion
|
/// * sem::ValueConversion
|
||||||
class CallExpression final : public Castable<CallExpression, Expression> {
|
class CallExpression final : public Castable<CallExpression, Expression> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
|
|
@ -820,118 +820,118 @@ fn textureStore(texture: texture_storage_3d<u32_texel_format, write>, coords: ve
|
||||||
@stage("fragment", "compute") fn atomicCompareExchangeWeak<T: iu32, S: workgroup_or_storage>(ptr<S, atomic<T>, read_write>, T, T) -> __atomic_compare_exchange_result<T>
|
@stage("fragment", "compute") fn atomicCompareExchangeWeak<T: iu32, S: workgroup_or_storage>(ptr<S, atomic<T>, read_write>, T, T) -> __atomic_compare_exchange_result<T>
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Type initializers //
|
// Value constructors //
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Zero value initializers
|
// Zero value constructors
|
||||||
@must_use @const("Zero") init i32() -> i32
|
@must_use @const("Zero") ctor i32() -> i32
|
||||||
@must_use @const("Zero") init u32() -> u32
|
@must_use @const("Zero") ctor u32() -> u32
|
||||||
@must_use @const("Zero") init f32() -> f32
|
@must_use @const("Zero") ctor f32() -> f32
|
||||||
@must_use @const("Zero") init f16() -> f16
|
@must_use @const("Zero") ctor f16() -> f16
|
||||||
@must_use @const("Zero") init bool() -> bool
|
@must_use @const("Zero") ctor bool() -> bool
|
||||||
@must_use @const("Zero") init vec2<T: concrete_scalar>() -> vec2<T>
|
@must_use @const("Zero") ctor vec2<T: concrete_scalar>() -> vec2<T>
|
||||||
@must_use @const("Zero") init vec3<T: concrete_scalar>() -> vec3<T>
|
@must_use @const("Zero") ctor vec3<T: concrete_scalar>() -> vec3<T>
|
||||||
@must_use @const("Zero") init vec4<T: concrete_scalar>() -> vec4<T>
|
@must_use @const("Zero") ctor vec4<T: concrete_scalar>() -> vec4<T>
|
||||||
@must_use @const("Zero") init mat2x2<T: f32_f16>() -> mat2x2<T>
|
@must_use @const("Zero") ctor mat2x2<T: f32_f16>() -> mat2x2<T>
|
||||||
@must_use @const("Zero") init mat2x3<T: f32_f16>() -> mat2x3<T>
|
@must_use @const("Zero") ctor mat2x3<T: f32_f16>() -> mat2x3<T>
|
||||||
@must_use @const("Zero") init mat2x4<T: f32_f16>() -> mat2x4<T>
|
@must_use @const("Zero") ctor mat2x4<T: f32_f16>() -> mat2x4<T>
|
||||||
@must_use @const("Zero") init mat3x2<T: f32_f16>() -> mat3x2<T>
|
@must_use @const("Zero") ctor mat3x2<T: f32_f16>() -> mat3x2<T>
|
||||||
@must_use @const("Zero") init mat3x3<T: f32_f16>() -> mat3x3<T>
|
@must_use @const("Zero") ctor mat3x3<T: f32_f16>() -> mat3x3<T>
|
||||||
@must_use @const("Zero") init mat3x4<T: f32_f16>() -> mat3x4<T>
|
@must_use @const("Zero") ctor mat3x4<T: f32_f16>() -> mat3x4<T>
|
||||||
@must_use @const("Zero") init mat4x2<T: f32_f16>() -> mat4x2<T>
|
@must_use @const("Zero") ctor mat4x2<T: f32_f16>() -> mat4x2<T>
|
||||||
@must_use @const("Zero") init mat4x3<T: f32_f16>() -> mat4x3<T>
|
@must_use @const("Zero") ctor mat4x3<T: f32_f16>() -> mat4x3<T>
|
||||||
@must_use @const("Zero") init mat4x4<T: f32_f16>() -> mat4x4<T>
|
@must_use @const("Zero") ctor mat4x4<T: f32_f16>() -> mat4x4<T>
|
||||||
|
|
||||||
// Identity initializers
|
// Identity constructors
|
||||||
@must_use @const("Identity") init i32(i32) -> i32
|
@must_use @const("Identity") ctor i32(i32) -> i32
|
||||||
@must_use @const("Identity") init u32(u32) -> u32
|
@must_use @const("Identity") ctor u32(u32) -> u32
|
||||||
@must_use @const("Identity") init f32(f32) -> f32
|
@must_use @const("Identity") ctor f32(f32) -> f32
|
||||||
@must_use @const("Identity") init f16(f16) -> f16
|
@must_use @const("Identity") ctor f16(f16) -> f16
|
||||||
@must_use @const("Identity") init bool(bool) -> bool
|
@must_use @const("Identity") ctor bool(bool) -> bool
|
||||||
@must_use @const("Identity") init vec2<T: scalar>(vec2<T>) -> vec2<T>
|
@must_use @const("Identity") ctor vec2<T: scalar>(vec2<T>) -> vec2<T>
|
||||||
@must_use @const("Identity") init vec3<T: scalar>(vec3<T>) -> vec3<T>
|
@must_use @const("Identity") ctor vec3<T: scalar>(vec3<T>) -> vec3<T>
|
||||||
@must_use @const("Identity") init vec4<T: scalar>(vec4<T>) -> vec4<T>
|
@must_use @const("Identity") ctor vec4<T: scalar>(vec4<T>) -> vec4<T>
|
||||||
@must_use @const("Identity") init mat2x2<T: f32_f16>(mat2x2<T>) -> mat2x2<T>
|
@must_use @const("Identity") ctor mat2x2<T: f32_f16>(mat2x2<T>) -> mat2x2<T>
|
||||||
@must_use @const("Identity") init mat2x3<T: f32_f16>(mat2x3<T>) -> mat2x3<T>
|
@must_use @const("Identity") ctor mat2x3<T: f32_f16>(mat2x3<T>) -> mat2x3<T>
|
||||||
@must_use @const("Identity") init mat2x4<T: f32_f16>(mat2x4<T>) -> mat2x4<T>
|
@must_use @const("Identity") ctor mat2x4<T: f32_f16>(mat2x4<T>) -> mat2x4<T>
|
||||||
@must_use @const("Identity") init mat3x2<T: f32_f16>(mat3x2<T>) -> mat3x2<T>
|
@must_use @const("Identity") ctor mat3x2<T: f32_f16>(mat3x2<T>) -> mat3x2<T>
|
||||||
@must_use @const("Identity") init mat3x3<T: f32_f16>(mat3x3<T>) -> mat3x3<T>
|
@must_use @const("Identity") ctor mat3x3<T: f32_f16>(mat3x3<T>) -> mat3x3<T>
|
||||||
@must_use @const("Identity") init mat3x4<T: f32_f16>(mat3x4<T>) -> mat3x4<T>
|
@must_use @const("Identity") ctor mat3x4<T: f32_f16>(mat3x4<T>) -> mat3x4<T>
|
||||||
@must_use @const("Identity") init mat4x2<T: f32_f16>(mat4x2<T>) -> mat4x2<T>
|
@must_use @const("Identity") ctor mat4x2<T: f32_f16>(mat4x2<T>) -> mat4x2<T>
|
||||||
@must_use @const("Identity") init mat4x3<T: f32_f16>(mat4x3<T>) -> mat4x3<T>
|
@must_use @const("Identity") ctor mat4x3<T: f32_f16>(mat4x3<T>) -> mat4x3<T>
|
||||||
@must_use @const("Identity") init mat4x4<T: f32_f16>(mat4x4<T>) -> mat4x4<T>
|
@must_use @const("Identity") ctor mat4x4<T: f32_f16>(mat4x4<T>) -> mat4x4<T>
|
||||||
|
|
||||||
// Vector initializers (splat)
|
// Vector constructors (splat)
|
||||||
@must_use @const("VecSplat") init vec2<T: scalar>(T) -> vec2<T>
|
@must_use @const("VecSplat") ctor vec2<T: scalar>(T) -> vec2<T>
|
||||||
@must_use @const("VecSplat") init vec3<T: scalar>(T) -> vec3<T>
|
@must_use @const("VecSplat") ctor vec3<T: scalar>(T) -> vec3<T>
|
||||||
@must_use @const("VecSplat") init vec4<T: scalar>(T) -> vec4<T>
|
@must_use @const("VecSplat") ctor vec4<T: scalar>(T) -> vec4<T>
|
||||||
|
|
||||||
// Vector initializers (scalar)
|
// Vector constructors (scalar)
|
||||||
@must_use @const("VecInitS") init vec2<T: scalar>(x: T, y: T) -> vec2<T>
|
@must_use @const("VecInitS") ctor vec2<T: scalar>(x: T, y: T) -> vec2<T>
|
||||||
@must_use @const("VecInitS") init vec3<T: scalar>(x: T, y: T, z: T) -> vec3<T>
|
@must_use @const("VecInitS") ctor vec3<T: scalar>(x: T, y: T, z: T) -> vec3<T>
|
||||||
@must_use @const("VecInitS") init vec4<T: scalar>(x: T, y: T, z: T, w: T) -> vec4<T>
|
@must_use @const("VecInitS") ctor vec4<T: scalar>(x: T, y: T, z: T, w: T) -> vec4<T>
|
||||||
|
|
||||||
// Vector initializers (mixed)
|
// Vector constructors (mixed)
|
||||||
@must_use @const("VecInitM") init vec3<T: scalar>(xy: vec2<T>, z: T) -> vec3<T>
|
@must_use @const("VecInitM") ctor vec3<T: scalar>(xy: vec2<T>, z: T) -> vec3<T>
|
||||||
@must_use @const("VecInitM") init vec3<T: scalar>(x: T, yz: vec2<T>) -> vec3<T>
|
@must_use @const("VecInitM") ctor vec3<T: scalar>(x: T, yz: vec2<T>) -> vec3<T>
|
||||||
@must_use @const("VecInitM") init vec4<T: scalar>(xy: vec2<T>, z: T, w: T) -> vec4<T>
|
@must_use @const("VecInitM") ctor vec4<T: scalar>(xy: vec2<T>, z: T, w: T) -> vec4<T>
|
||||||
@must_use @const("VecInitM") init vec4<T: scalar>(x: T, yz: vec2<T>, w: T) -> vec4<T>
|
@must_use @const("VecInitM") ctor vec4<T: scalar>(x: T, yz: vec2<T>, w: T) -> vec4<T>
|
||||||
@must_use @const("VecInitM") init vec4<T: scalar>(x: T, y: T, zw: vec2<T>) -> vec4<T>
|
@must_use @const("VecInitM") ctor vec4<T: scalar>(x: T, y: T, zw: vec2<T>) -> vec4<T>
|
||||||
@must_use @const("VecInitM") init vec4<T: scalar>(xy: vec2<T>, zw: vec2<T>) -> vec4<T>
|
@must_use @const("VecInitM") ctor vec4<T: scalar>(xy: vec2<T>, zw: vec2<T>) -> vec4<T>
|
||||||
@must_use @const("VecInitM") init vec4<T: scalar>(xyz: vec3<T>, w: T) -> vec4<T>
|
@must_use @const("VecInitM") ctor vec4<T: scalar>(xyz: vec3<T>, w: T) -> vec4<T>
|
||||||
@must_use @const("VecInitM") init vec4<T: scalar>(x: T, zyw: vec3<T>) -> vec4<T>
|
@must_use @const("VecInitM") ctor vec4<T: scalar>(x: T, zyw: vec3<T>) -> vec4<T>
|
||||||
|
|
||||||
// Matrix initializers (scalar)
|
// Matrix constructors (scalar)
|
||||||
@must_use @const("MatInitS")
|
@must_use @const("MatInitS")
|
||||||
init mat2x2<T: fa_f32_f16>(T, T,
|
ctor mat2x2<T: fa_f32_f16>(T, T,
|
||||||
T, T) -> mat2x2<T>
|
T, T) -> mat2x2<T>
|
||||||
@must_use @const("MatInitS")
|
@must_use @const("MatInitS")
|
||||||
init mat2x3<T: fa_f32_f16>(T, T, T,
|
ctor mat2x3<T: fa_f32_f16>(T, T, T,
|
||||||
T, T, T) -> mat2x3<T>
|
T, T, T) -> mat2x3<T>
|
||||||
@must_use @const("MatInitS")
|
@must_use @const("MatInitS")
|
||||||
init mat2x4<T: fa_f32_f16>(T, T, T, T,
|
ctor mat2x4<T: fa_f32_f16>(T, T, T, T,
|
||||||
T, T, T, T) -> mat2x4<T>
|
T, T, T, T) -> mat2x4<T>
|
||||||
@must_use @const("MatInitS")
|
@must_use @const("MatInitS")
|
||||||
init mat3x2<T: fa_f32_f16>(T, T,
|
ctor mat3x2<T: fa_f32_f16>(T, T,
|
||||||
T, T,
|
T, T,
|
||||||
T, T) -> mat3x2<T>
|
T, T) -> mat3x2<T>
|
||||||
@must_use @const("MatInitS")
|
@must_use @const("MatInitS")
|
||||||
init mat3x3<T: fa_f32_f16>(T, T, T,
|
ctor mat3x3<T: fa_f32_f16>(T, T, T,
|
||||||
T, T, T,
|
T, T, T,
|
||||||
T, T, T) -> mat3x3<T>
|
T, T, T) -> mat3x3<T>
|
||||||
@must_use @const("MatInitS")
|
@must_use @const("MatInitS")
|
||||||
init mat3x4<T: fa_f32_f16>(T, T, T, T,
|
ctor mat3x4<T: fa_f32_f16>(T, T, T, T,
|
||||||
T, T, T, T,
|
T, T, T, T,
|
||||||
T, T, T, T) -> mat3x4<T>
|
T, T, T, T) -> mat3x4<T>
|
||||||
@must_use @const("MatInitS")
|
@must_use @const("MatInitS")
|
||||||
init mat4x2<T: fa_f32_f16>(T, T,
|
ctor mat4x2<T: fa_f32_f16>(T, T,
|
||||||
T, T,
|
T, T,
|
||||||
T, T,
|
T, T,
|
||||||
T, T) -> mat4x2<T>
|
T, T) -> mat4x2<T>
|
||||||
@must_use @const("MatInitS")
|
@must_use @const("MatInitS")
|
||||||
init mat4x3<T: fa_f32_f16>(T, T, T,
|
ctor mat4x3<T: fa_f32_f16>(T, T, T,
|
||||||
T, T, T,
|
T, T, T,
|
||||||
T, T, T,
|
T, T, T,
|
||||||
T, T, T) -> mat4x3<T>
|
T, T, T) -> mat4x3<T>
|
||||||
@must_use @const("MatInitS")
|
@must_use @const("MatInitS")
|
||||||
init mat4x4<T: fa_f32_f16>(T, T, T, T,
|
ctor mat4x4<T: fa_f32_f16>(T, T, T, T,
|
||||||
T, T, T, T,
|
T, T, T, T,
|
||||||
T, T, T, T,
|
T, T, T, T,
|
||||||
T, T, T, T) -> mat4x4<T>
|
T, T, T, T) -> mat4x4<T>
|
||||||
|
|
||||||
// Matrix initializers (column vectors)
|
// Matrix constructors (column vectors)
|
||||||
@must_use @const("MatInitV") init mat2x2<T: fa_f32_f16>(vec2<T>, vec2<T>) -> mat2x2<T>
|
@must_use @const("MatInitV") ctor mat2x2<T: fa_f32_f16>(vec2<T>, vec2<T>) -> mat2x2<T>
|
||||||
@must_use @const("MatInitV") init mat2x3<T: fa_f32_f16>(vec3<T>, vec3<T>) -> mat2x3<T>
|
@must_use @const("MatInitV") ctor mat2x3<T: fa_f32_f16>(vec3<T>, vec3<T>) -> mat2x3<T>
|
||||||
@must_use @const("MatInitV") init mat2x4<T: fa_f32_f16>(vec4<T>, vec4<T>) -> mat2x4<T>
|
@must_use @const("MatInitV") ctor mat2x4<T: fa_f32_f16>(vec4<T>, vec4<T>) -> mat2x4<T>
|
||||||
@must_use @const("MatInitV") init mat3x2<T: fa_f32_f16>(vec2<T>, vec2<T>, vec2<T>) -> mat3x2<T>
|
@must_use @const("MatInitV") ctor mat3x2<T: fa_f32_f16>(vec2<T>, vec2<T>, vec2<T>) -> mat3x2<T>
|
||||||
@must_use @const("MatInitV") init mat3x3<T: fa_f32_f16>(vec3<T>, vec3<T>, vec3<T>) -> mat3x3<T>
|
@must_use @const("MatInitV") ctor mat3x3<T: fa_f32_f16>(vec3<T>, vec3<T>, vec3<T>) -> mat3x3<T>
|
||||||
@must_use @const("MatInitV") init mat3x4<T: fa_f32_f16>(vec4<T>, vec4<T>, vec4<T>) -> mat3x4<T>
|
@must_use @const("MatInitV") ctor mat3x4<T: fa_f32_f16>(vec4<T>, vec4<T>, vec4<T>) -> mat3x4<T>
|
||||||
@must_use @const("MatInitV") init mat4x2<T: fa_f32_f16>(vec2<T>, vec2<T>, vec2<T>, vec2<T>) -> mat4x2<T>
|
@must_use @const("MatInitV") ctor mat4x2<T: fa_f32_f16>(vec2<T>, vec2<T>, vec2<T>, vec2<T>) -> mat4x2<T>
|
||||||
@must_use @const("MatInitV") init mat4x3<T: fa_f32_f16>(vec3<T>, vec3<T>, vec3<T>, vec3<T>) -> mat4x3<T>
|
@must_use @const("MatInitV") ctor mat4x3<T: fa_f32_f16>(vec3<T>, vec3<T>, vec3<T>, vec3<T>) -> mat4x3<T>
|
||||||
@must_use @const("MatInitV") init mat4x4<T: fa_f32_f16>(vec4<T>, vec4<T>, vec4<T>, vec4<T>) -> mat4x4<T>
|
@must_use @const("MatInitV") ctor mat4x4<T: fa_f32_f16>(vec4<T>, vec4<T>, vec4<T>, vec4<T>) -> mat4x4<T>
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Type conversions //
|
// Value conversions //
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
@must_use @const conv f32<T: scalar_no_f32>(T) -> f32
|
@must_use @const conv f32<T: scalar_no_f32>(T) -> f32
|
||||||
@must_use @const conv f16<T: scalar_no_f16>(T) -> f16
|
@must_use @const conv f16<T: scalar_no_f16>(T) -> f16
|
||||||
|
|
|
@ -473,7 +473,7 @@ class ProgramBuilder {
|
||||||
/// Creates a new ast::Node owned by the ProgramBuilder. When the
|
/// Creates a new ast::Node owned by the ProgramBuilder. When the
|
||||||
/// ProgramBuilder is destructed, the ast::Node will also be destructed.
|
/// ProgramBuilder is destructed, the ast::Node will also be destructed.
|
||||||
/// @param source the Source of the node
|
/// @param source the Source of the node
|
||||||
/// @param args the arguments to pass to the type constructor
|
/// @param args the arguments to pass to the constructor
|
||||||
/// @returns the node pointer
|
/// @returns the node pointer
|
||||||
template <typename T, typename... ARGS>
|
template <typename T, typename... ARGS>
|
||||||
traits::EnableIfIsType<T, ast::Node>* create(const Source& source, ARGS&&... args) {
|
traits::EnableIfIsType<T, ast::Node>* create(const Source& source, ARGS&&... args) {
|
||||||
|
@ -498,8 +498,8 @@ class ProgramBuilder {
|
||||||
/// constructor.
|
/// constructor.
|
||||||
/// When the ProgramBuilder is destructed, the ast::Node will also be
|
/// When the ProgramBuilder is destructed, the ast::Node will also be
|
||||||
/// destructed.
|
/// destructed.
|
||||||
/// @param arg0 the first arguments to pass to the type constructor
|
/// @param arg0 the first arguments to pass to the constructor
|
||||||
/// @param args the remaining arguments to pass to the type constructor
|
/// @param args the remaining arguments to pass to the constructor
|
||||||
/// @returns the node pointer
|
/// @returns the node pointer
|
||||||
template <typename T, typename ARG0, typename... ARGS>
|
template <typename T, typename ARG0, typename... ARGS>
|
||||||
traits::EnableIf</* T is ast::Node and ARG0 is not Source */
|
traits::EnableIf</* T is ast::Node and ARG0 is not Source */
|
||||||
|
@ -1706,7 +1706,7 @@ class ProgramBuilder {
|
||||||
|
|
||||||
/// @param type the vector type
|
/// @param type the vector type
|
||||||
/// @param size the vector size
|
/// @param size the vector size
|
||||||
/// @param args the arguments for the vector initializer
|
/// @param args the arguments for the vector constructor
|
||||||
/// @return an `ast::CallExpression` of a `size`-element vector of
|
/// @return an `ast::CallExpression` of a `size`-element vector of
|
||||||
/// type `type`, constructed with the values @p args.
|
/// type `type`, constructed with the values @p args.
|
||||||
template <typename... ARGS>
|
template <typename... ARGS>
|
||||||
|
@ -1717,7 +1717,7 @@ class ProgramBuilder {
|
||||||
/// @param source the source of the call
|
/// @param source the source of the call
|
||||||
/// @param type the vector type
|
/// @param type the vector type
|
||||||
/// @param size the vector size
|
/// @param size the vector size
|
||||||
/// @param args the arguments for the vector initializer
|
/// @param args the arguments for the vector constructor
|
||||||
/// @return an `ast::CallExpression` of a `size`-element vector of
|
/// @return an `ast::CallExpression` of a `size`-element vector of
|
||||||
/// type `type`, constructed with the values @p args.
|
/// type `type`, constructed with the values @p args.
|
||||||
template <typename... ARGS>
|
template <typename... ARGS>
|
||||||
|
@ -1728,7 +1728,7 @@ class ProgramBuilder {
|
||||||
return Call(source, ty.vec(type, size), std::forward<ARGS>(args)...);
|
return Call(source, ty.vec(type, size), std::forward<ARGS>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param args the arguments for the vector initializer
|
/// @param args the arguments for the vector constructor
|
||||||
/// @return an `ast::CallExpression` of a 2-element vector of type `T`, constructed with the
|
/// @return an `ast::CallExpression` of a 2-element vector of type `T`, constructed with the
|
||||||
/// values @p args.
|
/// values @p args.
|
||||||
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
||||||
|
@ -1737,7 +1737,7 @@ class ProgramBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param source the vector source
|
/// @param source the vector source
|
||||||
/// @param args the arguments for the vector initializer
|
/// @param args the arguments for the vector constructor
|
||||||
/// @return an `ast::CallExpression` of a 2-element vector of type `T`, constructed with the
|
/// @return an `ast::CallExpression` of a 2-element vector of type `T`, constructed with the
|
||||||
/// values @p args.
|
/// values @p args.
|
||||||
template <typename T, typename... ARGS>
|
template <typename T, typename... ARGS>
|
||||||
|
@ -1746,7 +1746,7 @@ class ProgramBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param type the element type of the vector
|
/// @param type the element type of the vector
|
||||||
/// @param args the arguments for the vector initializer
|
/// @param args the arguments for the vector constructor
|
||||||
/// @return an `ast::CallExpression` of a 2-element vector of type @p type, constructed with the
|
/// @return an `ast::CallExpression` of a 2-element vector of type @p type, constructed with the
|
||||||
/// values @p args.
|
/// values @p args.
|
||||||
template <typename... ARGS>
|
template <typename... ARGS>
|
||||||
|
@ -1756,7 +1756,7 @@ class ProgramBuilder {
|
||||||
|
|
||||||
/// @param source the vector source
|
/// @param source the vector source
|
||||||
/// @param type the element type of the vector
|
/// @param type the element type of the vector
|
||||||
/// @param args the arguments for the vector initializer
|
/// @param args the arguments for the vector constructor
|
||||||
/// @return an `ast::CallExpression` of a 2-element vector of type @p type, constructed with the
|
/// @return an `ast::CallExpression` of a 2-element vector of type @p type, constructed with the
|
||||||
/// values @p args.
|
/// values @p args.
|
||||||
template <typename... ARGS>
|
template <typename... ARGS>
|
||||||
|
@ -1764,7 +1764,7 @@ class ProgramBuilder {
|
||||||
return Call(source, ty.vec2(type), std::forward<ARGS>(args)...);
|
return Call(source, ty.vec2(type), std::forward<ARGS>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param args the arguments for the vector initializer
|
/// @param args the arguments for the vector constructor
|
||||||
/// @return an `ast::CallExpression` of a 3-element vector of type `T`, constructed with the
|
/// @return an `ast::CallExpression` of a 3-element vector of type `T`, constructed with the
|
||||||
/// values @p args.
|
/// values @p args.
|
||||||
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
||||||
|
@ -1773,7 +1773,7 @@ class ProgramBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param source the vector source
|
/// @param source the vector source
|
||||||
/// @param args the arguments for the vector initializer
|
/// @param args the arguments for the vector constructor
|
||||||
/// @return an `ast::CallExpression` of a 3-element vector of type `T`, constructed with the
|
/// @return an `ast::CallExpression` of a 3-element vector of type `T`, constructed with the
|
||||||
/// values @p args.
|
/// values @p args.
|
||||||
template <typename T, typename... ARGS>
|
template <typename T, typename... ARGS>
|
||||||
|
@ -1782,7 +1782,7 @@ class ProgramBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param type the element type of the vector
|
/// @param type the element type of the vector
|
||||||
/// @param args the arguments for the vector initializer
|
/// @param args the arguments for the vector constructor
|
||||||
/// @return an `ast::CallExpression` of a 3-element vector of type @p type, constructed with the
|
/// @return an `ast::CallExpression` of a 3-element vector of type @p type, constructed with the
|
||||||
/// values @p args.
|
/// values @p args.
|
||||||
template <typename... ARGS>
|
template <typename... ARGS>
|
||||||
|
@ -1792,7 +1792,7 @@ class ProgramBuilder {
|
||||||
|
|
||||||
/// @param source the vector source
|
/// @param source the vector source
|
||||||
/// @param type the element type of the vector
|
/// @param type the element type of the vector
|
||||||
/// @param args the arguments for the vector initializer
|
/// @param args the arguments for the vector constructor
|
||||||
/// @return an `ast::CallExpression` of a 3-element vector of type @p type, constructed with the
|
/// @return an `ast::CallExpression` of a 3-element vector of type @p type, constructed with the
|
||||||
/// values @p args.
|
/// values @p args.
|
||||||
template <typename... ARGS>
|
template <typename... ARGS>
|
||||||
|
@ -1800,7 +1800,7 @@ class ProgramBuilder {
|
||||||
return Call(source, ty.vec3(type), std::forward<ARGS>(args)...);
|
return Call(source, ty.vec3(type), std::forward<ARGS>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param args the arguments for the vector initializer
|
/// @param args the arguments for the vector constructor
|
||||||
/// @return an `ast::CallExpression` of a 4-element vector of type `T`, constructed with the
|
/// @return an `ast::CallExpression` of a 4-element vector of type `T`, constructed with the
|
||||||
/// values @p args.
|
/// values @p args.
|
||||||
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
||||||
|
@ -1809,7 +1809,7 @@ class ProgramBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param source the vector source
|
/// @param source the vector source
|
||||||
/// @param args the arguments for the vector initializer
|
/// @param args the arguments for the vector constructor
|
||||||
/// @return an `ast::CallExpression` of a 4-element vector of type `T`, constructed with the
|
/// @return an `ast::CallExpression` of a 4-element vector of type `T`, constructed with the
|
||||||
/// values @p args.
|
/// values @p args.
|
||||||
template <typename T, typename... ARGS>
|
template <typename T, typename... ARGS>
|
||||||
|
@ -1818,7 +1818,7 @@ class ProgramBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param type the element type of the vector
|
/// @param type the element type of the vector
|
||||||
/// @param args the arguments for the vector initializer
|
/// @param args the arguments for the vector constructor
|
||||||
/// @return an `ast::CallExpression` of a 4-element vector of type @p type, constructed with the
|
/// @return an `ast::CallExpression` of a 4-element vector of type @p type, constructed with the
|
||||||
/// values @p args.
|
/// values @p args.
|
||||||
template <typename... ARGS>
|
template <typename... ARGS>
|
||||||
|
@ -1828,7 +1828,7 @@ class ProgramBuilder {
|
||||||
|
|
||||||
/// @param source the vector source
|
/// @param source the vector source
|
||||||
/// @param type the element type of the vector
|
/// @param type the element type of the vector
|
||||||
/// @param args the arguments for the vector initializer
|
/// @param args the arguments for the vector constructor
|
||||||
/// @return an `ast::CallExpression` of a 4-element vector of type @p type, constructed with the
|
/// @return an `ast::CallExpression` of a 4-element vector of type @p type, constructed with the
|
||||||
/// values @p args.
|
/// values @p args.
|
||||||
template <typename... ARGS>
|
template <typename... ARGS>
|
||||||
|
@ -1836,7 +1836,7 @@ class ProgramBuilder {
|
||||||
return Call(source, ty.vec4(type), std::forward<ARGS>(args)...);
|
return Call(source, ty.vec4(type), std::forward<ARGS>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param args the arguments for the matrix initializer
|
/// @param args the arguments for the matrix constructor
|
||||||
/// @return an `ast::CallExpression` of a 2x2 matrix of type
|
/// @return an `ast::CallExpression` of a 2x2 matrix of type
|
||||||
/// `T`, constructed with the values @p args.
|
/// `T`, constructed with the values @p args.
|
||||||
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
||||||
|
@ -1845,7 +1845,7 @@ class ProgramBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param source the matrix source
|
/// @param source the matrix source
|
||||||
/// @param args the arguments for the matrix initializer
|
/// @param args the arguments for the matrix constructor
|
||||||
/// @return an `ast::CallExpression` of a 2x2 matrix of type
|
/// @return an `ast::CallExpression` of a 2x2 matrix of type
|
||||||
/// `T`, constructed with the values @p args.
|
/// `T`, constructed with the values @p args.
|
||||||
template <typename T, typename... ARGS>
|
template <typename T, typename... ARGS>
|
||||||
|
@ -1853,7 +1853,7 @@ class ProgramBuilder {
|
||||||
return Call(source, ty.mat2x2<T>(), std::forward<ARGS>(args)...);
|
return Call(source, ty.mat2x2<T>(), std::forward<ARGS>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param args the arguments for the matrix initializer
|
/// @param args the arguments for the matrix constructor
|
||||||
/// @return an `ast::CallExpression` of a 2x3 matrix of type
|
/// @return an `ast::CallExpression` of a 2x3 matrix of type
|
||||||
/// `T`, constructed with the values @p args.
|
/// `T`, constructed with the values @p args.
|
||||||
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
||||||
|
@ -1862,7 +1862,7 @@ class ProgramBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param source the matrix source
|
/// @param source the matrix source
|
||||||
/// @param args the arguments for the matrix initializer
|
/// @param args the arguments for the matrix constructor
|
||||||
/// @return an `ast::CallExpression` of a 2x3 matrix of type
|
/// @return an `ast::CallExpression` of a 2x3 matrix of type
|
||||||
/// `T`, constructed with the values @p args.
|
/// `T`, constructed with the values @p args.
|
||||||
template <typename T, typename... ARGS>
|
template <typename T, typename... ARGS>
|
||||||
|
@ -1870,7 +1870,7 @@ class ProgramBuilder {
|
||||||
return Call(source, ty.mat2x3<T>(), std::forward<ARGS>(args)...);
|
return Call(source, ty.mat2x3<T>(), std::forward<ARGS>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param args the arguments for the matrix initializer
|
/// @param args the arguments for the matrix constructor
|
||||||
/// @return an `ast::CallExpression` of a 2x4 matrix of type
|
/// @return an `ast::CallExpression` of a 2x4 matrix of type
|
||||||
/// `T`, constructed with the values @p args.
|
/// `T`, constructed with the values @p args.
|
||||||
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
||||||
|
@ -1879,7 +1879,7 @@ class ProgramBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param source the matrix source
|
/// @param source the matrix source
|
||||||
/// @param args the arguments for the matrix initializer
|
/// @param args the arguments for the matrix constructor
|
||||||
/// @return an `ast::CallExpression` of a 2x4 matrix of type
|
/// @return an `ast::CallExpression` of a 2x4 matrix of type
|
||||||
/// `T`, constructed with the values @p args.
|
/// `T`, constructed with the values @p args.
|
||||||
template <typename T, typename... ARGS>
|
template <typename T, typename... ARGS>
|
||||||
|
@ -1887,7 +1887,7 @@ class ProgramBuilder {
|
||||||
return Call(source, ty.mat2x4<T>(), std::forward<ARGS>(args)...);
|
return Call(source, ty.mat2x4<T>(), std::forward<ARGS>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param args the arguments for the matrix initializer
|
/// @param args the arguments for the matrix constructor
|
||||||
/// @return an `ast::CallExpression` of a 3x2 matrix of type
|
/// @return an `ast::CallExpression` of a 3x2 matrix of type
|
||||||
/// `T`, constructed with the values @p args.
|
/// `T`, constructed with the values @p args.
|
||||||
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
||||||
|
@ -1896,7 +1896,7 @@ class ProgramBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param source the matrix source
|
/// @param source the matrix source
|
||||||
/// @param args the arguments for the matrix initializer
|
/// @param args the arguments for the matrix constructor
|
||||||
/// @return an `ast::CallExpression` of a 3x2 matrix of type
|
/// @return an `ast::CallExpression` of a 3x2 matrix of type
|
||||||
/// `T`, constructed with the values @p args.
|
/// `T`, constructed with the values @p args.
|
||||||
template <typename T, typename... ARGS>
|
template <typename T, typename... ARGS>
|
||||||
|
@ -1904,7 +1904,7 @@ class ProgramBuilder {
|
||||||
return Call(source, ty.mat3x2<T>(), std::forward<ARGS>(args)...);
|
return Call(source, ty.mat3x2<T>(), std::forward<ARGS>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param args the arguments for the matrix initializer
|
/// @param args the arguments for the matrix constructor
|
||||||
/// @return an `ast::CallExpression` of a 3x3 matrix of type
|
/// @return an `ast::CallExpression` of a 3x3 matrix of type
|
||||||
/// `T`, constructed with the values @p args.
|
/// `T`, constructed with the values @p args.
|
||||||
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
||||||
|
@ -1913,7 +1913,7 @@ class ProgramBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param source the matrix source
|
/// @param source the matrix source
|
||||||
/// @param args the arguments for the matrix initializer
|
/// @param args the arguments for the matrix constructor
|
||||||
/// @return an `ast::CallExpression` of a 3x3 matrix of type
|
/// @return an `ast::CallExpression` of a 3x3 matrix of type
|
||||||
/// `T`, constructed with the values @p args.
|
/// `T`, constructed with the values @p args.
|
||||||
template <typename T, typename... ARGS>
|
template <typename T, typename... ARGS>
|
||||||
|
@ -1921,7 +1921,7 @@ class ProgramBuilder {
|
||||||
return Call(source, ty.mat3x3<T>(), std::forward<ARGS>(args)...);
|
return Call(source, ty.mat3x3<T>(), std::forward<ARGS>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param args the arguments for the matrix initializer
|
/// @param args the arguments for the matrix constructor
|
||||||
/// @return an `ast::CallExpression` of a 3x4 matrix of type
|
/// @return an `ast::CallExpression` of a 3x4 matrix of type
|
||||||
/// `T`, constructed with the values @p args.
|
/// `T`, constructed with the values @p args.
|
||||||
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
||||||
|
@ -1930,7 +1930,7 @@ class ProgramBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param source the matrix source
|
/// @param source the matrix source
|
||||||
/// @param args the arguments for the matrix initializer
|
/// @param args the arguments for the matrix constructor
|
||||||
/// @return an `ast::CallExpression` of a 3x4 matrix of type
|
/// @return an `ast::CallExpression` of a 3x4 matrix of type
|
||||||
/// `T`, constructed with the values @p args.
|
/// `T`, constructed with the values @p args.
|
||||||
template <typename T, typename... ARGS>
|
template <typename T, typename... ARGS>
|
||||||
|
@ -1938,7 +1938,7 @@ class ProgramBuilder {
|
||||||
return Call(source, ty.mat3x4<T>(), std::forward<ARGS>(args)...);
|
return Call(source, ty.mat3x4<T>(), std::forward<ARGS>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param args the arguments for the matrix initializer
|
/// @param args the arguments for the matrix constructor
|
||||||
/// @return an `ast::CallExpression` of a 4x2 matrix of type
|
/// @return an `ast::CallExpression` of a 4x2 matrix of type
|
||||||
/// `T`, constructed with the values @p args.
|
/// `T`, constructed with the values @p args.
|
||||||
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
||||||
|
@ -1947,7 +1947,7 @@ class ProgramBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param source the matrix source
|
/// @param source the matrix source
|
||||||
/// @param args the arguments for the matrix initializer
|
/// @param args the arguments for the matrix constructor
|
||||||
/// @return an `ast::CallExpression` of a 4x2 matrix of type
|
/// @return an `ast::CallExpression` of a 4x2 matrix of type
|
||||||
/// `T`, constructed with the values @p args.
|
/// `T`, constructed with the values @p args.
|
||||||
template <typename T, typename... ARGS>
|
template <typename T, typename... ARGS>
|
||||||
|
@ -1955,7 +1955,7 @@ class ProgramBuilder {
|
||||||
return Call(source, ty.mat4x2<T>(), std::forward<ARGS>(args)...);
|
return Call(source, ty.mat4x2<T>(), std::forward<ARGS>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param args the arguments for the matrix initializer
|
/// @param args the arguments for the matrix constructor
|
||||||
/// @return an `ast::CallExpression` of a 4x3 matrix of type
|
/// @return an `ast::CallExpression` of a 4x3 matrix of type
|
||||||
/// `T`, constructed with the values @p args.
|
/// `T`, constructed with the values @p args.
|
||||||
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
||||||
|
@ -1964,7 +1964,7 @@ class ProgramBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param source the matrix source
|
/// @param source the matrix source
|
||||||
/// @param args the arguments for the matrix initializer
|
/// @param args the arguments for the matrix constructor
|
||||||
/// @return an `ast::CallExpression` of a 4x3 matrix of type
|
/// @return an `ast::CallExpression` of a 4x3 matrix of type
|
||||||
/// `T`, constructed with the values @p args.
|
/// `T`, constructed with the values @p args.
|
||||||
template <typename T, typename... ARGS>
|
template <typename T, typename... ARGS>
|
||||||
|
@ -1972,7 +1972,7 @@ class ProgramBuilder {
|
||||||
return Call(source, ty.mat4x3<T>(), std::forward<ARGS>(args)...);
|
return Call(source, ty.mat4x3<T>(), std::forward<ARGS>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param args the arguments for the matrix initializer
|
/// @param args the arguments for the matrix constructor
|
||||||
/// @return an `ast::CallExpression` of a 4x4 matrix of type
|
/// @return an `ast::CallExpression` of a 4x4 matrix of type
|
||||||
/// `T`, constructed with the values @p args.
|
/// `T`, constructed with the values @p args.
|
||||||
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
||||||
|
@ -1981,7 +1981,7 @@ class ProgramBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param source the matrix source
|
/// @param source the matrix source
|
||||||
/// @param args the arguments for the matrix initializer
|
/// @param args the arguments for the matrix constructor
|
||||||
/// @return an `ast::CallExpression` of a 4x4 matrix of type
|
/// @return an `ast::CallExpression` of a 4x4 matrix of type
|
||||||
/// `T`, constructed with the values @p args.
|
/// `T`, constructed with the values @p args.
|
||||||
template <typename T, typename... ARGS>
|
template <typename T, typename... ARGS>
|
||||||
|
@ -1989,7 +1989,7 @@ class ProgramBuilder {
|
||||||
return Call(source, ty.mat4x4<T>(), std::forward<ARGS>(args)...);
|
return Call(source, ty.mat4x4<T>(), std::forward<ARGS>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param args the arguments for the array initializer
|
/// @param args the arguments for the array constructor
|
||||||
/// @return an `ast::CallExpression` of an array with element type `T`, constructed with the
|
/// @return an `ast::CallExpression` of an array with element type `T`, constructed with the
|
||||||
/// values @p args.
|
/// values @p args.
|
||||||
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
||||||
|
@ -1998,7 +1998,7 @@ class ProgramBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param source the array source
|
/// @param source the array source
|
||||||
/// @param args the arguments for the array initializer
|
/// @param args the arguments for the array constructor
|
||||||
/// @return an `ast::CallExpression` of an array with element type `T`, constructed with the
|
/// @return an `ast::CallExpression` of an array with element type `T`, constructed with the
|
||||||
/// values @p args.
|
/// values @p args.
|
||||||
template <typename T, typename... ARGS>
|
template <typename T, typename... ARGS>
|
||||||
|
@ -2006,7 +2006,7 @@ class ProgramBuilder {
|
||||||
return Call(source, ty.array<T>(), std::forward<ARGS>(args)...);
|
return Call(source, ty.array<T>(), std::forward<ARGS>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param args the arguments for the array initializer
|
/// @param args the arguments for the array constructor
|
||||||
/// @return an `ast::CallExpression` of an array with element type `T` and size `N`, constructed
|
/// @return an `ast::CallExpression` of an array with element type `T` and size `N`, constructed
|
||||||
/// with the values @p args.
|
/// with the values @p args.
|
||||||
template <typename T, int N, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
template <typename T, int N, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
||||||
|
@ -2015,7 +2015,7 @@ class ProgramBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param source the array source
|
/// @param source the array source
|
||||||
/// @param args the arguments for the array initializer
|
/// @param args the arguments for the array constructor
|
||||||
/// @return an `ast::CallExpression` of an array with element type `T` and size `N`, constructed
|
/// @return an `ast::CallExpression` of an array with element type `T` and size `N`, constructed
|
||||||
/// with the values @p args.
|
/// with the values @p args.
|
||||||
template <typename T, int N, typename... ARGS>
|
template <typename T, int N, typename... ARGS>
|
||||||
|
@ -2025,7 +2025,7 @@ class ProgramBuilder {
|
||||||
|
|
||||||
/// @param subtype the array element type
|
/// @param subtype the array element type
|
||||||
/// @param n the array size. nullptr represents a runtime-array.
|
/// @param n the array size. nullptr represents a runtime-array.
|
||||||
/// @param args the arguments for the array initializer
|
/// @param args the arguments for the array constructor
|
||||||
/// @return an `ast::CallExpression` of an array with element type
|
/// @return an `ast::CallExpression` of an array with element type
|
||||||
/// `subtype`, constructed with the values @p args.
|
/// `subtype`, constructed with the values @p args.
|
||||||
template <typename EXPR, typename... ARGS>
|
template <typename EXPR, typename... ARGS>
|
||||||
|
@ -2036,7 +2036,7 @@ class ProgramBuilder {
|
||||||
/// @param source the array source
|
/// @param source the array source
|
||||||
/// @param subtype the array element type
|
/// @param subtype the array element type
|
||||||
/// @param n the array size. nullptr represents a runtime-array.
|
/// @param n the array size. nullptr represents a runtime-array.
|
||||||
/// @param args the arguments for the array initializer
|
/// @param args the arguments for the array constructor
|
||||||
/// @return an `ast::CallExpression` of an array with element type
|
/// @return an `ast::CallExpression` of an array with element type
|
||||||
/// `subtype`, constructed with the values @p args.
|
/// `subtype`, constructed with the values @p args.
|
||||||
template <typename EXPR, typename... ARGS>
|
template <typename EXPR, typename... ARGS>
|
||||||
|
@ -2069,11 +2069,11 @@ class ProgramBuilder {
|
||||||
/// @param name the variable name
|
/// @param name the variable name
|
||||||
/// @param options the extra options passed to the ast::Var initializer
|
/// @param options the extra options passed to the ast::Var initializer
|
||||||
/// Can be any of the following, in any order:
|
/// Can be any of the following, in any order:
|
||||||
/// * ast::Type - specifies the variable's type
|
/// * ast::Type - specifies the variable's type
|
||||||
/// * builtin::AddressSpace - specifies the variable's address space
|
/// * builtin::AddressSpace - specifies the variable's address space
|
||||||
/// * builtin::Access - specifies the variable's access control
|
/// * builtin::Access - specifies the variable's access control
|
||||||
/// * ast::Expression* - specifies the variable's initializer expression
|
/// * ast::Expression* - specifies the variable's initializer expression
|
||||||
/// * ast::Attribute* - specifies the variable's attributes (repeatable, or vector)
|
/// * ast::Attribute* - specifies the variable's attributes (repeatable, or vector)
|
||||||
/// Note that non-repeatable arguments of the same type will use the last argument's value.
|
/// Note that non-repeatable arguments of the same type will use the last argument's value.
|
||||||
/// @returns a `ast::Var` with the given name, type and additional
|
/// @returns a `ast::Var` with the given name, type and additional
|
||||||
/// options
|
/// options
|
||||||
|
@ -2086,11 +2086,11 @@ class ProgramBuilder {
|
||||||
/// @param name the variable name
|
/// @param name the variable name
|
||||||
/// @param options the extra options passed to the ast::Var initializer
|
/// @param options the extra options passed to the ast::Var initializer
|
||||||
/// Can be any of the following, in any order:
|
/// Can be any of the following, in any order:
|
||||||
/// * ast::Type - specifies the variable's type
|
/// * ast::Type - specifies the variable's type
|
||||||
/// * builtin::AddressSpace - specifies the variable's address space
|
/// * builtin::AddressSpace - specifies the variable's address space
|
||||||
/// * builtin::Access - specifies the variable's access control
|
/// * builtin::Access - specifies the variable's access control
|
||||||
/// * ast::Expression* - specifies the variable's initializer expression
|
/// * ast::Expression* - specifies the variable's initializer expression
|
||||||
/// * ast::Attribute* - specifies the variable's attributes (repeatable, or vector)
|
/// * ast::Attribute* - specifies the variable's attributes (repeatable, or vector)
|
||||||
/// Note that non-repeatable arguments of the same type will use the last argument's value.
|
/// Note that non-repeatable arguments of the same type will use the last argument's value.
|
||||||
/// @returns a `ast::Var` with the given name, address_space and type
|
/// @returns a `ast::Var` with the given name, address_space and type
|
||||||
template <typename NAME, typename... OPTIONS>
|
template <typename NAME, typename... OPTIONS>
|
||||||
|
@ -2390,7 +2390,7 @@ class ProgramBuilder {
|
||||||
Expr(std::forward<EXPR>(expr)));
|
Expr(std::forward<EXPR>(expr)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param args the arguments for the type constructor
|
/// @param args the arguments for the constructor
|
||||||
/// @returns an ast::CallExpression to the type `T`, with the arguments of @p args converted to
|
/// @returns an ast::CallExpression to the type `T`, with the arguments of @p args converted to
|
||||||
/// `ast::Expression`s using Expr().
|
/// `ast::Expression`s using Expr().
|
||||||
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
template <typename T, typename... ARGS, typename = DisableIfSource<ARGS...>>
|
||||||
|
@ -2399,7 +2399,7 @@ class ProgramBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param source the source of the call
|
/// @param source the source of the call
|
||||||
/// @param args the arguments for the type constructor
|
/// @param args the arguments for the constructor
|
||||||
/// @returns an ast::CallExpression to the type `T` with the arguments of @p args converted to
|
/// @returns an ast::CallExpression to the type `T` with the arguments of @p args converted to
|
||||||
/// `ast::Expression`s using Expr().
|
/// `ast::Expression`s using Expr().
|
||||||
template <typename T, typename... ARGS>
|
template <typename T, typename... ARGS>
|
||||||
|
|
|
@ -3950,7 +3950,7 @@ TypedExpression FunctionEmitter::EmitGlslStd450ExtInst(const spvtools::opt::Inst
|
||||||
|
|
||||||
if (ext_opcode == GLSLstd450Ldexp) {
|
if (ext_opcode == GLSLstd450Ldexp) {
|
||||||
// WGSL requires the second argument to be signed.
|
// WGSL requires the second argument to be signed.
|
||||||
// Use a type initializer to convert it, which is the same as a bitcast.
|
// Use a value constructor to convert it, which is the same as a bitcast.
|
||||||
// If the value would go from very large positive to negative, then the
|
// If the value would go from very large positive to negative, then the
|
||||||
// original result would have been infinity. And since WGSL
|
// original result would have been infinity. And since WGSL
|
||||||
// implementations may assume that infinities are not present, then we
|
// implementations may assume that infinities are not present, then we
|
||||||
|
|
|
@ -2937,7 +2937,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
// When SPIR-V wants the result type to be unsigned, we have to
|
// When SPIR-V wants the result type to be unsigned, we have to
|
||||||
// insert a type initializer or bitcast for WGSL to do the type
|
// insert a value constructor or bitcast for WGSL to do the type
|
||||||
// coercion. But the algorithm already does that as a matter
|
// coercion. But the algorithm already does that as a matter
|
||||||
// of course.
|
// of course.
|
||||||
ImageQuerySizeLod_NonArrayed_UnsignedResult_SignedLevel,
|
ImageQuerySizeLod_NonArrayed_UnsignedResult_SignedLevel,
|
||||||
|
@ -3002,8 +3002,7 @@ INSTANTIATE_TEST_SUITE_P(ImageQueryLevels_SignedResult,
|
||||||
R"(let x_99 : i32 = i32(textureNumLevels(x_20));)"}}));
|
R"(let x_99 : i32 = i32(textureNumLevels(x_20));)"}}));
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
// Spot check that a type conversion is inserted when SPIR-V asks for
|
// Spot check that a value conversion is inserted when SPIR-V asks for an unsigned int result.
|
||||||
// an unsigned int result.
|
|
||||||
ImageQueryLevels_UnsignedResult,
|
ImageQueryLevels_UnsignedResult,
|
||||||
SpvParserHandleTest_SampledImageAccessTest,
|
SpvParserHandleTest_SampledImageAccessTest,
|
||||||
::testing::ValuesIn(std::vector<ImageAccessCase>{
|
::testing::ValuesIn(std::vector<ImageAccessCase>{
|
||||||
|
|
|
@ -838,7 +838,7 @@ class ParserImpl {
|
||||||
|
|
||||||
/// Creates a new `ast::Node` owned by the Module. When the Module is
|
/// Creates a new `ast::Node` owned by the Module. When the Module is
|
||||||
/// destructed, the `ast::Node` will also be destructed.
|
/// destructed, the `ast::Node` will also be destructed.
|
||||||
/// @param args the arguments to pass to the type constructor
|
/// @param args the arguments to pass to the constructor
|
||||||
/// @returns the node pointer
|
/// @returns the node pointer
|
||||||
template <typename T, typename... ARGS>
|
template <typename T, typename... ARGS>
|
||||||
T* create(ARGS&&... args) {
|
T* create(ARGS&&... args) {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include "src/tint/ast/builtin_texture_helper_test.h"
|
#include "src/tint/ast/builtin_texture_helper_test.h"
|
||||||
#include "src/tint/resolver/resolver_test_helper.h"
|
#include "src/tint/resolver/resolver_test_helper.h"
|
||||||
#include "src/tint/sem/type_initializer.h"
|
#include "src/tint/sem/value_constructor.h"
|
||||||
|
|
||||||
using namespace tint::number_suffixes; // NOLINT
|
using namespace tint::number_suffixes; // NOLINT
|
||||||
|
|
||||||
|
@ -147,9 +147,9 @@ TEST_F(ResolverBuiltinValidationTest, BuiltinRedeclaredAsAliasUsedAsFunction) {
|
||||||
WrapInFunction(Call(Source{{56, 78}}, "mix", 1_f, 2_f, 3_f));
|
WrapInFunction(Call(Source{{56, 78}}, "mix", 1_f, 2_f, 3_f));
|
||||||
|
|
||||||
EXPECT_FALSE(r()->Resolve());
|
EXPECT_FALSE(r()->Resolve());
|
||||||
EXPECT_EQ(r()->error(), R"(56:78 error: no matching initializer for i32(f32, f32, f32)
|
EXPECT_EQ(r()->error(), R"(56:78 error: no matching constructor for i32(f32, f32, f32)
|
||||||
|
|
||||||
2 candidate initializers:
|
2 candidate constructors:
|
||||||
i32(i32) -> i32
|
i32(i32) -> i32
|
||||||
i32() -> i32
|
i32() -> i32
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ TEST_F(ResolverBuiltinValidationTest, BuiltinRedeclaredAsStructUsedAsFunction) {
|
||||||
|
|
||||||
EXPECT_FALSE(r()->Resolve());
|
EXPECT_FALSE(r()->Resolve());
|
||||||
EXPECT_EQ(r()->error(),
|
EXPECT_EQ(r()->error(),
|
||||||
R"(12:34 error: struct initializer has too many inputs: expected 1, found 3)");
|
R"(12:34 error: structure constructor has too many inputs: expected 1, found 3)");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ResolverBuiltinValidationTest, BuiltinRedeclaredAsStructUsedAsType) {
|
TEST_F(ResolverBuiltinValidationTest, BuiltinRedeclaredAsStructUsedAsType) {
|
||||||
|
@ -309,8 +309,8 @@ TEST_P(BuiltinTextureConstExprArgValidationTest, Immediate) {
|
||||||
auto args = overload.args(this);
|
auto args = overload.args(this);
|
||||||
auto*& arg_to_replace = (param.position == Position::kFirst) ? args.Front() : args.Back();
|
auto*& arg_to_replace = (param.position == Position::kFirst) ? args.Front() : args.Back();
|
||||||
|
|
||||||
// BuildTextureVariable() uses a Literal for scalars, and a CallExpression for
|
// BuildTextureVariable() uses a Literal for scalars, and a CallExpression for a vector
|
||||||
// a vector initializer.
|
// constructor.
|
||||||
bool is_vector = arg_to_replace->Is<ast::CallExpression>();
|
bool is_vector = arg_to_replace->Is<ast::CallExpression>();
|
||||||
|
|
||||||
// Make the expression to be replaced, reachable. This keeps the resolver happy.
|
// Make the expression to be replaced, reachable. This keeps the resolver happy.
|
||||||
|
@ -366,8 +366,8 @@ TEST_P(BuiltinTextureConstExprArgValidationTest, GlobalConst) {
|
||||||
auto args = overload.args(this);
|
auto args = overload.args(this);
|
||||||
auto*& arg_to_replace = (param.position == Position::kFirst) ? args.Front() : args.Back();
|
auto*& arg_to_replace = (param.position == Position::kFirst) ? args.Front() : args.Back();
|
||||||
|
|
||||||
// BuildTextureVariable() uses a Literal for scalars, and a CallExpression for
|
// BuildTextureVariable() uses a Literal for scalars, and a CallExpression for a vector
|
||||||
// a vector initializer.
|
// constructor.
|
||||||
bool is_vector = arg_to_replace->Is<ast::CallExpression>();
|
bool is_vector = arg_to_replace->Is<ast::CallExpression>();
|
||||||
|
|
||||||
// Make the expression to be replaced, reachable. This keeps the resolver happy.
|
// Make the expression to be replaced, reachable. This keeps the resolver happy.
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include "src/tint/number.h"
|
#include "src/tint/number.h"
|
||||||
#include "src/tint/program_builder.h"
|
#include "src/tint/program_builder.h"
|
||||||
#include "src/tint/sem/member_accessor_expression.h"
|
#include "src/tint/sem/member_accessor_expression.h"
|
||||||
#include "src/tint/sem/type_initializer.h"
|
#include "src/tint/sem/value_constructor.h"
|
||||||
#include "src/tint/type/abstract_float.h"
|
#include "src/tint/type/abstract_float.h"
|
||||||
#include "src/tint/type/abstract_int.h"
|
#include "src/tint/type/abstract_int.h"
|
||||||
#include "src/tint/type/array.h"
|
#include "src/tint/type/array.h"
|
||||||
|
@ -1228,18 +1228,18 @@ ConstEval::Result ConstEval::Literal(const type::Type* ty, const ast::LiteralExp
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ConstEval::Result ConstEval::ArrayOrStructInit(const type::Type* ty,
|
ConstEval::Result ConstEval::ArrayOrStructCtor(const type::Type* ty,
|
||||||
utils::VectorRef<const sem::ValueExpression*> args) {
|
utils::VectorRef<const sem::ValueExpression*> args) {
|
||||||
if (args.IsEmpty()) {
|
if (args.IsEmpty()) {
|
||||||
return ZeroValue(ty);
|
return ZeroValue(ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.Length() == 1 && args[0]->Type() == ty) {
|
if (args.Length() == 1 && args[0]->Type() == ty) {
|
||||||
// Identity initializer.
|
// Identity constructor.
|
||||||
return args[0]->ConstantValue();
|
return args[0]->ConstantValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Multiple arguments. Must be a type initializer.
|
// Multiple arguments. Must be a value constructor.
|
||||||
utils::Vector<const constant::Value*, 4> els;
|
utils::Vector<const constant::Value*, 4> els;
|
||||||
els.Reserve(args.Length());
|
els.Reserve(args.Length());
|
||||||
for (auto* arg : args) {
|
for (auto* arg : args) {
|
||||||
|
|
|
@ -80,7 +80,7 @@ class ConstEval {
|
||||||
/// @param ty the target type - must be an array or initializer
|
/// @param ty the target type - must be an array or initializer
|
||||||
/// @param args the input arguments
|
/// @param args the input arguments
|
||||||
/// @return the constructed value, or null if the value cannot be calculated
|
/// @return the constructed value, or null if the value cannot be calculated
|
||||||
Result ArrayOrStructInit(const type::Type* ty,
|
Result ArrayOrStructCtor(const type::Type* ty,
|
||||||
utils::VectorRef<const sem::ValueExpression*> args);
|
utils::VectorRef<const sem::ValueExpression*> args);
|
||||||
|
|
||||||
/// @param ty the target type
|
/// @param ty the target type
|
||||||
|
@ -127,7 +127,7 @@ class ConstEval {
|
||||||
// Constant value evaluation methods, to be indirectly called via the intrinsic table
|
// Constant value evaluation methods, to be indirectly called via the intrinsic table
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/// Type conversion
|
/// Value conversion
|
||||||
/// @param ty the result type
|
/// @param ty the result type
|
||||||
/// @param args the input arguments
|
/// @param args the input arguments
|
||||||
/// @param source the source location
|
/// @param source the source location
|
||||||
|
@ -136,7 +136,7 @@ class ConstEval {
|
||||||
utils::VectorRef<const constant::Value*> args,
|
utils::VectorRef<const constant::Value*> args,
|
||||||
const Source& source);
|
const Source& source);
|
||||||
|
|
||||||
/// Zero value type initializer
|
/// Zero value constructor
|
||||||
/// @param ty the result type
|
/// @param ty the result type
|
||||||
/// @param args the input arguments (no arguments provided)
|
/// @param args the input arguments (no arguments provided)
|
||||||
/// @param source the source location
|
/// @param source the source location
|
||||||
|
@ -145,7 +145,7 @@ class ConstEval {
|
||||||
utils::VectorRef<const constant::Value*> args,
|
utils::VectorRef<const constant::Value*> args,
|
||||||
const Source& source);
|
const Source& source);
|
||||||
|
|
||||||
/// Identity value type initializer
|
/// Identity value constructor
|
||||||
/// @param ty the result type
|
/// @param ty the result type
|
||||||
/// @param args the input arguments
|
/// @param args the input arguments
|
||||||
/// @param source the source location
|
/// @param source the source location
|
||||||
|
@ -154,7 +154,7 @@ class ConstEval {
|
||||||
utils::VectorRef<const constant::Value*> args,
|
utils::VectorRef<const constant::Value*> args,
|
||||||
const Source& source);
|
const Source& source);
|
||||||
|
|
||||||
/// Vector splat initializer
|
/// Vector splat constructor
|
||||||
/// @param ty the vector type
|
/// @param ty the vector type
|
||||||
/// @param args the input arguments
|
/// @param args the input arguments
|
||||||
/// @param source the source location
|
/// @param source the source location
|
||||||
|
@ -163,7 +163,7 @@ class ConstEval {
|
||||||
utils::VectorRef<const constant::Value*> args,
|
utils::VectorRef<const constant::Value*> args,
|
||||||
const Source& source);
|
const Source& source);
|
||||||
|
|
||||||
/// Vector initializer using scalars
|
/// Vector constructor using scalars
|
||||||
/// @param ty the vector type
|
/// @param ty the vector type
|
||||||
/// @param args the input arguments
|
/// @param args the input arguments
|
||||||
/// @param source the source location
|
/// @param source the source location
|
||||||
|
@ -172,7 +172,7 @@ class ConstEval {
|
||||||
utils::VectorRef<const constant::Value*> args,
|
utils::VectorRef<const constant::Value*> args,
|
||||||
const Source& source);
|
const Source& source);
|
||||||
|
|
||||||
/// Vector initializer using a mix of scalars and smaller vectors
|
/// Vector constructor using a mix of scalars and smaller vectors
|
||||||
/// @param ty the vector type
|
/// @param ty the vector type
|
||||||
/// @param args the input arguments
|
/// @param args the input arguments
|
||||||
/// @param source the source location
|
/// @param source the source location
|
||||||
|
@ -181,7 +181,7 @@ class ConstEval {
|
||||||
utils::VectorRef<const constant::Value*> args,
|
utils::VectorRef<const constant::Value*> args,
|
||||||
const Source& source);
|
const Source& source);
|
||||||
|
|
||||||
/// Matrix initializer using scalar values
|
/// Matrix constructor using scalar values
|
||||||
/// @param ty the matrix type
|
/// @param ty the matrix type
|
||||||
/// @param args the input arguments
|
/// @param args the input arguments
|
||||||
/// @param source the source location
|
/// @param source the source location
|
||||||
|
@ -190,7 +190,7 @@ class ConstEval {
|
||||||
utils::VectorRef<const constant::Value*> args,
|
utils::VectorRef<const constant::Value*> args,
|
||||||
const Source& source);
|
const Source& source);
|
||||||
|
|
||||||
/// Matrix initializer using column vectors
|
/// Matrix constructor using column vectors
|
||||||
/// @param ty the matrix type
|
/// @param ty the matrix type
|
||||||
/// @param args the input arguments
|
/// @param args the input arguments
|
||||||
/// @param source the source location
|
/// @param source the source location
|
||||||
|
|
|
@ -1876,7 +1876,7 @@ TEST_F(ResolverConstEvalTest, ShortCircuit_Or_Error_Bitcast) {
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////
|
////////////////////////////////////////////////
|
||||||
// Short-Circuit Type Init/Convert
|
// Short-Circuit value construction / conversion
|
||||||
////////////////////////////////////////////////
|
////////////////////////////////////////////////
|
||||||
|
|
||||||
// NOTE: Cannot demonstrate short-circuiting an invalid init/convert as const eval of init/convert
|
// NOTE: Cannot demonstrate short-circuiting an invalid init/convert as const eval of init/convert
|
||||||
|
@ -1892,9 +1892,9 @@ TEST_F(ResolverConstEvalTest, ShortCircuit_And_Error_Init) {
|
||||||
|
|
||||||
EXPECT_FALSE(r()->Resolve());
|
EXPECT_FALSE(r()->Resolve());
|
||||||
EXPECT_EQ(r()->error(),
|
EXPECT_EQ(r()->error(),
|
||||||
R"(12:34 error: no matching initializer for vec2<f32>(abstract-float, bool)
|
R"(12:34 error: no matching constructor for vec2<f32>(abstract-float, bool)
|
||||||
|
|
||||||
4 candidate initializers:
|
4 candidate constructors:
|
||||||
vec2(x: T, y: T) -> vec2<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
vec2(x: T, y: T) -> vec2<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
||||||
vec2(T) -> vec2<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
vec2(T) -> vec2<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
||||||
vec2(vec2<T>) -> vec2<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
vec2(vec2<T>) -> vec2<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
||||||
|
@ -1919,9 +1919,9 @@ TEST_F(ResolverConstEvalTest, ShortCircuit_Or_Error_Init) {
|
||||||
|
|
||||||
EXPECT_FALSE(r()->Resolve());
|
EXPECT_FALSE(r()->Resolve());
|
||||||
EXPECT_EQ(r()->error(),
|
EXPECT_EQ(r()->error(),
|
||||||
R"(12:34 error: no matching initializer for vec2<f32>(abstract-float, bool)
|
R"(12:34 error: no matching constructor for vec2<f32>(abstract-float, bool)
|
||||||
|
|
||||||
4 candidate initializers:
|
4 candidate constructors:
|
||||||
vec2(x: T, y: T) -> vec2<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
vec2(x: T, y: T) -> vec2<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
||||||
vec2(T) -> vec2<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
vec2(T) -> vec2<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
||||||
vec2(vec2<T>) -> vec2<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
vec2(vec2<T>) -> vec2<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
||||||
|
@ -1958,7 +1958,7 @@ TEST_F(ResolverConstEvalTest, ShortCircuit_And_Error_StructInit) {
|
||||||
|
|
||||||
EXPECT_FALSE(r()->Resolve());
|
EXPECT_FALSE(r()->Resolve());
|
||||||
EXPECT_EQ(r()->error(),
|
EXPECT_EQ(r()->error(),
|
||||||
"12:34 error: type in struct initializer does not match struct member type: "
|
"12:34 error: type in structure constructor does not match struct member type: "
|
||||||
"expected 'f32', found 'bool'");
|
"expected 'f32', found 'bool'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1977,7 +1977,7 @@ TEST_F(ResolverConstEvalTest, ShortCircuit_Or_Error_StructInit) {
|
||||||
|
|
||||||
EXPECT_FALSE(r()->Resolve());
|
EXPECT_FALSE(r()->Resolve());
|
||||||
EXPECT_EQ(r()->error(),
|
EXPECT_EQ(r()->error(),
|
||||||
"12:34 error: type in struct initializer does not match struct member type: "
|
"12:34 error: type in structure constructor does not match struct member type: "
|
||||||
"expected 'f32', found 'bool'");
|
"expected 'f32', found 'bool'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,52 +15,52 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// File generated by tools/src/cmd/gen
|
// File generated by tools/src/cmd/gen
|
||||||
// using the template:
|
// using the template:
|
||||||
// src/tint/resolver/init_conv_intrinsic.cc.tmpl
|
// src/tint/resolver/ctor_conv_intrinsic.cc.tmpl
|
||||||
//
|
//
|
||||||
// Do not modify this file directly
|
// Do not modify this file directly
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "src/tint/resolver/init_conv_intrinsic.h"
|
#include "src/tint/resolver/ctor_conv_intrinsic.h"
|
||||||
|
|
||||||
namespace tint::resolver {
|
namespace tint::resolver {
|
||||||
|
|
||||||
const char* str(InitConvIntrinsic i) {
|
const char* str(CtorConvIntrinsic i) {
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case InitConvIntrinsic::kNone:
|
case CtorConvIntrinsic::kNone:
|
||||||
return "<none>";
|
return "<none>";
|
||||||
case InitConvIntrinsic::kI32:
|
case CtorConvIntrinsic::kI32:
|
||||||
return "i32";
|
return "i32";
|
||||||
case InitConvIntrinsic::kU32:
|
case CtorConvIntrinsic::kU32:
|
||||||
return "u32";
|
return "u32";
|
||||||
case InitConvIntrinsic::kF32:
|
case CtorConvIntrinsic::kF32:
|
||||||
return "f32";
|
return "f32";
|
||||||
case InitConvIntrinsic::kF16:
|
case CtorConvIntrinsic::kF16:
|
||||||
return "f16";
|
return "f16";
|
||||||
case InitConvIntrinsic::kBool:
|
case CtorConvIntrinsic::kBool:
|
||||||
return "bool";
|
return "bool";
|
||||||
case InitConvIntrinsic::kVec2:
|
case CtorConvIntrinsic::kVec2:
|
||||||
return "vec2";
|
return "vec2";
|
||||||
case InitConvIntrinsic::kVec3:
|
case CtorConvIntrinsic::kVec3:
|
||||||
return "vec3";
|
return "vec3";
|
||||||
case InitConvIntrinsic::kVec4:
|
case CtorConvIntrinsic::kVec4:
|
||||||
return "vec4";
|
return "vec4";
|
||||||
case InitConvIntrinsic::kMat2x2:
|
case CtorConvIntrinsic::kMat2x2:
|
||||||
return "mat2x2";
|
return "mat2x2";
|
||||||
case InitConvIntrinsic::kMat2x3:
|
case CtorConvIntrinsic::kMat2x3:
|
||||||
return "mat2x3";
|
return "mat2x3";
|
||||||
case InitConvIntrinsic::kMat2x4:
|
case CtorConvIntrinsic::kMat2x4:
|
||||||
return "mat2x4";
|
return "mat2x4";
|
||||||
case InitConvIntrinsic::kMat3x2:
|
case CtorConvIntrinsic::kMat3x2:
|
||||||
return "mat3x2";
|
return "mat3x2";
|
||||||
case InitConvIntrinsic::kMat3x3:
|
case CtorConvIntrinsic::kMat3x3:
|
||||||
return "mat3x3";
|
return "mat3x3";
|
||||||
case InitConvIntrinsic::kMat3x4:
|
case CtorConvIntrinsic::kMat3x4:
|
||||||
return "mat3x4";
|
return "mat3x4";
|
||||||
case InitConvIntrinsic::kMat4x2:
|
case CtorConvIntrinsic::kMat4x2:
|
||||||
return "mat4x2";
|
return "mat4x2";
|
||||||
case InitConvIntrinsic::kMat4x3:
|
case CtorConvIntrinsic::kMat4x3:
|
||||||
return "mat4x3";
|
return "mat4x3";
|
||||||
case InitConvIntrinsic::kMat4x4:
|
case CtorConvIntrinsic::kMat4x4:
|
||||||
return "mat4x4";
|
return "mat4x4";
|
||||||
}
|
}
|
||||||
return "<unknown>";
|
return "<unknown>";
|
|
@ -1,6 +1,6 @@
|
||||||
{{- /*
|
{{- /*
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
Template file for use with tools/src/cmd/gen to generate init_conv_intrinsic.cc
|
Template file for use with tools/src/cmd/gen to generate ctor_conv_intrinsic.cc
|
||||||
|
|
||||||
To update the generated file, run:
|
To update the generated file, run:
|
||||||
./tools/run gen
|
./tools/run gen
|
||||||
|
@ -11,16 +11,16 @@ See:
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
*/ -}}
|
*/ -}}
|
||||||
|
|
||||||
#include "src/tint/resolver/init_conv_intrinsic.h"
|
#include "src/tint/resolver/ctor_conv_intrinsic.h"
|
||||||
|
|
||||||
namespace tint::resolver {
|
namespace tint::resolver {
|
||||||
|
|
||||||
const char* str(InitConvIntrinsic i) {
|
const char* str(CtorConvIntrinsic i) {
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case InitConvIntrinsic::kNone:
|
case CtorConvIntrinsic::kNone:
|
||||||
return "<none>";
|
return "<none>";
|
||||||
{{- range Sem.InitializersAndConverters }}
|
{{- range Sem.ConstructorsAndConverters }}
|
||||||
case InitConvIntrinsic::k{{Title .Name}}:
|
case CtorConvIntrinsic::k{{Title .Name}}:
|
||||||
return "{{.Name}}";
|
return "{{.Name}}";
|
||||||
{{- end }}
|
{{- end }}
|
||||||
}
|
}
|
|
@ -15,21 +15,21 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// File generated by tools/src/cmd/gen
|
// File generated by tools/src/cmd/gen
|
||||||
// using the template:
|
// using the template:
|
||||||
// src/tint/resolver/init_conv_intrinsic.h.tmpl
|
// src/tint/resolver/ctor_conv_intrinsic.h.tmpl
|
||||||
//
|
//
|
||||||
// Do not modify this file directly
|
// Do not modify this file directly
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef SRC_TINT_RESOLVER_INIT_CONV_INTRINSIC_H_
|
#ifndef SRC_TINT_RESOLVER_CTOR_CONV_INTRINSIC_H_
|
||||||
#define SRC_TINT_RESOLVER_INIT_CONV_INTRINSIC_H_
|
#define SRC_TINT_RESOLVER_CTOR_CONV_INTRINSIC_H_
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace tint::resolver {
|
namespace tint::resolver {
|
||||||
|
|
||||||
/// InitConvIntrinsic is an enumerator of types that have a initializer or converter overload
|
/// CtorConvIntrinsic is an enumerator of types that have a constructor or converter overload
|
||||||
/// declared in the intrinsic table.
|
/// declared in the intrinsic table.
|
||||||
enum class InitConvIntrinsic {
|
enum class CtorConvIntrinsic {
|
||||||
kNone = -1,
|
kNone = -1,
|
||||||
kI32,
|
kI32,
|
||||||
kU32,
|
kU32,
|
||||||
|
@ -51,49 +51,49 @@ enum class InitConvIntrinsic {
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @returns the name of the type.
|
/// @returns the name of the type.
|
||||||
const char* str(InitConvIntrinsic i);
|
const char* str(CtorConvIntrinsic i);
|
||||||
|
|
||||||
/// @param n the width of the vector
|
/// @param n the width of the vector
|
||||||
/// @return the InitConvIntrinsic for a vector of width `n`
|
/// @return the CtorConvIntrinsic for a vector of width `n`
|
||||||
inline InitConvIntrinsic VectorInitConvIntrinsic(uint32_t n) {
|
inline CtorConvIntrinsic VectorCtorConvIntrinsic(uint32_t n) {
|
||||||
switch (n) {
|
switch (n) {
|
||||||
case 2:
|
case 2:
|
||||||
return InitConvIntrinsic::kVec2;
|
return CtorConvIntrinsic::kVec2;
|
||||||
case 3:
|
case 3:
|
||||||
return InitConvIntrinsic::kVec3;
|
return CtorConvIntrinsic::kVec3;
|
||||||
case 4:
|
case 4:
|
||||||
return InitConvIntrinsic::kVec4;
|
return CtorConvIntrinsic::kVec4;
|
||||||
}
|
}
|
||||||
return InitConvIntrinsic::kNone;
|
return CtorConvIntrinsic::kNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @param c the number of columns in the matrix
|
/// @param c the number of columns in the matrix
|
||||||
/// @param r the number of rows in the matrix
|
/// @param r the number of rows in the matrix
|
||||||
/// @return the InitConvIntrinsic for a matrix with `c` columns and `r` rows
|
/// @return the CtorConvIntrinsic for a matrix with `c` columns and `r` rows
|
||||||
inline InitConvIntrinsic MatrixInitConvIntrinsic(uint32_t c, uint32_t r) {
|
inline CtorConvIntrinsic MatrixCtorConvIntrinsic(uint32_t c, uint32_t r) {
|
||||||
switch ((c - 2) * 3 + (r - 2)) {
|
switch ((c - 2) * 3 + (r - 2)) {
|
||||||
case 0:
|
case 0:
|
||||||
return InitConvIntrinsic::kMat2x2;
|
return CtorConvIntrinsic::kMat2x2;
|
||||||
case 1:
|
case 1:
|
||||||
return InitConvIntrinsic::kMat2x3;
|
return CtorConvIntrinsic::kMat2x3;
|
||||||
case 2:
|
case 2:
|
||||||
return InitConvIntrinsic::kMat2x4;
|
return CtorConvIntrinsic::kMat2x4;
|
||||||
case 3:
|
case 3:
|
||||||
return InitConvIntrinsic::kMat3x2;
|
return CtorConvIntrinsic::kMat3x2;
|
||||||
case 4:
|
case 4:
|
||||||
return InitConvIntrinsic::kMat3x3;
|
return CtorConvIntrinsic::kMat3x3;
|
||||||
case 5:
|
case 5:
|
||||||
return InitConvIntrinsic::kMat3x4;
|
return CtorConvIntrinsic::kMat3x4;
|
||||||
case 6:
|
case 6:
|
||||||
return InitConvIntrinsic::kMat4x2;
|
return CtorConvIntrinsic::kMat4x2;
|
||||||
case 7:
|
case 7:
|
||||||
return InitConvIntrinsic::kMat4x3;
|
return CtorConvIntrinsic::kMat4x3;
|
||||||
case 8:
|
case 8:
|
||||||
return InitConvIntrinsic::kMat4x4;
|
return CtorConvIntrinsic::kMat4x4;
|
||||||
}
|
}
|
||||||
return InitConvIntrinsic::kNone;
|
return CtorConvIntrinsic::kNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace tint::resolver
|
} // namespace tint::resolver
|
||||||
|
|
||||||
#endif // SRC_TINT_RESOLVER_INIT_CONV_INTRINSIC_H_
|
#endif // SRC_TINT_RESOLVER_CTOR_CONV_INTRINSIC_H_
|
|
@ -0,0 +1,76 @@
|
||||||
|
{{- /*
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
Template file for use with tools/src/cmd/gen to generate ctor_conv_intrinsic.h
|
||||||
|
|
||||||
|
To update the generated file, run:
|
||||||
|
./tools/run gen
|
||||||
|
|
||||||
|
See:
|
||||||
|
* tools/src/cmd/gen for structures used by this template
|
||||||
|
* https://golang.org/pkg/text/template/ for documentation on the template syntax
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
*/ -}}
|
||||||
|
|
||||||
|
#ifndef SRC_TINT_RESOLVER_CTOR_CONV_INTRINSIC_H_
|
||||||
|
#define SRC_TINT_RESOLVER_CTOR_CONV_INTRINSIC_H_
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
namespace tint::resolver {
|
||||||
|
|
||||||
|
/// CtorConvIntrinsic is an enumerator of types that have a constructor or converter overload
|
||||||
|
/// declared in the intrinsic table.
|
||||||
|
enum class CtorConvIntrinsic {
|
||||||
|
kNone = -1,
|
||||||
|
{{- range Sem.ConstructorsAndConverters }}
|
||||||
|
k{{Title .Name}},
|
||||||
|
{{- end }}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// @returns the name of the type.
|
||||||
|
const char* str(CtorConvIntrinsic i);
|
||||||
|
|
||||||
|
/// @param n the width of the vector
|
||||||
|
/// @return the CtorConvIntrinsic for a vector of width `n`
|
||||||
|
inline CtorConvIntrinsic VectorCtorConvIntrinsic(uint32_t n) {
|
||||||
|
switch (n) {
|
||||||
|
case 2:
|
||||||
|
return CtorConvIntrinsic::kVec2;
|
||||||
|
case 3:
|
||||||
|
return CtorConvIntrinsic::kVec3;
|
||||||
|
case 4:
|
||||||
|
return CtorConvIntrinsic::kVec4;
|
||||||
|
}
|
||||||
|
return CtorConvIntrinsic::kNone;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @param c the number of columns in the matrix
|
||||||
|
/// @param r the number of rows in the matrix
|
||||||
|
/// @return the CtorConvIntrinsic for a matrix with `c` columns and `r` rows
|
||||||
|
inline CtorConvIntrinsic MatrixCtorConvIntrinsic(uint32_t c, uint32_t r) {
|
||||||
|
switch ((c - 2) * 3 + (r - 2)) {
|
||||||
|
case 0:
|
||||||
|
return CtorConvIntrinsic::kMat2x2;
|
||||||
|
case 1:
|
||||||
|
return CtorConvIntrinsic::kMat2x3;
|
||||||
|
case 2:
|
||||||
|
return CtorConvIntrinsic::kMat2x4;
|
||||||
|
case 3:
|
||||||
|
return CtorConvIntrinsic::kMat3x2;
|
||||||
|
case 4:
|
||||||
|
return CtorConvIntrinsic::kMat3x3;
|
||||||
|
case 5:
|
||||||
|
return CtorConvIntrinsic::kMat3x4;
|
||||||
|
case 6:
|
||||||
|
return CtorConvIntrinsic::kMat4x2;
|
||||||
|
case 7:
|
||||||
|
return CtorConvIntrinsic::kMat4x3;
|
||||||
|
case 8:
|
||||||
|
return CtorConvIntrinsic::kMat4x4;
|
||||||
|
}
|
||||||
|
return CtorConvIntrinsic::kNone;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace tint::resolver
|
||||||
|
|
||||||
|
#endif // SRC_TINT_RESOLVER_CTOR_CONV_INTRINSIC_H_
|
|
@ -445,7 +445,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
R"(5:6 error: cannot use type 'vec4<f32>' as address space)"},
|
R"(5:6 error: cannot use type 'vec4<f32>' as address space)"},
|
||||||
{Def::kBuiltinType, Use::kBinaryOp,
|
{Def::kBuiltinType, Use::kBinaryOp,
|
||||||
R"(5:6 error: cannot use type 'vec4<f32>' as value
|
R"(5:6 error: cannot use type 'vec4<f32>' as value
|
||||||
7:8 note: are you missing '()' for type initializer?)"},
|
7:8 note: are you missing '()' for value constructor?)"},
|
||||||
{Def::kBuiltinType, Use::kBuiltinValue,
|
{Def::kBuiltinType, Use::kBuiltinValue,
|
||||||
R"(5:6 error: cannot use type 'vec4<f32>' as builtin value)"},
|
R"(5:6 error: cannot use type 'vec4<f32>' as builtin value)"},
|
||||||
{Def::kBuiltinType, Use::kCallExpr, kPass},
|
{Def::kBuiltinType, Use::kCallExpr, kPass},
|
||||||
|
@ -459,11 +459,11 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
R"(5:6 error: cannot use type 'vec4<f32>' as texel format)"},
|
R"(5:6 error: cannot use type 'vec4<f32>' as texel format)"},
|
||||||
{Def::kBuiltinType, Use::kValueExpression,
|
{Def::kBuiltinType, Use::kValueExpression,
|
||||||
R"(5:6 error: cannot use type 'vec4<f32>' as value
|
R"(5:6 error: cannot use type 'vec4<f32>' as value
|
||||||
7:8 note: are you missing '()' for type initializer?)"},
|
7:8 note: are you missing '()' for value constructor?)"},
|
||||||
{Def::kBuiltinType, Use::kVariableType, kPass},
|
{Def::kBuiltinType, Use::kVariableType, kPass},
|
||||||
{Def::kBuiltinType, Use::kUnaryOp,
|
{Def::kBuiltinType, Use::kUnaryOp,
|
||||||
R"(5:6 error: cannot use type 'vec4<f32>' as value
|
R"(5:6 error: cannot use type 'vec4<f32>' as value
|
||||||
7:8 note: are you missing '()' for type initializer?)"},
|
7:8 note: are you missing '()' for value constructor?)"},
|
||||||
|
|
||||||
{Def::kBuiltinValue, Use::kAccess,
|
{Def::kBuiltinValue, Use::kAccess,
|
||||||
R"(5:6 error: cannot use builtin value 'position' as access)"},
|
R"(5:6 error: cannot use builtin value 'position' as access)"},
|
||||||
|
@ -602,7 +602,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
{Def::kStruct, Use::kAddressSpace,
|
{Def::kStruct, Use::kAddressSpace,
|
||||||
R"(5:6 error: cannot use type 'STRUCT' as address space)"},
|
R"(5:6 error: cannot use type 'STRUCT' as address space)"},
|
||||||
{Def::kStruct, Use::kBinaryOp, R"(5:6 error: cannot use type 'STRUCT' as value
|
{Def::kStruct, Use::kBinaryOp, R"(5:6 error: cannot use type 'STRUCT' as value
|
||||||
7:8 note: are you missing '()' for type initializer?
|
7:8 note: are you missing '()' for value constructor?
|
||||||
1:2 note: struct 'STRUCT' declared here)"},
|
1:2 note: struct 'STRUCT' declared here)"},
|
||||||
{Def::kStruct, Use::kBuiltinValue,
|
{Def::kStruct, Use::kBuiltinValue,
|
||||||
R"(5:6 error: cannot use type 'STRUCT' as builtin value)"},
|
R"(5:6 error: cannot use type 'STRUCT' as builtin value)"},
|
||||||
|
@ -615,12 +615,12 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
{Def::kStruct, Use::kTexelFormat, R"(5:6 error: cannot use type 'STRUCT' as texel format)"},
|
{Def::kStruct, Use::kTexelFormat, R"(5:6 error: cannot use type 'STRUCT' as texel format)"},
|
||||||
{Def::kStruct, Use::kValueExpression,
|
{Def::kStruct, Use::kValueExpression,
|
||||||
R"(5:6 error: cannot use type 'STRUCT' as value
|
R"(5:6 error: cannot use type 'STRUCT' as value
|
||||||
7:8 note: are you missing '()' for type initializer?
|
7:8 note: are you missing '()' for value constructor?
|
||||||
1:2 note: struct 'STRUCT' declared here)"},
|
1:2 note: struct 'STRUCT' declared here)"},
|
||||||
{Def::kStruct, Use::kVariableType, kPass},
|
{Def::kStruct, Use::kVariableType, kPass},
|
||||||
{Def::kStruct, Use::kUnaryOp,
|
{Def::kStruct, Use::kUnaryOp,
|
||||||
R"(5:6 error: cannot use type 'STRUCT' as value
|
R"(5:6 error: cannot use type 'STRUCT' as value
|
||||||
7:8 note: are you missing '()' for type initializer?
|
7:8 note: are you missing '()' for value constructor?
|
||||||
1:2 note: struct 'STRUCT' declared here)"},
|
1:2 note: struct 'STRUCT' declared here)"},
|
||||||
|
|
||||||
{Def::kTexelFormat, Use::kAccess,
|
{Def::kTexelFormat, Use::kAccess,
|
||||||
|
@ -656,7 +656,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
R"(5:6 error: cannot use type 'i32' as address space)"},
|
R"(5:6 error: cannot use type 'i32' as address space)"},
|
||||||
{Def::kTypeAlias, Use::kBinaryOp,
|
{Def::kTypeAlias, Use::kBinaryOp,
|
||||||
R"(5:6 error: cannot use type 'i32' as value
|
R"(5:6 error: cannot use type 'i32' as value
|
||||||
7:8 note: are you missing '()' for type initializer?)"},
|
7:8 note: are you missing '()' for value constructor?)"},
|
||||||
{Def::kTypeAlias, Use::kBuiltinValue,
|
{Def::kTypeAlias, Use::kBuiltinValue,
|
||||||
R"(5:6 error: cannot use type 'i32' as builtin value)"},
|
R"(5:6 error: cannot use type 'i32' as builtin value)"},
|
||||||
{Def::kTypeAlias, Use::kCallExpr, kPass},
|
{Def::kTypeAlias, Use::kCallExpr, kPass},
|
||||||
|
@ -669,11 +669,11 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
{Def::kTypeAlias, Use::kTexelFormat, R"(5:6 error: cannot use type 'i32' as texel format)"},
|
{Def::kTypeAlias, Use::kTexelFormat, R"(5:6 error: cannot use type 'i32' as texel format)"},
|
||||||
{Def::kTypeAlias, Use::kValueExpression,
|
{Def::kTypeAlias, Use::kValueExpression,
|
||||||
R"(5:6 error: cannot use type 'i32' as value
|
R"(5:6 error: cannot use type 'i32' as value
|
||||||
7:8 note: are you missing '()' for type initializer?)"},
|
7:8 note: are you missing '()' for value constructor?)"},
|
||||||
{Def::kTypeAlias, Use::kVariableType, kPass},
|
{Def::kTypeAlias, Use::kVariableType, kPass},
|
||||||
{Def::kTypeAlias, Use::kUnaryOp,
|
{Def::kTypeAlias, Use::kUnaryOp,
|
||||||
R"(5:6 error: cannot use type 'i32' as value
|
R"(5:6 error: cannot use type 'i32' as value
|
||||||
7:8 note: are you missing '()' for type initializer?)"},
|
7:8 note: are you missing '()' for value constructor?)"},
|
||||||
|
|
||||||
{Def::kVariable, Use::kAccess, R"(5:6 error: cannot use const 'VARIABLE' as access
|
{Def::kVariable, Use::kAccess, R"(5:6 error: cannot use const 'VARIABLE' as access
|
||||||
1:2 note: const 'VARIABLE' declared here)"},
|
1:2 note: const 'VARIABLE' declared here)"},
|
||||||
|
|
|
@ -1,76 +0,0 @@
|
||||||
{{- /*
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
Template file for use with tools/src/cmd/gen to generate init_conv_intrinsic.h
|
|
||||||
|
|
||||||
To update the generated file, run:
|
|
||||||
./tools/run gen
|
|
||||||
|
|
||||||
See:
|
|
||||||
* tools/src/cmd/gen for structures used by this template
|
|
||||||
* https://golang.org/pkg/text/template/ for documentation on the template syntax
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
*/ -}}
|
|
||||||
|
|
||||||
#ifndef SRC_TINT_RESOLVER_INIT_CONV_INTRINSIC_H_
|
|
||||||
#define SRC_TINT_RESOLVER_INIT_CONV_INTRINSIC_H_
|
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
namespace tint::resolver {
|
|
||||||
|
|
||||||
/// InitConvIntrinsic is an enumerator of types that have a initializer or converter overload
|
|
||||||
/// declared in the intrinsic table.
|
|
||||||
enum class InitConvIntrinsic {
|
|
||||||
kNone = -1,
|
|
||||||
{{- range Sem.InitializersAndConverters }}
|
|
||||||
k{{Title .Name}},
|
|
||||||
{{- end }}
|
|
||||||
};
|
|
||||||
|
|
||||||
/// @returns the name of the type.
|
|
||||||
const char* str(InitConvIntrinsic i);
|
|
||||||
|
|
||||||
/// @param n the width of the vector
|
|
||||||
/// @return the InitConvIntrinsic for a vector of width `n`
|
|
||||||
inline InitConvIntrinsic VectorInitConvIntrinsic(uint32_t n) {
|
|
||||||
switch (n) {
|
|
||||||
case 2:
|
|
||||||
return InitConvIntrinsic::kVec2;
|
|
||||||
case 3:
|
|
||||||
return InitConvIntrinsic::kVec3;
|
|
||||||
case 4:
|
|
||||||
return InitConvIntrinsic::kVec4;
|
|
||||||
}
|
|
||||||
return InitConvIntrinsic::kNone;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @param c the number of columns in the matrix
|
|
||||||
/// @param r the number of rows in the matrix
|
|
||||||
/// @return the InitConvIntrinsic for a matrix with `c` columns and `r` rows
|
|
||||||
inline InitConvIntrinsic MatrixInitConvIntrinsic(uint32_t c, uint32_t r) {
|
|
||||||
switch ((c - 2) * 3 + (r - 2)) {
|
|
||||||
case 0:
|
|
||||||
return InitConvIntrinsic::kMat2x2;
|
|
||||||
case 1:
|
|
||||||
return InitConvIntrinsic::kMat2x3;
|
|
||||||
case 2:
|
|
||||||
return InitConvIntrinsic::kMat2x4;
|
|
||||||
case 3:
|
|
||||||
return InitConvIntrinsic::kMat3x2;
|
|
||||||
case 4:
|
|
||||||
return InitConvIntrinsic::kMat3x3;
|
|
||||||
case 5:
|
|
||||||
return InitConvIntrinsic::kMat3x4;
|
|
||||||
case 6:
|
|
||||||
return InitConvIntrinsic::kMat4x2;
|
|
||||||
case 7:
|
|
||||||
return InitConvIntrinsic::kMat4x3;
|
|
||||||
case 8:
|
|
||||||
return InitConvIntrinsic::kMat4x4;
|
|
||||||
}
|
|
||||||
return InitConvIntrinsic::kNone;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace tint::resolver
|
|
||||||
|
|
||||||
#endif // SRC_TINT_RESOLVER_INIT_CONV_INTRINSIC_H_
|
|
|
@ -22,8 +22,8 @@
|
||||||
#include "src/tint/program_builder.h"
|
#include "src/tint/program_builder.h"
|
||||||
#include "src/tint/sem/evaluation_stage.h"
|
#include "src/tint/sem/evaluation_stage.h"
|
||||||
#include "src/tint/sem/pipeline_stage_set.h"
|
#include "src/tint/sem/pipeline_stage_set.h"
|
||||||
#include "src/tint/sem/type_conversion.h"
|
#include "src/tint/sem/value_constructor.h"
|
||||||
#include "src/tint/sem/type_initializer.h"
|
#include "src/tint/sem/value_conversion.h"
|
||||||
#include "src/tint/type/abstract_float.h"
|
#include "src/tint/type/abstract_float.h"
|
||||||
#include "src/tint/type/abstract_int.h"
|
#include "src/tint/type/abstract_int.h"
|
||||||
#include "src/tint/type/abstract_numeric.h"
|
#include "src/tint/type/abstract_numeric.h"
|
||||||
|
@ -338,8 +338,8 @@ using PipelineStage = ast::PipelineStage;
|
||||||
enum class OverloadFlag {
|
enum class OverloadFlag {
|
||||||
kIsBuiltin, // The overload is a builtin ('fn')
|
kIsBuiltin, // The overload is a builtin ('fn')
|
||||||
kIsOperator, // The overload is an operator ('op')
|
kIsOperator, // The overload is an operator ('op')
|
||||||
kIsInitializer, // The overload is a type initializer ('ctor')
|
kIsConstructor, // The overload is a value constructor ('ctor')
|
||||||
kIsConverter, // The overload is a type converter ('conv')
|
kIsConverter, // The overload is a value converter ('conv')
|
||||||
kSupportsVertexPipeline, // The overload can be used in vertex shaders
|
kSupportsVertexPipeline, // The overload can be used in vertex shaders
|
||||||
kSupportsFragmentPipeline, // The overload can be used in fragment shaders
|
kSupportsFragmentPipeline, // The overload can be used in fragment shaders
|
||||||
kSupportsComputePipeline, // The overload can be used in compute shaders
|
kSupportsComputePipeline, // The overload can be used in compute shaders
|
||||||
|
@ -1093,7 +1093,7 @@ class Impl : public IntrinsicTable {
|
||||||
const Source& source,
|
const Source& source,
|
||||||
bool is_compound) override;
|
bool is_compound) override;
|
||||||
|
|
||||||
InitOrConv Lookup(InitConvIntrinsic type,
|
CtorOrConv Lookup(CtorConvIntrinsic type,
|
||||||
const type::Type* template_arg,
|
const type::Type* template_arg,
|
||||||
utils::VectorRef<const type::Type*> args,
|
utils::VectorRef<const type::Type*> args,
|
||||||
sem::EvaluationStage earliest_eval_stage,
|
sem::EvaluationStage earliest_eval_stage,
|
||||||
|
@ -1201,9 +1201,9 @@ class Impl : public IntrinsicTable {
|
||||||
ProgramBuilder& builder;
|
ProgramBuilder& builder;
|
||||||
Matchers matchers;
|
Matchers matchers;
|
||||||
utils::Hashmap<IntrinsicPrototype, sem::Builtin*, 64, IntrinsicPrototype::Hasher> builtins;
|
utils::Hashmap<IntrinsicPrototype, sem::Builtin*, 64, IntrinsicPrototype::Hasher> builtins;
|
||||||
utils::Hashmap<IntrinsicPrototype, sem::TypeInitializer*, 16, IntrinsicPrototype::Hasher>
|
utils::Hashmap<IntrinsicPrototype, sem::ValueConstructor*, 16, IntrinsicPrototype::Hasher>
|
||||||
initializers;
|
constructors;
|
||||||
utils::Hashmap<IntrinsicPrototype, sem::TypeConversion*, 16, IntrinsicPrototype::Hasher>
|
utils::Hashmap<IntrinsicPrototype, sem::ValueConversion*, 16, IntrinsicPrototype::Hasher>
|
||||||
converters;
|
converters;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1425,7 +1425,7 @@ IntrinsicTable::BinaryOperator Impl::Lookup(ast::BinaryOp op,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
IntrinsicTable::InitOrConv Impl::Lookup(InitConvIntrinsic type,
|
IntrinsicTable::CtorOrConv Impl::Lookup(CtorConvIntrinsic type,
|
||||||
const type::Type* template_arg,
|
const type::Type* template_arg,
|
||||||
utils::VectorRef<const type::Type*> args,
|
utils::VectorRef<const type::Type*> args,
|
||||||
sem::EvaluationStage earliest_eval_stage,
|
sem::EvaluationStage earliest_eval_stage,
|
||||||
|
@ -1435,11 +1435,11 @@ IntrinsicTable::InitOrConv Impl::Lookup(InitConvIntrinsic type,
|
||||||
// Generates an error when no overloads match the provided arguments
|
// Generates an error when no overloads match the provided arguments
|
||||||
auto on_no_match = [&](utils::VectorRef<Candidate> candidates) {
|
auto on_no_match = [&](utils::VectorRef<Candidate> candidates) {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << "no matching initializer for " << CallSignature(builder, name, args, template_arg)
|
ss << "no matching constructor for " << CallSignature(builder, name, args, template_arg)
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
Candidates ctor, conv;
|
Candidates ctor, conv;
|
||||||
for (auto candidate : candidates) {
|
for (auto candidate : candidates) {
|
||||||
if (candidate.overload->flags.Contains(OverloadFlag::kIsInitializer)) {
|
if (candidate.overload->flags.Contains(OverloadFlag::kIsConstructor)) {
|
||||||
ctor.Push(candidate);
|
ctor.Push(candidate);
|
||||||
} else {
|
} else {
|
||||||
conv.Push(candidate);
|
conv.Push(candidate);
|
||||||
|
@ -1447,7 +1447,7 @@ IntrinsicTable::InitOrConv Impl::Lookup(InitConvIntrinsic type,
|
||||||
}
|
}
|
||||||
if (!ctor.IsEmpty()) {
|
if (!ctor.IsEmpty()) {
|
||||||
ss << std::endl
|
ss << std::endl
|
||||||
<< ctor.Length() << " candidate initializer" << (ctor.Length() > 1 ? "s:" : ":")
|
<< ctor.Length() << " candidate constructor" << (ctor.Length() > 1 ? "s:" : ":")
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
PrintCandidates(ss, ctor, name);
|
PrintCandidates(ss, ctor, name);
|
||||||
}
|
}
|
||||||
|
@ -1467,14 +1467,14 @@ IntrinsicTable::InitOrConv Impl::Lookup(InitConvIntrinsic type,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolve the intrinsic overload
|
// Resolve the intrinsic overload
|
||||||
auto match = MatchIntrinsic(kInitializersAndConverters[static_cast<size_t>(type)], name, args,
|
auto match = MatchIntrinsic(kConstructorsAndConverters[static_cast<size_t>(type)], name, args,
|
||||||
earliest_eval_stage, templates, on_no_match);
|
earliest_eval_stage, templates, on_no_match);
|
||||||
if (!match.overload) {
|
if (!match.overload) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Was this overload a initializer or conversion?
|
// Was this overload a constructor or conversion?
|
||||||
if (match.overload->flags.Contains(OverloadFlag::kIsInitializer)) {
|
if (match.overload->flags.Contains(OverloadFlag::kIsConstructor)) {
|
||||||
utils::Vector<const sem::Parameter*, 8> params;
|
utils::Vector<const sem::Parameter*, 8> params;
|
||||||
params.Reserve(match.parameters.Length());
|
params.Reserve(match.parameters.Length());
|
||||||
for (auto& p : match.parameters) {
|
for (auto& p : match.parameters) {
|
||||||
|
@ -1484,11 +1484,11 @@ IntrinsicTable::InitOrConv Impl::Lookup(InitConvIntrinsic type,
|
||||||
}
|
}
|
||||||
auto eval_stage = match.overload->const_eval_fn ? sem::EvaluationStage::kConstant
|
auto eval_stage = match.overload->const_eval_fn ? sem::EvaluationStage::kConstant
|
||||||
: sem::EvaluationStage::kRuntime;
|
: sem::EvaluationStage::kRuntime;
|
||||||
auto* target = initializers.GetOrCreate(match, [&]() {
|
auto* target = constructors.GetOrCreate(match, [&]() {
|
||||||
return builder.create<sem::TypeInitializer>(match.return_type, std::move(params),
|
return builder.create<sem::ValueConstructor>(match.return_type, std::move(params),
|
||||||
eval_stage);
|
eval_stage);
|
||||||
});
|
});
|
||||||
return InitOrConv{target, match.overload->const_eval_fn};
|
return CtorOrConv{target, match.overload->const_eval_fn};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Conversion.
|
// Conversion.
|
||||||
|
@ -1498,9 +1498,9 @@ IntrinsicTable::InitOrConv Impl::Lookup(InitConvIntrinsic type,
|
||||||
builtin::Access::kUndefined, match.parameters[0].usage);
|
builtin::Access::kUndefined, match.parameters[0].usage);
|
||||||
auto eval_stage = match.overload->const_eval_fn ? sem::EvaluationStage::kConstant
|
auto eval_stage = match.overload->const_eval_fn ? sem::EvaluationStage::kConstant
|
||||||
: sem::EvaluationStage::kRuntime;
|
: sem::EvaluationStage::kRuntime;
|
||||||
return builder.create<sem::TypeConversion>(match.return_type, param, eval_stage);
|
return builder.create<sem::ValueConversion>(match.return_type, param, eval_stage);
|
||||||
});
|
});
|
||||||
return InitOrConv{target, match.overload->const_eval_fn};
|
return CtorOrConv{target, match.overload->const_eval_fn};
|
||||||
}
|
}
|
||||||
|
|
||||||
IntrinsicPrototype Impl::MatchIntrinsic(const IntrinsicInfo& intrinsic,
|
IntrinsicPrototype Impl::MatchIntrinsic(const IntrinsicInfo& intrinsic,
|
||||||
|
@ -1753,8 +1753,8 @@ void Impl::PrintOverload(std::ostream& ss,
|
||||||
// e.g. vec3<T>(vec3<U>) -> vec3<f32>
|
// e.g. vec3<T>(vec3<U>) -> vec3<f32>
|
||||||
print_template_type = true;
|
print_template_type = true;
|
||||||
} else if ((overload->num_parameters == 0) &&
|
} else if ((overload->num_parameters == 0) &&
|
||||||
overload->flags.Contains(OverloadFlag::kIsInitializer)) {
|
overload->flags.Contains(OverloadFlag::kIsConstructor)) {
|
||||||
// Print for initializers with no params
|
// Print for constructors with no params
|
||||||
// e.g. vec2<T>() -> vec2<T>
|
// e.g. vec2<T>() -> vec2<T>
|
||||||
print_template_type = true;
|
print_template_type = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "src/tint/ast/binary_expression.h"
|
#include "src/tint/ast/binary_expression.h"
|
||||||
#include "src/tint/ast/unary_op.h"
|
#include "src/tint/ast/unary_op.h"
|
||||||
#include "src/tint/resolver/const_eval.h"
|
#include "src/tint/resolver/const_eval.h"
|
||||||
#include "src/tint/resolver/init_conv_intrinsic.h"
|
#include "src/tint/resolver/ctor_conv_intrinsic.h"
|
||||||
#include "src/tint/sem/builtin.h"
|
#include "src/tint/sem/builtin.h"
|
||||||
#include "src/tint/utils/vector.h"
|
#include "src/tint/utils/vector.h"
|
||||||
|
|
||||||
|
@ -72,9 +72,9 @@ class IntrinsicTable {
|
||||||
ConstEval::Function const_eval_fn = nullptr;
|
ConstEval::Function const_eval_fn = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// InitOrConv describes a resolved type initializer or type conversion
|
/// CtorOrConv describes a resolved value constructor or conversion
|
||||||
struct InitOrConv {
|
struct CtorOrConv {
|
||||||
/// The result type of the type initializer or type conversion
|
/// The result type of the value constructor or conversion
|
||||||
const sem::CallTarget* target = nullptr;
|
const sem::CallTarget* target = nullptr;
|
||||||
/// The constant evaluation function
|
/// The constant evaluation function
|
||||||
ConstEval::Function const_eval_fn = nullptr;
|
ConstEval::Function const_eval_fn = nullptr;
|
||||||
|
@ -137,20 +137,20 @@ class IntrinsicTable {
|
||||||
const Source& source,
|
const Source& source,
|
||||||
bool is_compound) = 0;
|
bool is_compound) = 0;
|
||||||
|
|
||||||
/// Lookup looks for the type initializer or conversion overload for the given
|
/// Lookup looks for the value constructor or conversion overload for the given
|
||||||
/// InitConvIntrinsic.
|
/// CtorConvIntrinsic.
|
||||||
/// @param type the type being constructed or converted
|
/// @param type the type being constructed or converted
|
||||||
/// @param template_arg the optional template argument
|
/// @param template_arg the optional template argument
|
||||||
/// @param args the argument types passed to the initializer / conversion call
|
/// @param args the argument types passed to the constructor / conversion call
|
||||||
/// @param earliest_eval_stage the the earliest evaluation stage that a call to
|
/// @param earliest_eval_stage the the earliest evaluation stage that a call to
|
||||||
/// the initializer or conversion can be made. This can alter the overloads considered.
|
/// the constructor or conversion can be made. This can alter the overloads considered.
|
||||||
/// For example, if the earliest evaluation stage is
|
/// For example, if the earliest evaluation stage is
|
||||||
/// `sem::EvaluationStage::kRuntime`, then only overloads with concrete argument types
|
/// `sem::EvaluationStage::kRuntime`, then only overloads with concrete argument types
|
||||||
/// will be considered, as all abstract-numerics will have been materialized
|
/// will be considered, as all abstract-numerics will have been materialized
|
||||||
/// after shader creation time (sem::EvaluationStage::kConstant).
|
/// after shader creation time (sem::EvaluationStage::kConstant).
|
||||||
/// @param source the source of the call
|
/// @param source the source of the call
|
||||||
/// @return a sem::TypeInitializer, sem::TypeConversion or nullptr if nothing matched
|
/// @return a sem::ValueConstructor, sem::ValueConversion or nullptr if nothing matched
|
||||||
virtual InitOrConv Lookup(InitConvIntrinsic type,
|
virtual CtorOrConv Lookup(CtorConvIntrinsic type,
|
||||||
const type::Type* template_arg,
|
const type::Type* template_arg,
|
||||||
utils::VectorRef<const type::Type*> args,
|
utils::VectorRef<const type::Type*> args,
|
||||||
sem::EvaluationStage earliest_eval_stage,
|
sem::EvaluationStage earliest_eval_stage,
|
||||||
|
|
|
@ -8881,7 +8881,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[1013],
|
/* parameters */ &kParameters[1013],
|
||||||
/* return matcher indices */ &kMatcherIndices[134],
|
/* return matcher indices */ &kMatcherIndices[134],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Zero,
|
/* const eval */ &ConstEval::Zero,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -8893,7 +8893,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[979],
|
/* parameters */ &kParameters[979],
|
||||||
/* return matcher indices */ &kMatcherIndices[134],
|
/* return matcher indices */ &kMatcherIndices[134],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Identity,
|
/* const eval */ &ConstEval::Identity,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -8905,7 +8905,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[980],
|
/* parameters */ &kParameters[980],
|
||||||
/* return matcher indices */ &kMatcherIndices[134],
|
/* return matcher indices */ &kMatcherIndices[134],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::VecSplat,
|
/* const eval */ &ConstEval::VecSplat,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -8917,7 +8917,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[427],
|
/* parameters */ &kParameters[427],
|
||||||
/* return matcher indices */ &kMatcherIndices[134],
|
/* return matcher indices */ &kMatcherIndices[134],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::VecInitS,
|
/* const eval */ &ConstEval::VecInitS,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -8929,7 +8929,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[576],
|
/* parameters */ &kParameters[576],
|
||||||
/* return matcher indices */ &kMatcherIndices[134],
|
/* return matcher indices */ &kMatcherIndices[134],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::VecInitM,
|
/* const eval */ &ConstEval::VecInitM,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -8941,7 +8941,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[579],
|
/* parameters */ &kParameters[579],
|
||||||
/* return matcher indices */ &kMatcherIndices[134],
|
/* return matcher indices */ &kMatcherIndices[134],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::VecInitM,
|
/* const eval */ &ConstEval::VecInitM,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -8953,7 +8953,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[582],
|
/* parameters */ &kParameters[582],
|
||||||
/* return matcher indices */ &kMatcherIndices[134],
|
/* return matcher indices */ &kMatcherIndices[134],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::VecInitM,
|
/* const eval */ &ConstEval::VecInitM,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -8965,7 +8965,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[788],
|
/* parameters */ &kParameters[788],
|
||||||
/* return matcher indices */ &kMatcherIndices[134],
|
/* return matcher indices */ &kMatcherIndices[134],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::VecInitM,
|
/* const eval */ &ConstEval::VecInitM,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -8977,7 +8977,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[790],
|
/* parameters */ &kParameters[790],
|
||||||
/* return matcher indices */ &kMatcherIndices[134],
|
/* return matcher indices */ &kMatcherIndices[134],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::VecInitM,
|
/* const eval */ &ConstEval::VecInitM,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -8989,7 +8989,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[792],
|
/* parameters */ &kParameters[792],
|
||||||
/* return matcher indices */ &kMatcherIndices[134],
|
/* return matcher indices */ &kMatcherIndices[134],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::VecInitM,
|
/* const eval */ &ConstEval::VecInitM,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -9517,7 +9517,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[1013],
|
/* parameters */ &kParameters[1013],
|
||||||
/* return matcher indices */ &kMatcherIndices[106],
|
/* return matcher indices */ &kMatcherIndices[106],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Zero,
|
/* const eval */ &ConstEval::Zero,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -9529,7 +9529,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[972],
|
/* parameters */ &kParameters[972],
|
||||||
/* return matcher indices */ &kMatcherIndices[106],
|
/* return matcher indices */ &kMatcherIndices[106],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Identity,
|
/* const eval */ &ConstEval::Identity,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -9541,7 +9541,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[973],
|
/* parameters */ &kParameters[973],
|
||||||
/* return matcher indices */ &kMatcherIndices[106],
|
/* return matcher indices */ &kMatcherIndices[106],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::VecSplat,
|
/* const eval */ &ConstEval::VecSplat,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -9553,7 +9553,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[573],
|
/* parameters */ &kParameters[573],
|
||||||
/* return matcher indices */ &kMatcherIndices[106],
|
/* return matcher indices */ &kMatcherIndices[106],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::VecInitS,
|
/* const eval */ &ConstEval::VecInitS,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -9565,7 +9565,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[784],
|
/* parameters */ &kParameters[784],
|
||||||
/* return matcher indices */ &kMatcherIndices[106],
|
/* return matcher indices */ &kMatcherIndices[106],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::VecInitM,
|
/* const eval */ &ConstEval::VecInitM,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -9577,7 +9577,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[786],
|
/* parameters */ &kParameters[786],
|
||||||
/* return matcher indices */ &kMatcherIndices[106],
|
/* return matcher indices */ &kMatcherIndices[106],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::VecInitM,
|
/* const eval */ &ConstEval::VecInitM,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -9985,7 +9985,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[1013],
|
/* parameters */ &kParameters[1013],
|
||||||
/* return matcher indices */ &kMatcherIndices[23],
|
/* return matcher indices */ &kMatcherIndices[23],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Zero,
|
/* const eval */ &ConstEval::Zero,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -9997,7 +9997,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[965],
|
/* parameters */ &kParameters[965],
|
||||||
/* return matcher indices */ &kMatcherIndices[23],
|
/* return matcher indices */ &kMatcherIndices[23],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Identity,
|
/* const eval */ &ConstEval::Identity,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10009,7 +10009,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[966],
|
/* parameters */ &kParameters[966],
|
||||||
/* return matcher indices */ &kMatcherIndices[23],
|
/* return matcher indices */ &kMatcherIndices[23],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::VecSplat,
|
/* const eval */ &ConstEval::VecSplat,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10021,7 +10021,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[782],
|
/* parameters */ &kParameters[782],
|
||||||
/* return matcher indices */ &kMatcherIndices[23],
|
/* return matcher indices */ &kMatcherIndices[23],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::VecInitS,
|
/* const eval */ &ConstEval::VecInitS,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10501,7 +10501,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[1013],
|
/* parameters */ &kParameters[1013],
|
||||||
/* return matcher indices */ &kMatcherIndices[178],
|
/* return matcher indices */ &kMatcherIndices[178],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Zero,
|
/* const eval */ &ConstEval::Zero,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10513,7 +10513,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[986],
|
/* parameters */ &kParameters[986],
|
||||||
/* return matcher indices */ &kMatcherIndices[178],
|
/* return matcher indices */ &kMatcherIndices[178],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Identity,
|
/* const eval */ &ConstEval::Identity,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10525,7 +10525,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[431],
|
/* parameters */ &kParameters[431],
|
||||||
/* return matcher indices */ &kMatcherIndices[178],
|
/* return matcher indices */ &kMatcherIndices[178],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::MatInitS,
|
/* const eval */ &ConstEval::MatInitS,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10537,7 +10537,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[794],
|
/* parameters */ &kParameters[794],
|
||||||
/* return matcher indices */ &kMatcherIndices[178],
|
/* return matcher indices */ &kMatcherIndices[178],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::MatInitV,
|
/* const eval */ &ConstEval::MatInitV,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10573,7 +10573,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[1013],
|
/* parameters */ &kParameters[1013],
|
||||||
/* return matcher indices */ &kMatcherIndices[184],
|
/* return matcher indices */ &kMatcherIndices[184],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Zero,
|
/* const eval */ &ConstEval::Zero,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10585,7 +10585,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[989],
|
/* parameters */ &kParameters[989],
|
||||||
/* return matcher indices */ &kMatcherIndices[184],
|
/* return matcher indices */ &kMatcherIndices[184],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Identity,
|
/* const eval */ &ConstEval::Identity,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10597,7 +10597,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[138],
|
/* parameters */ &kParameters[138],
|
||||||
/* return matcher indices */ &kMatcherIndices[184],
|
/* return matcher indices */ &kMatcherIndices[184],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::MatInitS,
|
/* const eval */ &ConstEval::MatInitS,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10609,7 +10609,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[796],
|
/* parameters */ &kParameters[796],
|
||||||
/* return matcher indices */ &kMatcherIndices[184],
|
/* return matcher indices */ &kMatcherIndices[184],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::MatInitV,
|
/* const eval */ &ConstEval::MatInitV,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10645,7 +10645,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[1013],
|
/* parameters */ &kParameters[1013],
|
||||||
/* return matcher indices */ &kMatcherIndices[190],
|
/* return matcher indices */ &kMatcherIndices[190],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Zero,
|
/* const eval */ &ConstEval::Zero,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10657,7 +10657,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[992],
|
/* parameters */ &kParameters[992],
|
||||||
/* return matcher indices */ &kMatcherIndices[190],
|
/* return matcher indices */ &kMatcherIndices[190],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Identity,
|
/* const eval */ &ConstEval::Identity,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10669,7 +10669,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[49],
|
/* parameters */ &kParameters[49],
|
||||||
/* return matcher indices */ &kMatcherIndices[190],
|
/* return matcher indices */ &kMatcherIndices[190],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::MatInitS,
|
/* const eval */ &ConstEval::MatInitS,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10681,7 +10681,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[798],
|
/* parameters */ &kParameters[798],
|
||||||
/* return matcher indices */ &kMatcherIndices[190],
|
/* return matcher indices */ &kMatcherIndices[190],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::MatInitV,
|
/* const eval */ &ConstEval::MatInitV,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10717,7 +10717,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[1013],
|
/* parameters */ &kParameters[1013],
|
||||||
/* return matcher indices */ &kMatcherIndices[196],
|
/* return matcher indices */ &kMatcherIndices[196],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Zero,
|
/* const eval */ &ConstEval::Zero,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10729,7 +10729,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[995],
|
/* parameters */ &kParameters[995],
|
||||||
/* return matcher indices */ &kMatcherIndices[196],
|
/* return matcher indices */ &kMatcherIndices[196],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Identity,
|
/* const eval */ &ConstEval::Identity,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10741,7 +10741,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[144],
|
/* parameters */ &kParameters[144],
|
||||||
/* return matcher indices */ &kMatcherIndices[196],
|
/* return matcher indices */ &kMatcherIndices[196],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::MatInitS,
|
/* const eval */ &ConstEval::MatInitS,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10753,7 +10753,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[585],
|
/* parameters */ &kParameters[585],
|
||||||
/* return matcher indices */ &kMatcherIndices[196],
|
/* return matcher indices */ &kMatcherIndices[196],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::MatInitV,
|
/* const eval */ &ConstEval::MatInitV,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10789,7 +10789,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[1013],
|
/* parameters */ &kParameters[1013],
|
||||||
/* return matcher indices */ &kMatcherIndices[202],
|
/* return matcher indices */ &kMatcherIndices[202],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Zero,
|
/* const eval */ &ConstEval::Zero,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10801,7 +10801,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[998],
|
/* parameters */ &kParameters[998],
|
||||||
/* return matcher indices */ &kMatcherIndices[202],
|
/* return matcher indices */ &kMatcherIndices[202],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Identity,
|
/* const eval */ &ConstEval::Identity,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10813,7 +10813,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[40],
|
/* parameters */ &kParameters[40],
|
||||||
/* return matcher indices */ &kMatcherIndices[202],
|
/* return matcher indices */ &kMatcherIndices[202],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::MatInitS,
|
/* const eval */ &ConstEval::MatInitS,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10825,7 +10825,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[588],
|
/* parameters */ &kParameters[588],
|
||||||
/* return matcher indices */ &kMatcherIndices[202],
|
/* return matcher indices */ &kMatcherIndices[202],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::MatInitV,
|
/* const eval */ &ConstEval::MatInitV,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10861,7 +10861,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[1013],
|
/* parameters */ &kParameters[1013],
|
||||||
/* return matcher indices */ &kMatcherIndices[208],
|
/* return matcher indices */ &kMatcherIndices[208],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Zero,
|
/* const eval */ &ConstEval::Zero,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10873,7 +10873,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[1001],
|
/* parameters */ &kParameters[1001],
|
||||||
/* return matcher indices */ &kMatcherIndices[208],
|
/* return matcher indices */ &kMatcherIndices[208],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Identity,
|
/* const eval */ &ConstEval::Identity,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10885,7 +10885,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[16],
|
/* parameters */ &kParameters[16],
|
||||||
/* return matcher indices */ &kMatcherIndices[208],
|
/* return matcher indices */ &kMatcherIndices[208],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::MatInitS,
|
/* const eval */ &ConstEval::MatInitS,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10897,7 +10897,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[591],
|
/* parameters */ &kParameters[591],
|
||||||
/* return matcher indices */ &kMatcherIndices[208],
|
/* return matcher indices */ &kMatcherIndices[208],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::MatInitV,
|
/* const eval */ &ConstEval::MatInitV,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10933,7 +10933,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[1013],
|
/* parameters */ &kParameters[1013],
|
||||||
/* return matcher indices */ &kMatcherIndices[214],
|
/* return matcher indices */ &kMatcherIndices[214],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Zero,
|
/* const eval */ &ConstEval::Zero,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10945,7 +10945,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[1004],
|
/* parameters */ &kParameters[1004],
|
||||||
/* return matcher indices */ &kMatcherIndices[214],
|
/* return matcher indices */ &kMatcherIndices[214],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Identity,
|
/* const eval */ &ConstEval::Identity,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10957,7 +10957,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[57],
|
/* parameters */ &kParameters[57],
|
||||||
/* return matcher indices */ &kMatcherIndices[214],
|
/* return matcher indices */ &kMatcherIndices[214],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::MatInitS,
|
/* const eval */ &ConstEval::MatInitS,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10969,7 +10969,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[435],
|
/* parameters */ &kParameters[435],
|
||||||
/* return matcher indices */ &kMatcherIndices[214],
|
/* return matcher indices */ &kMatcherIndices[214],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::MatInitV,
|
/* const eval */ &ConstEval::MatInitV,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -11005,7 +11005,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[1013],
|
/* parameters */ &kParameters[1013],
|
||||||
/* return matcher indices */ &kMatcherIndices[220],
|
/* return matcher indices */ &kMatcherIndices[220],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Zero,
|
/* const eval */ &ConstEval::Zero,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -11017,7 +11017,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[1007],
|
/* parameters */ &kParameters[1007],
|
||||||
/* return matcher indices */ &kMatcherIndices[220],
|
/* return matcher indices */ &kMatcherIndices[220],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Identity,
|
/* const eval */ &ConstEval::Identity,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -11029,7 +11029,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[28],
|
/* parameters */ &kParameters[28],
|
||||||
/* return matcher indices */ &kMatcherIndices[220],
|
/* return matcher indices */ &kMatcherIndices[220],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::MatInitS,
|
/* const eval */ &ConstEval::MatInitS,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -11041,7 +11041,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[439],
|
/* parameters */ &kParameters[439],
|
||||||
/* return matcher indices */ &kMatcherIndices[220],
|
/* return matcher indices */ &kMatcherIndices[220],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::MatInitV,
|
/* const eval */ &ConstEval::MatInitV,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -11077,7 +11077,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[1013],
|
/* parameters */ &kParameters[1013],
|
||||||
/* return matcher indices */ &kMatcherIndices[226],
|
/* return matcher indices */ &kMatcherIndices[226],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Zero,
|
/* const eval */ &ConstEval::Zero,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -11089,7 +11089,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[1010],
|
/* parameters */ &kParameters[1010],
|
||||||
/* return matcher indices */ &kMatcherIndices[226],
|
/* return matcher indices */ &kMatcherIndices[226],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Identity,
|
/* const eval */ &ConstEval::Identity,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -11101,7 +11101,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[0],
|
/* parameters */ &kParameters[0],
|
||||||
/* return matcher indices */ &kMatcherIndices[226],
|
/* return matcher indices */ &kMatcherIndices[226],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::MatInitS,
|
/* const eval */ &ConstEval::MatInitS,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -11113,7 +11113,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[443],
|
/* parameters */ &kParameters[443],
|
||||||
/* return matcher indices */ &kMatcherIndices[226],
|
/* return matcher indices */ &kMatcherIndices[226],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::MatInitV,
|
/* const eval */ &ConstEval::MatInitV,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -11593,7 +11593,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[1013],
|
/* parameters */ &kParameters[1013],
|
||||||
/* return matcher indices */ &kMatcherIndices[9],
|
/* return matcher indices */ &kMatcherIndices[9],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Zero,
|
/* const eval */ &ConstEval::Zero,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -11605,7 +11605,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[955],
|
/* parameters */ &kParameters[955],
|
||||||
/* return matcher indices */ &kMatcherIndices[9],
|
/* return matcher indices */ &kMatcherIndices[9],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Identity,
|
/* const eval */ &ConstEval::Identity,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -11629,7 +11629,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[1013],
|
/* parameters */ &kParameters[1013],
|
||||||
/* return matcher indices */ &kMatcherIndices[105],
|
/* return matcher indices */ &kMatcherIndices[105],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Zero,
|
/* const eval */ &ConstEval::Zero,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -11641,7 +11641,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[957],
|
/* parameters */ &kParameters[957],
|
||||||
/* return matcher indices */ &kMatcherIndices[105],
|
/* return matcher indices */ &kMatcherIndices[105],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Identity,
|
/* const eval */ &ConstEval::Identity,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -11665,7 +11665,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[1013],
|
/* parameters */ &kParameters[1013],
|
||||||
/* return matcher indices */ &kMatcherIndices[42],
|
/* return matcher indices */ &kMatcherIndices[42],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Zero,
|
/* const eval */ &ConstEval::Zero,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -11677,7 +11677,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[959],
|
/* parameters */ &kParameters[959],
|
||||||
/* return matcher indices */ &kMatcherIndices[42],
|
/* return matcher indices */ &kMatcherIndices[42],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Identity,
|
/* const eval */ &ConstEval::Identity,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -11701,7 +11701,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[1013],
|
/* parameters */ &kParameters[1013],
|
||||||
/* return matcher indices */ &kMatcherIndices[1],
|
/* return matcher indices */ &kMatcherIndices[1],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Zero,
|
/* const eval */ &ConstEval::Zero,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -11713,7 +11713,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[961],
|
/* parameters */ &kParameters[961],
|
||||||
/* return matcher indices */ &kMatcherIndices[1],
|
/* return matcher indices */ &kMatcherIndices[1],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Identity,
|
/* const eval */ &ConstEval::Identity,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -11737,7 +11737,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[1013],
|
/* parameters */ &kParameters[1013],
|
||||||
/* return matcher indices */ &kMatcherIndices[39],
|
/* return matcher indices */ &kMatcherIndices[39],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Zero,
|
/* const eval */ &ConstEval::Zero,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -11749,7 +11749,7 @@ constexpr OverloadInfo kOverloads[] = {
|
||||||
/* template numbers */ &kTemplateNumbers[10],
|
/* template numbers */ &kTemplateNumbers[10],
|
||||||
/* parameters */ &kParameters[963],
|
/* parameters */ &kParameters[963],
|
||||||
/* return matcher indices */ &kMatcherIndices[39],
|
/* return matcher indices */ &kMatcherIndices[39],
|
||||||
/* flags */ OverloadFlags(OverloadFlag::kIsInitializer, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
/* flags */ OverloadFlags(OverloadFlag::kIsConstructor, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline, OverloadFlag::kMustUse),
|
||||||
/* const eval */ &ConstEval::Identity,
|
/* const eval */ &ConstEval::Identity,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -15094,53 +15094,53 @@ constexpr uint8_t kBinaryOperatorGreaterThanEqual = 15;
|
||||||
constexpr uint8_t kBinaryOperatorShiftLeft = 16;
|
constexpr uint8_t kBinaryOperatorShiftLeft = 16;
|
||||||
constexpr uint8_t kBinaryOperatorShiftRight = 17;
|
constexpr uint8_t kBinaryOperatorShiftRight = 17;
|
||||||
|
|
||||||
constexpr IntrinsicInfo kInitializersAndConverters[] = {
|
constexpr IntrinsicInfo kConstructorsAndConverters[] = {
|
||||||
{
|
{
|
||||||
/* [0] */
|
/* [0] */
|
||||||
/* init i32() -> i32 */
|
/* ctor i32() -> i32 */
|
||||||
/* init i32(i32) -> i32 */
|
/* ctor i32(i32) -> i32 */
|
||||||
/* conv i32<T : scalar_no_i32>(T) -> i32 */
|
/* conv i32<T : scalar_no_i32>(T) -> i32 */
|
||||||
/* num overloads */ 3,
|
/* num overloads */ 3,
|
||||||
/* overloads */ &kOverloads[268],
|
/* overloads */ &kOverloads[268],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/* [1] */
|
/* [1] */
|
||||||
/* init u32() -> u32 */
|
/* ctor u32() -> u32 */
|
||||||
/* init u32(u32) -> u32 */
|
/* ctor u32(u32) -> u32 */
|
||||||
/* conv u32<T : scalar_no_u32>(T) -> u32 */
|
/* conv u32<T : scalar_no_u32>(T) -> u32 */
|
||||||
/* num overloads */ 3,
|
/* num overloads */ 3,
|
||||||
/* overloads */ &kOverloads[271],
|
/* overloads */ &kOverloads[271],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/* [2] */
|
/* [2] */
|
||||||
/* init f32() -> f32 */
|
/* ctor f32() -> f32 */
|
||||||
/* init f32(f32) -> f32 */
|
/* ctor f32(f32) -> f32 */
|
||||||
/* conv f32<T : scalar_no_f32>(T) -> f32 */
|
/* conv f32<T : scalar_no_f32>(T) -> f32 */
|
||||||
/* num overloads */ 3,
|
/* num overloads */ 3,
|
||||||
/* overloads */ &kOverloads[274],
|
/* overloads */ &kOverloads[274],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/* [3] */
|
/* [3] */
|
||||||
/* init f16() -> f16 */
|
/* ctor f16() -> f16 */
|
||||||
/* init f16(f16) -> f16 */
|
/* ctor f16(f16) -> f16 */
|
||||||
/* conv f16<T : scalar_no_f16>(T) -> f16 */
|
/* conv f16<T : scalar_no_f16>(T) -> f16 */
|
||||||
/* num overloads */ 3,
|
/* num overloads */ 3,
|
||||||
/* overloads */ &kOverloads[277],
|
/* overloads */ &kOverloads[277],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/* [4] */
|
/* [4] */
|
||||||
/* init bool() -> bool */
|
/* ctor bool() -> bool */
|
||||||
/* init bool(bool) -> bool */
|
/* ctor bool(bool) -> bool */
|
||||||
/* conv bool<T : scalar_no_bool>(T) -> bool */
|
/* conv bool<T : scalar_no_bool>(T) -> bool */
|
||||||
/* num overloads */ 3,
|
/* num overloads */ 3,
|
||||||
/* overloads */ &kOverloads[280],
|
/* overloads */ &kOverloads[280],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/* [5] */
|
/* [5] */
|
||||||
/* init vec2<T : concrete_scalar>() -> vec2<T> */
|
/* ctor vec2<T : concrete_scalar>() -> vec2<T> */
|
||||||
/* init vec2<T : scalar>(vec2<T>) -> vec2<T> */
|
/* ctor vec2<T : scalar>(vec2<T>) -> vec2<T> */
|
||||||
/* init vec2<T : scalar>(T) -> vec2<T> */
|
/* ctor vec2<T : scalar>(T) -> vec2<T> */
|
||||||
/* init vec2<T : scalar>(x: T, y: T) -> vec2<T> */
|
/* ctor vec2<T : scalar>(x: T, y: T) -> vec2<T> */
|
||||||
/* conv vec2<T : f32, U : scalar_no_f32>(vec2<U>) -> vec2<f32> */
|
/* conv vec2<T : f32, U : scalar_no_f32>(vec2<U>) -> vec2<f32> */
|
||||||
/* conv vec2<T : f16, U : scalar_no_f16>(vec2<U>) -> vec2<f16> */
|
/* conv vec2<T : f16, U : scalar_no_f16>(vec2<U>) -> vec2<f16> */
|
||||||
/* conv vec2<T : i32, U : scalar_no_i32>(vec2<U>) -> vec2<i32> */
|
/* conv vec2<T : i32, U : scalar_no_i32>(vec2<U>) -> vec2<i32> */
|
||||||
|
@ -15151,12 +15151,12 @@ constexpr IntrinsicInfo kInitializersAndConverters[] = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/* [6] */
|
/* [6] */
|
||||||
/* init vec3<T : concrete_scalar>() -> vec3<T> */
|
/* ctor vec3<T : concrete_scalar>() -> vec3<T> */
|
||||||
/* init vec3<T : scalar>(vec3<T>) -> vec3<T> */
|
/* ctor vec3<T : scalar>(vec3<T>) -> vec3<T> */
|
||||||
/* init vec3<T : scalar>(T) -> vec3<T> */
|
/* ctor vec3<T : scalar>(T) -> vec3<T> */
|
||||||
/* init vec3<T : scalar>(x: T, y: T, z: T) -> vec3<T> */
|
/* ctor vec3<T : scalar>(x: T, y: T, z: T) -> vec3<T> */
|
||||||
/* init vec3<T : scalar>(xy: vec2<T>, z: T) -> vec3<T> */
|
/* ctor vec3<T : scalar>(xy: vec2<T>, z: T) -> vec3<T> */
|
||||||
/* init vec3<T : scalar>(x: T, yz: vec2<T>) -> vec3<T> */
|
/* ctor vec3<T : scalar>(x: T, yz: vec2<T>) -> vec3<T> */
|
||||||
/* conv vec3<T : f32, U : scalar_no_f32>(vec3<U>) -> vec3<f32> */
|
/* conv vec3<T : f32, U : scalar_no_f32>(vec3<U>) -> vec3<f32> */
|
||||||
/* conv vec3<T : f16, U : scalar_no_f16>(vec3<U>) -> vec3<f16> */
|
/* conv vec3<T : f16, U : scalar_no_f16>(vec3<U>) -> vec3<f16> */
|
||||||
/* conv vec3<T : i32, U : scalar_no_i32>(vec3<U>) -> vec3<i32> */
|
/* conv vec3<T : i32, U : scalar_no_i32>(vec3<U>) -> vec3<i32> */
|
||||||
|
@ -15167,16 +15167,16 @@ constexpr IntrinsicInfo kInitializersAndConverters[] = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/* [7] */
|
/* [7] */
|
||||||
/* init vec4<T : concrete_scalar>() -> vec4<T> */
|
/* ctor vec4<T : concrete_scalar>() -> vec4<T> */
|
||||||
/* init vec4<T : scalar>(vec4<T>) -> vec4<T> */
|
/* ctor vec4<T : scalar>(vec4<T>) -> vec4<T> */
|
||||||
/* init vec4<T : scalar>(T) -> vec4<T> */
|
/* ctor vec4<T : scalar>(T) -> vec4<T> */
|
||||||
/* init vec4<T : scalar>(x: T, y: T, z: T, w: T) -> vec4<T> */
|
/* ctor vec4<T : scalar>(x: T, y: T, z: T, w: T) -> vec4<T> */
|
||||||
/* init vec4<T : scalar>(xy: vec2<T>, z: T, w: T) -> vec4<T> */
|
/* ctor vec4<T : scalar>(xy: vec2<T>, z: T, w: T) -> vec4<T> */
|
||||||
/* init vec4<T : scalar>(x: T, yz: vec2<T>, w: T) -> vec4<T> */
|
/* ctor vec4<T : scalar>(x: T, yz: vec2<T>, w: T) -> vec4<T> */
|
||||||
/* init vec4<T : scalar>(x: T, y: T, zw: vec2<T>) -> vec4<T> */
|
/* ctor vec4<T : scalar>(x: T, y: T, zw: vec2<T>) -> vec4<T> */
|
||||||
/* init vec4<T : scalar>(xy: vec2<T>, zw: vec2<T>) -> vec4<T> */
|
/* ctor vec4<T : scalar>(xy: vec2<T>, zw: vec2<T>) -> vec4<T> */
|
||||||
/* init vec4<T : scalar>(xyz: vec3<T>, w: T) -> vec4<T> */
|
/* ctor vec4<T : scalar>(xyz: vec3<T>, w: T) -> vec4<T> */
|
||||||
/* init vec4<T : scalar>(x: T, zyw: vec3<T>) -> vec4<T> */
|
/* ctor vec4<T : scalar>(x: T, zyw: vec3<T>) -> vec4<T> */
|
||||||
/* conv vec4<T : f32, U : scalar_no_f32>(vec4<U>) -> vec4<f32> */
|
/* conv vec4<T : f32, U : scalar_no_f32>(vec4<U>) -> vec4<f32> */
|
||||||
/* conv vec4<T : f16, U : scalar_no_f16>(vec4<U>) -> vec4<f16> */
|
/* conv vec4<T : f16, U : scalar_no_f16>(vec4<U>) -> vec4<f16> */
|
||||||
/* conv vec4<T : i32, U : scalar_no_i32>(vec4<U>) -> vec4<i32> */
|
/* conv vec4<T : i32, U : scalar_no_i32>(vec4<U>) -> vec4<i32> */
|
||||||
|
@ -15187,10 +15187,10 @@ constexpr IntrinsicInfo kInitializersAndConverters[] = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/* [8] */
|
/* [8] */
|
||||||
/* init mat2x2<T : f32_f16>() -> mat2x2<T> */
|
/* ctor mat2x2<T : f32_f16>() -> mat2x2<T> */
|
||||||
/* init mat2x2<T : f32_f16>(mat2x2<T>) -> mat2x2<T> */
|
/* ctor mat2x2<T : f32_f16>(mat2x2<T>) -> mat2x2<T> */
|
||||||
/* init mat2x2<T : fa_f32_f16>(T, T, T, T) -> mat2x2<T> */
|
/* ctor mat2x2<T : fa_f32_f16>(T, T, T, T) -> mat2x2<T> */
|
||||||
/* init mat2x2<T : fa_f32_f16>(vec2<T>, vec2<T>) -> mat2x2<T> */
|
/* ctor mat2x2<T : fa_f32_f16>(vec2<T>, vec2<T>) -> mat2x2<T> */
|
||||||
/* conv mat2x2<T : f16>(mat2x2<f32>) -> mat2x2<f16> */
|
/* conv mat2x2<T : f16>(mat2x2<f32>) -> mat2x2<f16> */
|
||||||
/* conv mat2x2<T : f32>(mat2x2<f16>) -> mat2x2<f32> */
|
/* conv mat2x2<T : f32>(mat2x2<f16>) -> mat2x2<f32> */
|
||||||
/* num overloads */ 6,
|
/* num overloads */ 6,
|
||||||
|
@ -15198,10 +15198,10 @@ constexpr IntrinsicInfo kInitializersAndConverters[] = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/* [9] */
|
/* [9] */
|
||||||
/* init mat2x3<T : f32_f16>() -> mat2x3<T> */
|
/* ctor mat2x3<T : f32_f16>() -> mat2x3<T> */
|
||||||
/* init mat2x3<T : f32_f16>(mat2x3<T>) -> mat2x3<T> */
|
/* ctor mat2x3<T : f32_f16>(mat2x3<T>) -> mat2x3<T> */
|
||||||
/* init mat2x3<T : fa_f32_f16>(T, T, T, T, T, T) -> mat2x3<T> */
|
/* ctor mat2x3<T : fa_f32_f16>(T, T, T, T, T, T) -> mat2x3<T> */
|
||||||
/* init mat2x3<T : fa_f32_f16>(vec3<T>, vec3<T>) -> mat2x3<T> */
|
/* ctor mat2x3<T : fa_f32_f16>(vec3<T>, vec3<T>) -> mat2x3<T> */
|
||||||
/* conv mat2x3<T : f16>(mat2x3<f32>) -> mat2x3<f16> */
|
/* conv mat2x3<T : f16>(mat2x3<f32>) -> mat2x3<f16> */
|
||||||
/* conv mat2x3<T : f32>(mat2x3<f16>) -> mat2x3<f32> */
|
/* conv mat2x3<T : f32>(mat2x3<f16>) -> mat2x3<f32> */
|
||||||
/* num overloads */ 6,
|
/* num overloads */ 6,
|
||||||
|
@ -15209,10 +15209,10 @@ constexpr IntrinsicInfo kInitializersAndConverters[] = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/* [10] */
|
/* [10] */
|
||||||
/* init mat2x4<T : f32_f16>() -> mat2x4<T> */
|
/* ctor mat2x4<T : f32_f16>() -> mat2x4<T> */
|
||||||
/* init mat2x4<T : f32_f16>(mat2x4<T>) -> mat2x4<T> */
|
/* ctor mat2x4<T : f32_f16>(mat2x4<T>) -> mat2x4<T> */
|
||||||
/* init mat2x4<T : fa_f32_f16>(T, T, T, T, T, T, T, T) -> mat2x4<T> */
|
/* ctor mat2x4<T : fa_f32_f16>(T, T, T, T, T, T, T, T) -> mat2x4<T> */
|
||||||
/* init mat2x4<T : fa_f32_f16>(vec4<T>, vec4<T>) -> mat2x4<T> */
|
/* ctor mat2x4<T : fa_f32_f16>(vec4<T>, vec4<T>) -> mat2x4<T> */
|
||||||
/* conv mat2x4<T : f16>(mat2x4<f32>) -> mat2x4<f16> */
|
/* conv mat2x4<T : f16>(mat2x4<f32>) -> mat2x4<f16> */
|
||||||
/* conv mat2x4<T : f32>(mat2x4<f16>) -> mat2x4<f32> */
|
/* conv mat2x4<T : f32>(mat2x4<f16>) -> mat2x4<f32> */
|
||||||
/* num overloads */ 6,
|
/* num overloads */ 6,
|
||||||
|
@ -15220,10 +15220,10 @@ constexpr IntrinsicInfo kInitializersAndConverters[] = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/* [11] */
|
/* [11] */
|
||||||
/* init mat3x2<T : f32_f16>() -> mat3x2<T> */
|
/* ctor mat3x2<T : f32_f16>() -> mat3x2<T> */
|
||||||
/* init mat3x2<T : f32_f16>(mat3x2<T>) -> mat3x2<T> */
|
/* ctor mat3x2<T : f32_f16>(mat3x2<T>) -> mat3x2<T> */
|
||||||
/* init mat3x2<T : fa_f32_f16>(T, T, T, T, T, T) -> mat3x2<T> */
|
/* ctor mat3x2<T : fa_f32_f16>(T, T, T, T, T, T) -> mat3x2<T> */
|
||||||
/* init mat3x2<T : fa_f32_f16>(vec2<T>, vec2<T>, vec2<T>) -> mat3x2<T> */
|
/* ctor mat3x2<T : fa_f32_f16>(vec2<T>, vec2<T>, vec2<T>) -> mat3x2<T> */
|
||||||
/* conv mat3x2<T : f16>(mat3x2<f32>) -> mat3x2<f16> */
|
/* conv mat3x2<T : f16>(mat3x2<f32>) -> mat3x2<f16> */
|
||||||
/* conv mat3x2<T : f32>(mat3x2<f16>) -> mat3x2<f32> */
|
/* conv mat3x2<T : f32>(mat3x2<f16>) -> mat3x2<f32> */
|
||||||
/* num overloads */ 6,
|
/* num overloads */ 6,
|
||||||
|
@ -15231,10 +15231,10 @@ constexpr IntrinsicInfo kInitializersAndConverters[] = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/* [12] */
|
/* [12] */
|
||||||
/* init mat3x3<T : f32_f16>() -> mat3x3<T> */
|
/* ctor mat3x3<T : f32_f16>() -> mat3x3<T> */
|
||||||
/* init mat3x3<T : f32_f16>(mat3x3<T>) -> mat3x3<T> */
|
/* ctor mat3x3<T : f32_f16>(mat3x3<T>) -> mat3x3<T> */
|
||||||
/* init mat3x3<T : fa_f32_f16>(T, T, T, T, T, T, T, T, T) -> mat3x3<T> */
|
/* ctor mat3x3<T : fa_f32_f16>(T, T, T, T, T, T, T, T, T) -> mat3x3<T> */
|
||||||
/* init mat3x3<T : fa_f32_f16>(vec3<T>, vec3<T>, vec3<T>) -> mat3x3<T> */
|
/* ctor mat3x3<T : fa_f32_f16>(vec3<T>, vec3<T>, vec3<T>) -> mat3x3<T> */
|
||||||
/* conv mat3x3<T : f16>(mat3x3<f32>) -> mat3x3<f16> */
|
/* conv mat3x3<T : f16>(mat3x3<f32>) -> mat3x3<f16> */
|
||||||
/* conv mat3x3<T : f32>(mat3x3<f16>) -> mat3x3<f32> */
|
/* conv mat3x3<T : f32>(mat3x3<f16>) -> mat3x3<f32> */
|
||||||
/* num overloads */ 6,
|
/* num overloads */ 6,
|
||||||
|
@ -15242,10 +15242,10 @@ constexpr IntrinsicInfo kInitializersAndConverters[] = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/* [13] */
|
/* [13] */
|
||||||
/* init mat3x4<T : f32_f16>() -> mat3x4<T> */
|
/* ctor mat3x4<T : f32_f16>() -> mat3x4<T> */
|
||||||
/* init mat3x4<T : f32_f16>(mat3x4<T>) -> mat3x4<T> */
|
/* ctor mat3x4<T : f32_f16>(mat3x4<T>) -> mat3x4<T> */
|
||||||
/* init mat3x4<T : fa_f32_f16>(T, T, T, T, T, T, T, T, T, T, T, T) -> mat3x4<T> */
|
/* ctor mat3x4<T : fa_f32_f16>(T, T, T, T, T, T, T, T, T, T, T, T) -> mat3x4<T> */
|
||||||
/* init mat3x4<T : fa_f32_f16>(vec4<T>, vec4<T>, vec4<T>) -> mat3x4<T> */
|
/* ctor mat3x4<T : fa_f32_f16>(vec4<T>, vec4<T>, vec4<T>) -> mat3x4<T> */
|
||||||
/* conv mat3x4<T : f16>(mat3x4<f32>) -> mat3x4<f16> */
|
/* conv mat3x4<T : f16>(mat3x4<f32>) -> mat3x4<f16> */
|
||||||
/* conv mat3x4<T : f32>(mat3x4<f16>) -> mat3x4<f32> */
|
/* conv mat3x4<T : f32>(mat3x4<f16>) -> mat3x4<f32> */
|
||||||
/* num overloads */ 6,
|
/* num overloads */ 6,
|
||||||
|
@ -15253,10 +15253,10 @@ constexpr IntrinsicInfo kInitializersAndConverters[] = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/* [14] */
|
/* [14] */
|
||||||
/* init mat4x2<T : f32_f16>() -> mat4x2<T> */
|
/* ctor mat4x2<T : f32_f16>() -> mat4x2<T> */
|
||||||
/* init mat4x2<T : f32_f16>(mat4x2<T>) -> mat4x2<T> */
|
/* ctor mat4x2<T : f32_f16>(mat4x2<T>) -> mat4x2<T> */
|
||||||
/* init mat4x2<T : fa_f32_f16>(T, T, T, T, T, T, T, T) -> mat4x2<T> */
|
/* ctor mat4x2<T : fa_f32_f16>(T, T, T, T, T, T, T, T) -> mat4x2<T> */
|
||||||
/* init mat4x2<T : fa_f32_f16>(vec2<T>, vec2<T>, vec2<T>, vec2<T>) -> mat4x2<T> */
|
/* ctor mat4x2<T : fa_f32_f16>(vec2<T>, vec2<T>, vec2<T>, vec2<T>) -> mat4x2<T> */
|
||||||
/* conv mat4x2<T : f16>(mat4x2<f32>) -> mat4x2<f16> */
|
/* conv mat4x2<T : f16>(mat4x2<f32>) -> mat4x2<f16> */
|
||||||
/* conv mat4x2<T : f32>(mat4x2<f16>) -> mat4x2<f32> */
|
/* conv mat4x2<T : f32>(mat4x2<f16>) -> mat4x2<f32> */
|
||||||
/* num overloads */ 6,
|
/* num overloads */ 6,
|
||||||
|
@ -15264,10 +15264,10 @@ constexpr IntrinsicInfo kInitializersAndConverters[] = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/* [15] */
|
/* [15] */
|
||||||
/* init mat4x3<T : f32_f16>() -> mat4x3<T> */
|
/* ctor mat4x3<T : f32_f16>() -> mat4x3<T> */
|
||||||
/* init mat4x3<T : f32_f16>(mat4x3<T>) -> mat4x3<T> */
|
/* ctor mat4x3<T : f32_f16>(mat4x3<T>) -> mat4x3<T> */
|
||||||
/* init mat4x3<T : fa_f32_f16>(T, T, T, T, T, T, T, T, T, T, T, T) -> mat4x3<T> */
|
/* ctor mat4x3<T : fa_f32_f16>(T, T, T, T, T, T, T, T, T, T, T, T) -> mat4x3<T> */
|
||||||
/* init mat4x3<T : fa_f32_f16>(vec3<T>, vec3<T>, vec3<T>, vec3<T>) -> mat4x3<T> */
|
/* ctor mat4x3<T : fa_f32_f16>(vec3<T>, vec3<T>, vec3<T>, vec3<T>) -> mat4x3<T> */
|
||||||
/* conv mat4x3<T : f16>(mat4x3<f32>) -> mat4x3<f16> */
|
/* conv mat4x3<T : f16>(mat4x3<f32>) -> mat4x3<f16> */
|
||||||
/* conv mat4x3<T : f32>(mat4x3<f16>) -> mat4x3<f32> */
|
/* conv mat4x3<T : f32>(mat4x3<f16>) -> mat4x3<f32> */
|
||||||
/* num overloads */ 6,
|
/* num overloads */ 6,
|
||||||
|
@ -15275,10 +15275,10 @@ constexpr IntrinsicInfo kInitializersAndConverters[] = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/* [16] */
|
/* [16] */
|
||||||
/* init mat4x4<T : f32_f16>() -> mat4x4<T> */
|
/* ctor mat4x4<T : f32_f16>() -> mat4x4<T> */
|
||||||
/* init mat4x4<T : f32_f16>(mat4x4<T>) -> mat4x4<T> */
|
/* ctor mat4x4<T : f32_f16>(mat4x4<T>) -> mat4x4<T> */
|
||||||
/* init mat4x4<T : fa_f32_f16>(T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T) -> mat4x4<T> */
|
/* ctor mat4x4<T : fa_f32_f16>(T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T) -> mat4x4<T> */
|
||||||
/* init mat4x4<T : fa_f32_f16>(vec4<T>, vec4<T>, vec4<T>, vec4<T>) -> mat4x4<T> */
|
/* ctor mat4x4<T : fa_f32_f16>(vec4<T>, vec4<T>, vec4<T>, vec4<T>) -> mat4x4<T> */
|
||||||
/* conv mat4x4<T : f16>(mat4x4<f32>) -> mat4x4<f16> */
|
/* conv mat4x4<T : f16>(mat4x4<f32>) -> mat4x4<f16> */
|
||||||
/* conv mat4x4<T : f32>(mat4x4<f16>) -> mat4x4<f32> */
|
/* conv mat4x4<T : f32>(mat4x4<f16>) -> mat4x4<f32> */
|
||||||
/* num overloads */ 6,
|
/* num overloads */ 6,
|
||||||
|
|
|
@ -162,8 +162,8 @@ constexpr IntrinsicInfo kBinaryOperators[] = {
|
||||||
constexpr uint8_t kBinaryOperator{{ template "ExpandName" $o.Name}} = {{$i}};
|
constexpr uint8_t kBinaryOperator{{ template "ExpandName" $o.Name}} = {{$i}};
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
constexpr IntrinsicInfo kInitializersAndConverters[] = {
|
constexpr IntrinsicInfo kConstructorsAndConverters[] = {
|
||||||
{{- range $i, $o := .InitializersAndConverters }}
|
{{- range $i, $o := .ConstructorsAndConverters }}
|
||||||
{
|
{
|
||||||
/* [{{$i}}] */
|
/* [{{$i}}] */
|
||||||
{{- range $o.OverloadDescriptions }}
|
{{- range $o.OverloadDescriptions }}
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "src/tint/program_builder.h"
|
#include "src/tint/program_builder.h"
|
||||||
#include "src/tint/resolver/resolver_test_helper.h"
|
#include "src/tint/resolver/resolver_test_helper.h"
|
||||||
#include "src/tint/sem/type_conversion.h"
|
#include "src/tint/sem/value_constructor.h"
|
||||||
#include "src/tint/sem/type_initializer.h"
|
#include "src/tint/sem/value_conversion.h"
|
||||||
#include "src/tint/type/atomic.h"
|
#include "src/tint/type/atomic.h"
|
||||||
#include "src/tint/type/depth_multisampled_texture.h"
|
#include "src/tint/type/depth_multisampled_texture.h"
|
||||||
#include "src/tint/type/depth_texture.h"
|
#include "src/tint/type/depth_texture.h"
|
||||||
|
@ -802,11 +802,11 @@ TEST_F(IntrinsicTableTest, MismatchCompoundOp) {
|
||||||
TEST_F(IntrinsicTableTest, MatchTypeInitializerImplicit) {
|
TEST_F(IntrinsicTableTest, MatchTypeInitializerImplicit) {
|
||||||
auto* i32 = create<type::I32>();
|
auto* i32 = create<type::I32>();
|
||||||
auto* vec3_i32 = create<type::Vector>(i32, 3u);
|
auto* vec3_i32 = create<type::Vector>(i32, 3u);
|
||||||
auto result = table->Lookup(InitConvIntrinsic::kVec3, nullptr, utils::Vector{i32, i32, i32},
|
auto result = table->Lookup(CtorConvIntrinsic::kVec3, nullptr, utils::Vector{i32, i32, i32},
|
||||||
sem::EvaluationStage::kConstant, Source{{12, 34}});
|
sem::EvaluationStage::kConstant, Source{{12, 34}});
|
||||||
ASSERT_NE(result.target, nullptr);
|
ASSERT_NE(result.target, nullptr);
|
||||||
EXPECT_EQ(result.target->ReturnType(), vec3_i32);
|
EXPECT_EQ(result.target->ReturnType(), vec3_i32);
|
||||||
EXPECT_TRUE(result.target->Is<sem::TypeInitializer>());
|
EXPECT_TRUE(result.target->Is<sem::ValueConstructor>());
|
||||||
ASSERT_EQ(result.target->Parameters().Length(), 3u);
|
ASSERT_EQ(result.target->Parameters().Length(), 3u);
|
||||||
EXPECT_EQ(result.target->Parameters()[0]->Type(), i32);
|
EXPECT_EQ(result.target->Parameters()[0]->Type(), i32);
|
||||||
EXPECT_EQ(result.target->Parameters()[1]->Type(), i32);
|
EXPECT_EQ(result.target->Parameters()[1]->Type(), i32);
|
||||||
|
@ -817,11 +817,11 @@ TEST_F(IntrinsicTableTest, MatchTypeInitializerImplicit) {
|
||||||
TEST_F(IntrinsicTableTest, MatchTypeInitializerExplicit) {
|
TEST_F(IntrinsicTableTest, MatchTypeInitializerExplicit) {
|
||||||
auto* i32 = create<type::I32>();
|
auto* i32 = create<type::I32>();
|
||||||
auto* vec3_i32 = create<type::Vector>(i32, 3u);
|
auto* vec3_i32 = create<type::Vector>(i32, 3u);
|
||||||
auto result = table->Lookup(InitConvIntrinsic::kVec3, i32, utils::Vector{i32, i32, i32},
|
auto result = table->Lookup(CtorConvIntrinsic::kVec3, i32, utils::Vector{i32, i32, i32},
|
||||||
sem::EvaluationStage::kConstant, Source{{12, 34}});
|
sem::EvaluationStage::kConstant, Source{{12, 34}});
|
||||||
ASSERT_NE(result.target, nullptr);
|
ASSERT_NE(result.target, nullptr);
|
||||||
EXPECT_EQ(result.target->ReturnType(), vec3_i32);
|
EXPECT_EQ(result.target->ReturnType(), vec3_i32);
|
||||||
EXPECT_TRUE(result.target->Is<sem::TypeInitializer>());
|
EXPECT_TRUE(result.target->Is<sem::ValueConstructor>());
|
||||||
ASSERT_EQ(result.target->Parameters().Length(), 3u);
|
ASSERT_EQ(result.target->Parameters().Length(), 3u);
|
||||||
EXPECT_EQ(result.target->Parameters()[0]->Type(), i32);
|
EXPECT_EQ(result.target->Parameters()[0]->Type(), i32);
|
||||||
EXPECT_EQ(result.target->Parameters()[1]->Type(), i32);
|
EXPECT_EQ(result.target->Parameters()[1]->Type(), i32);
|
||||||
|
@ -832,13 +832,13 @@ TEST_F(IntrinsicTableTest, MatchTypeInitializerExplicit) {
|
||||||
TEST_F(IntrinsicTableTest, MismatchTypeInitializerImplicit) {
|
TEST_F(IntrinsicTableTest, MismatchTypeInitializerImplicit) {
|
||||||
auto* i32 = create<type::I32>();
|
auto* i32 = create<type::I32>();
|
||||||
auto* f32 = create<type::F32>();
|
auto* f32 = create<type::F32>();
|
||||||
auto result = table->Lookup(InitConvIntrinsic::kVec3, nullptr, utils::Vector{i32, f32, i32},
|
auto result = table->Lookup(CtorConvIntrinsic::kVec3, nullptr, utils::Vector{i32, f32, i32},
|
||||||
sem::EvaluationStage::kConstant, Source{{12, 34}});
|
sem::EvaluationStage::kConstant, Source{{12, 34}});
|
||||||
ASSERT_EQ(result.target, nullptr);
|
ASSERT_EQ(result.target, nullptr);
|
||||||
EXPECT_EQ(Diagnostics().str(),
|
EXPECT_EQ(Diagnostics().str(),
|
||||||
R"(12:34 error: no matching initializer for vec3(i32, f32, i32)
|
R"(12:34 error: no matching constructor for vec3(i32, f32, i32)
|
||||||
|
|
||||||
6 candidate initializers:
|
6 candidate constructors:
|
||||||
vec3(x: T, y: T, z: T) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
vec3(x: T, y: T, z: T) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
||||||
vec3(xy: vec2<T>, z: T) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
vec3(xy: vec2<T>, z: T) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
||||||
vec3(x: T, yz: vec2<T>) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
vec3(x: T, yz: vec2<T>) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
||||||
|
@ -858,13 +858,13 @@ TEST_F(IntrinsicTableTest, MismatchTypeInitializerImplicit) {
|
||||||
TEST_F(IntrinsicTableTest, MismatchTypeInitializerExplicit) {
|
TEST_F(IntrinsicTableTest, MismatchTypeInitializerExplicit) {
|
||||||
auto* i32 = create<type::I32>();
|
auto* i32 = create<type::I32>();
|
||||||
auto* f32 = create<type::F32>();
|
auto* f32 = create<type::F32>();
|
||||||
auto result = table->Lookup(InitConvIntrinsic::kVec3, i32, utils::Vector{i32, f32, i32},
|
auto result = table->Lookup(CtorConvIntrinsic::kVec3, i32, utils::Vector{i32, f32, i32},
|
||||||
sem::EvaluationStage::kConstant, Source{{12, 34}});
|
sem::EvaluationStage::kConstant, Source{{12, 34}});
|
||||||
ASSERT_EQ(result.target, nullptr);
|
ASSERT_EQ(result.target, nullptr);
|
||||||
EXPECT_EQ(Diagnostics().str(),
|
EXPECT_EQ(Diagnostics().str(),
|
||||||
R"(12:34 error: no matching initializer for vec3<i32>(i32, f32, i32)
|
R"(12:34 error: no matching constructor for vec3<i32>(i32, f32, i32)
|
||||||
|
|
||||||
6 candidate initializers:
|
6 candidate constructors:
|
||||||
vec3(x: T, y: T, z: T) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
vec3(x: T, y: T, z: T) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
||||||
vec3(x: T, yz: vec2<T>) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
vec3(x: T, yz: vec2<T>) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
||||||
vec3(T) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
vec3(T) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
||||||
|
@ -884,11 +884,11 @@ TEST_F(IntrinsicTableTest, MismatchTypeInitializerExplicit) {
|
||||||
TEST_F(IntrinsicTableTest, MatchTypeInitializerImplicitVecFromVecAbstract) {
|
TEST_F(IntrinsicTableTest, MatchTypeInitializerImplicitVecFromVecAbstract) {
|
||||||
auto* ai = create<type::AbstractInt>();
|
auto* ai = create<type::AbstractInt>();
|
||||||
auto* vec3_ai = create<type::Vector>(ai, 3u);
|
auto* vec3_ai = create<type::Vector>(ai, 3u);
|
||||||
auto result = table->Lookup(InitConvIntrinsic::kVec3, nullptr, utils::Vector{vec3_ai},
|
auto result = table->Lookup(CtorConvIntrinsic::kVec3, nullptr, utils::Vector{vec3_ai},
|
||||||
sem::EvaluationStage::kConstant, Source{{12, 34}});
|
sem::EvaluationStage::kConstant, Source{{12, 34}});
|
||||||
ASSERT_NE(result.target, nullptr);
|
ASSERT_NE(result.target, nullptr);
|
||||||
EXPECT_EQ(result.target->ReturnType(), vec3_ai);
|
EXPECT_EQ(result.target->ReturnType(), vec3_ai);
|
||||||
EXPECT_TRUE(result.target->Is<sem::TypeInitializer>());
|
EXPECT_TRUE(result.target->Is<sem::ValueConstructor>());
|
||||||
ASSERT_EQ(result.target->Parameters().Length(), 1u);
|
ASSERT_EQ(result.target->Parameters().Length(), 1u);
|
||||||
EXPECT_EQ(result.target->Parameters()[0]->Type(), vec3_ai);
|
EXPECT_EQ(result.target->Parameters()[0]->Type(), vec3_ai);
|
||||||
EXPECT_NE(result.const_eval_fn, nullptr);
|
EXPECT_NE(result.const_eval_fn, nullptr);
|
||||||
|
@ -900,11 +900,11 @@ TEST_F(IntrinsicTableTest, MatchTypeInitializerImplicitMatFromVec) {
|
||||||
auto* vec2_af = create<type::Vector>(af, 2u);
|
auto* vec2_af = create<type::Vector>(af, 2u);
|
||||||
auto* mat2x2_af = create<type::Matrix>(vec2_af, 2u);
|
auto* mat2x2_af = create<type::Matrix>(vec2_af, 2u);
|
||||||
auto result =
|
auto result =
|
||||||
table->Lookup(InitConvIntrinsic::kMat2x2, nullptr, utils::Vector{vec2_ai, vec2_ai},
|
table->Lookup(CtorConvIntrinsic::kMat2x2, nullptr, utils::Vector{vec2_ai, vec2_ai},
|
||||||
sem::EvaluationStage::kConstant, Source{{12, 34}});
|
sem::EvaluationStage::kConstant, Source{{12, 34}});
|
||||||
ASSERT_NE(result.target, nullptr);
|
ASSERT_NE(result.target, nullptr);
|
||||||
EXPECT_TYPE(result.target->ReturnType(), mat2x2_af);
|
EXPECT_TYPE(result.target->ReturnType(), mat2x2_af);
|
||||||
EXPECT_TRUE(result.target->Is<sem::TypeInitializer>());
|
EXPECT_TRUE(result.target->Is<sem::ValueConstructor>());
|
||||||
ASSERT_EQ(result.target->Parameters().Length(), 2u);
|
ASSERT_EQ(result.target->Parameters().Length(), 2u);
|
||||||
EXPECT_TYPE(result.target->Parameters()[0]->Type(), vec2_af);
|
EXPECT_TYPE(result.target->Parameters()[0]->Type(), vec2_af);
|
||||||
EXPECT_TYPE(result.target->Parameters()[1]->Type(), vec2_af);
|
EXPECT_TYPE(result.target->Parameters()[1]->Type(), vec2_af);
|
||||||
|
@ -914,12 +914,12 @@ TEST_F(IntrinsicTableTest, MatchTypeInitializerImplicitMatFromVec) {
|
||||||
TEST_F(IntrinsicTableTest, MatchTypeInitializer_ConstantEval) {
|
TEST_F(IntrinsicTableTest, MatchTypeInitializer_ConstantEval) {
|
||||||
auto* ai = create<type::AbstractInt>();
|
auto* ai = create<type::AbstractInt>();
|
||||||
auto* vec3_ai = create<type::Vector>(ai, 3u);
|
auto* vec3_ai = create<type::Vector>(ai, 3u);
|
||||||
auto result = table->Lookup(InitConvIntrinsic::kVec3, nullptr, utils::Vector{ai, ai, ai},
|
auto result = table->Lookup(CtorConvIntrinsic::kVec3, nullptr, utils::Vector{ai, ai, ai},
|
||||||
sem::EvaluationStage::kConstant, Source{{12, 34}});
|
sem::EvaluationStage::kConstant, Source{{12, 34}});
|
||||||
ASSERT_NE(result.target, nullptr);
|
ASSERT_NE(result.target, nullptr);
|
||||||
EXPECT_EQ(result.target->Stage(), sem::EvaluationStage::kConstant);
|
EXPECT_EQ(result.target->Stage(), sem::EvaluationStage::kConstant);
|
||||||
EXPECT_EQ(result.target->ReturnType(), vec3_ai);
|
EXPECT_EQ(result.target->ReturnType(), vec3_ai);
|
||||||
EXPECT_TRUE(result.target->Is<sem::TypeInitializer>());
|
EXPECT_TRUE(result.target->Is<sem::ValueConstructor>());
|
||||||
ASSERT_EQ(result.target->Parameters().Length(), 3u);
|
ASSERT_EQ(result.target->Parameters().Length(), 3u);
|
||||||
EXPECT_EQ(result.target->Parameters()[0]->Type(), ai);
|
EXPECT_EQ(result.target->Parameters()[0]->Type(), ai);
|
||||||
EXPECT_EQ(result.target->Parameters()[1]->Type(), ai);
|
EXPECT_EQ(result.target->Parameters()[1]->Type(), ai);
|
||||||
|
@ -929,14 +929,14 @@ TEST_F(IntrinsicTableTest, MatchTypeInitializer_ConstantEval) {
|
||||||
|
|
||||||
TEST_F(IntrinsicTableTest, MatchTypeInitializer_RuntimeEval) {
|
TEST_F(IntrinsicTableTest, MatchTypeInitializer_RuntimeEval) {
|
||||||
auto* ai = create<type::AbstractInt>();
|
auto* ai = create<type::AbstractInt>();
|
||||||
auto result = table->Lookup(InitConvIntrinsic::kVec3, nullptr, utils::Vector{ai, ai, ai},
|
auto result = table->Lookup(CtorConvIntrinsic::kVec3, nullptr, utils::Vector{ai, ai, ai},
|
||||||
sem::EvaluationStage::kRuntime, Source{{12, 34}});
|
sem::EvaluationStage::kRuntime, Source{{12, 34}});
|
||||||
auto* i32 = create<type::I32>();
|
auto* i32 = create<type::I32>();
|
||||||
auto* vec3_i32 = create<type::Vector>(i32, 3u);
|
auto* vec3_i32 = create<type::Vector>(i32, 3u);
|
||||||
ASSERT_NE(result.target, nullptr);
|
ASSERT_NE(result.target, nullptr);
|
||||||
EXPECT_EQ(result.target->Stage(), sem::EvaluationStage::kConstant);
|
EXPECT_EQ(result.target->Stage(), sem::EvaluationStage::kConstant);
|
||||||
EXPECT_EQ(result.target->ReturnType(), vec3_i32);
|
EXPECT_EQ(result.target->ReturnType(), vec3_i32);
|
||||||
EXPECT_TRUE(result.target->Is<sem::TypeInitializer>());
|
EXPECT_TRUE(result.target->Is<sem::ValueConstructor>());
|
||||||
ASSERT_EQ(result.target->Parameters().Length(), 3u);
|
ASSERT_EQ(result.target->Parameters().Length(), 3u);
|
||||||
EXPECT_EQ(result.target->Parameters()[0]->Type(), i32);
|
EXPECT_EQ(result.target->Parameters()[0]->Type(), i32);
|
||||||
EXPECT_EQ(result.target->Parameters()[1]->Type(), i32);
|
EXPECT_EQ(result.target->Parameters()[1]->Type(), i32);
|
||||||
|
@ -949,11 +949,11 @@ TEST_F(IntrinsicTableTest, MatchTypeConversion) {
|
||||||
auto* vec3_i32 = create<type::Vector>(i32, 3u);
|
auto* vec3_i32 = create<type::Vector>(i32, 3u);
|
||||||
auto* f32 = create<type::F32>();
|
auto* f32 = create<type::F32>();
|
||||||
auto* vec3_f32 = create<type::Vector>(f32, 3u);
|
auto* vec3_f32 = create<type::Vector>(f32, 3u);
|
||||||
auto result = table->Lookup(InitConvIntrinsic::kVec3, i32, utils::Vector{vec3_f32},
|
auto result = table->Lookup(CtorConvIntrinsic::kVec3, i32, utils::Vector{vec3_f32},
|
||||||
sem::EvaluationStage::kConstant, Source{{12, 34}});
|
sem::EvaluationStage::kConstant, Source{{12, 34}});
|
||||||
ASSERT_NE(result.target, nullptr);
|
ASSERT_NE(result.target, nullptr);
|
||||||
EXPECT_EQ(result.target->ReturnType(), vec3_i32);
|
EXPECT_EQ(result.target->ReturnType(), vec3_i32);
|
||||||
EXPECT_TRUE(result.target->Is<sem::TypeConversion>());
|
EXPECT_TRUE(result.target->Is<sem::ValueConversion>());
|
||||||
ASSERT_EQ(result.target->Parameters().Length(), 1u);
|
ASSERT_EQ(result.target->Parameters().Length(), 1u);
|
||||||
EXPECT_EQ(result.target->Parameters()[0]->Type(), vec3_f32);
|
EXPECT_EQ(result.target->Parameters()[0]->Type(), vec3_f32);
|
||||||
}
|
}
|
||||||
|
@ -962,13 +962,13 @@ TEST_F(IntrinsicTableTest, MismatchTypeConversion) {
|
||||||
auto* arr =
|
auto* arr =
|
||||||
create<type::Array>(create<type::U32>(), create<type::RuntimeArrayCount>(), 4u, 4u, 4u, 4u);
|
create<type::Array>(create<type::U32>(), create<type::RuntimeArrayCount>(), 4u, 4u, 4u, 4u);
|
||||||
auto* f32 = create<type::F32>();
|
auto* f32 = create<type::F32>();
|
||||||
auto result = table->Lookup(InitConvIntrinsic::kVec3, f32, utils::Vector{arr},
|
auto result = table->Lookup(CtorConvIntrinsic::kVec3, f32, utils::Vector{arr},
|
||||||
sem::EvaluationStage::kConstant, Source{{12, 34}});
|
sem::EvaluationStage::kConstant, Source{{12, 34}});
|
||||||
ASSERT_EQ(result.target, nullptr);
|
ASSERT_EQ(result.target, nullptr);
|
||||||
EXPECT_EQ(Diagnostics().str(),
|
EXPECT_EQ(Diagnostics().str(),
|
||||||
R"(12:34 error: no matching initializer for vec3<f32>(array<u32>)
|
R"(12:34 error: no matching constructor for vec3<f32>(array<u32>)
|
||||||
|
|
||||||
6 candidate initializers:
|
6 candidate constructors:
|
||||||
vec3(vec3<T>) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
vec3(vec3<T>) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
||||||
vec3(T) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
vec3(T) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
||||||
vec3<T>() -> vec3<T> where: T is f32, f16, i32, u32 or bool
|
vec3<T>() -> vec3<T> where: T is f32, f16, i32, u32 or bool
|
||||||
|
@ -991,13 +991,13 @@ TEST_F(IntrinsicTableTest, MatchTypeConversion_ConstantEval) {
|
||||||
auto* vec3_ai = create<type::Vector>(ai, 3u);
|
auto* vec3_ai = create<type::Vector>(ai, 3u);
|
||||||
auto* f32 = create<type::F32>();
|
auto* f32 = create<type::F32>();
|
||||||
auto* vec3_f32 = create<type::Vector>(f32, 3u);
|
auto* vec3_f32 = create<type::Vector>(f32, 3u);
|
||||||
auto result = table->Lookup(InitConvIntrinsic::kVec3, af, utils::Vector{vec3_ai},
|
auto result = table->Lookup(CtorConvIntrinsic::kVec3, af, utils::Vector{vec3_ai},
|
||||||
sem::EvaluationStage::kConstant, Source{{12, 34}});
|
sem::EvaluationStage::kConstant, Source{{12, 34}});
|
||||||
ASSERT_NE(result.target, nullptr);
|
ASSERT_NE(result.target, nullptr);
|
||||||
EXPECT_EQ(result.target->Stage(), sem::EvaluationStage::kConstant);
|
EXPECT_EQ(result.target->Stage(), sem::EvaluationStage::kConstant);
|
||||||
// NOTE: Conversions are explicit, so there's no way to have it return abstracts
|
// NOTE: Conversions are explicit, so there's no way to have it return abstracts
|
||||||
EXPECT_EQ(result.target->ReturnType(), vec3_f32);
|
EXPECT_EQ(result.target->ReturnType(), vec3_f32);
|
||||||
EXPECT_TRUE(result.target->Is<sem::TypeConversion>());
|
EXPECT_TRUE(result.target->Is<sem::ValueConversion>());
|
||||||
ASSERT_EQ(result.target->Parameters().Length(), 1u);
|
ASSERT_EQ(result.target->Parameters().Length(), 1u);
|
||||||
EXPECT_EQ(result.target->Parameters()[0]->Type(), vec3_ai);
|
EXPECT_EQ(result.target->Parameters()[0]->Type(), vec3_ai);
|
||||||
}
|
}
|
||||||
|
@ -1008,12 +1008,12 @@ TEST_F(IntrinsicTableTest, MatchTypeConversion_RuntimeEval) {
|
||||||
auto* vec3_ai = create<type::Vector>(ai, 3u);
|
auto* vec3_ai = create<type::Vector>(ai, 3u);
|
||||||
auto* vec3_f32 = create<type::Vector>(create<type::F32>(), 3u);
|
auto* vec3_f32 = create<type::Vector>(create<type::F32>(), 3u);
|
||||||
auto* vec3_i32 = create<type::Vector>(create<type::I32>(), 3u);
|
auto* vec3_i32 = create<type::Vector>(create<type::I32>(), 3u);
|
||||||
auto result = table->Lookup(InitConvIntrinsic::kVec3, af, utils::Vector{vec3_ai},
|
auto result = table->Lookup(CtorConvIntrinsic::kVec3, af, utils::Vector{vec3_ai},
|
||||||
sem::EvaluationStage::kRuntime, Source{{12, 34}});
|
sem::EvaluationStage::kRuntime, Source{{12, 34}});
|
||||||
ASSERT_NE(result.target, nullptr);
|
ASSERT_NE(result.target, nullptr);
|
||||||
EXPECT_EQ(result.target->Stage(), sem::EvaluationStage::kConstant);
|
EXPECT_EQ(result.target->Stage(), sem::EvaluationStage::kConstant);
|
||||||
EXPECT_EQ(result.target->ReturnType(), vec3_f32);
|
EXPECT_EQ(result.target->ReturnType(), vec3_f32);
|
||||||
EXPECT_TRUE(result.target->Is<sem::TypeConversion>());
|
EXPECT_TRUE(result.target->Is<sem::ValueConversion>());
|
||||||
ASSERT_EQ(result.target->Parameters().Length(), 1u);
|
ASSERT_EQ(result.target->Parameters().Length(), 1u);
|
||||||
EXPECT_EQ(result.target->Parameters()[0]->Type(), vec3_i32);
|
EXPECT_EQ(result.target->Parameters()[0]->Type(), vec3_i32);
|
||||||
}
|
}
|
||||||
|
@ -1035,7 +1035,7 @@ TEST_F(IntrinsicTableTest, OverloadResolution) {
|
||||||
// The first should win overload resolution.
|
// The first should win overload resolution.
|
||||||
auto* ai = create<type::AbstractInt>();
|
auto* ai = create<type::AbstractInt>();
|
||||||
auto* i32 = create<type::I32>();
|
auto* i32 = create<type::I32>();
|
||||||
auto result = table->Lookup(InitConvIntrinsic::kI32, nullptr, utils::Vector{ai},
|
auto result = table->Lookup(CtorConvIntrinsic::kI32, nullptr, utils::Vector{ai},
|
||||||
sem::EvaluationStage::kConstant, Source{});
|
sem::EvaluationStage::kConstant, Source{});
|
||||||
ASSERT_NE(result.target, nullptr);
|
ASSERT_NE(result.target, nullptr);
|
||||||
EXPECT_EQ(result.target->ReturnType(), i32);
|
EXPECT_EQ(result.target->ReturnType(), i32);
|
||||||
|
|
|
@ -60,9 +60,9 @@
|
||||||
#include "src/tint/sem/statement.h"
|
#include "src/tint/sem/statement.h"
|
||||||
#include "src/tint/sem/struct.h"
|
#include "src/tint/sem/struct.h"
|
||||||
#include "src/tint/sem/switch_statement.h"
|
#include "src/tint/sem/switch_statement.h"
|
||||||
#include "src/tint/sem/type_conversion.h"
|
|
||||||
#include "src/tint/sem/type_expression.h"
|
#include "src/tint/sem/type_expression.h"
|
||||||
#include "src/tint/sem/type_initializer.h"
|
#include "src/tint/sem/value_constructor.h"
|
||||||
|
#include "src/tint/sem/value_conversion.h"
|
||||||
#include "src/tint/sem/variable.h"
|
#include "src/tint/sem/variable.h"
|
||||||
#include "src/tint/sem/while_statement.h"
|
#include "src/tint/sem/while_statement.h"
|
||||||
#include "src/tint/type/abstract_float.h"
|
#include "src/tint/type/abstract_float.h"
|
||||||
|
@ -1939,8 +1939,8 @@ sem::Call* Resolver::Call(const ast::CallExpression* expr) {
|
||||||
// A CallExpression can resolve to one of:
|
// A CallExpression can resolve to one of:
|
||||||
// * A function call.
|
// * A function call.
|
||||||
// * A builtin call.
|
// * A builtin call.
|
||||||
// * A type initializer.
|
// * A value constructor.
|
||||||
// * A type conversion.
|
// * A value conversion.
|
||||||
auto* target = expr->target;
|
auto* target = expr->target;
|
||||||
Mark(target);
|
Mark(target);
|
||||||
|
|
||||||
|
@ -1967,42 +1967,41 @@ sem::Call* Resolver::Call(const ast::CallExpression* expr) {
|
||||||
bool has_side_effects =
|
bool has_side_effects =
|
||||||
std::any_of(args.begin(), args.end(), [](auto* e) { return e->HasSideEffects(); });
|
std::any_of(args.begin(), args.end(), [](auto* e) { return e->HasSideEffects(); });
|
||||||
|
|
||||||
// init_or_conv is a helper for building either a sem::TypeInitializer or
|
// ctor_or_conv is a helper for building either a sem::ValueConstructor or
|
||||||
// sem::TypeConversion call for a InitConvIntrinsic with an optional template argument type.
|
// sem::ValueConversion call for a CtorConvIntrinsic with an optional template argument type.
|
||||||
auto init_or_conv = [&](InitConvIntrinsic ty, const type::Type* template_arg) -> sem::Call* {
|
auto ctor_or_conv = [&](CtorConvIntrinsic ty, const type::Type* template_arg) -> sem::Call* {
|
||||||
auto arg_tys = utils::Transform(args, [](auto* arg) { return arg->Type(); });
|
auto arg_tys = utils::Transform(args, [](auto* arg) { return arg->Type(); });
|
||||||
auto ctor_or_conv =
|
auto entry = intrinsic_table_->Lookup(ty, template_arg, arg_tys, args_stage, expr->source);
|
||||||
intrinsic_table_->Lookup(ty, template_arg, arg_tys, args_stage, expr->source);
|
if (!entry.target) {
|
||||||
if (!ctor_or_conv.target) {
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!MaybeMaterializeAndLoadArguments(args, ctor_or_conv.target)) {
|
if (!MaybeMaterializeAndLoadArguments(args, entry.target)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const constant::Value* value = nullptr;
|
const constant::Value* value = nullptr;
|
||||||
auto stage = sem::EarliestStage(ctor_or_conv.target->Stage(), args_stage);
|
auto stage = sem::EarliestStage(entry.target->Stage(), args_stage);
|
||||||
if (stage == sem::EvaluationStage::kConstant && skip_const_eval_.Contains(expr)) {
|
if (stage == sem::EvaluationStage::kConstant && skip_const_eval_.Contains(expr)) {
|
||||||
stage = sem::EvaluationStage::kNotEvaluated;
|
stage = sem::EvaluationStage::kNotEvaluated;
|
||||||
}
|
}
|
||||||
if (stage == sem::EvaluationStage::kConstant) {
|
if (stage == sem::EvaluationStage::kConstant) {
|
||||||
auto const_args = ConvertArguments(args, ctor_or_conv.target);
|
auto const_args = ConvertArguments(args, entry.target);
|
||||||
if (!const_args) {
|
if (!const_args) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (auto r = (const_eval_.*ctor_or_conv.const_eval_fn)(
|
if (auto r = (const_eval_.*entry.const_eval_fn)(entry.target->ReturnType(),
|
||||||
ctor_or_conv.target->ReturnType(), const_args.Get(), expr->source)) {
|
const_args.Get(), expr->source)) {
|
||||||
value = r.Get();
|
value = r.Get();
|
||||||
} else {
|
} else {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return builder_->create<sem::Call>(expr, ctor_or_conv.target, stage, std::move(args),
|
return builder_->create<sem::Call>(expr, entry.target, stage, std::move(args),
|
||||||
current_statement_, value, has_side_effects);
|
current_statement_, value, has_side_effects);
|
||||||
};
|
};
|
||||||
|
|
||||||
// arr_or_str_init is a helper for building a sem::TypeInitializer for an array or structure
|
// arr_or_str_init is a helper for building a sem::ValueConstructor for an array or structure
|
||||||
// initializer call target.
|
// constructor call target.
|
||||||
auto arr_or_str_init = [&](const type::Type* ty,
|
auto arr_or_str_init = [&](const type::Type* ty,
|
||||||
const sem::CallTarget* call_target) -> sem::Call* {
|
const sem::CallTarget* call_target) -> sem::Call* {
|
||||||
if (!MaybeMaterializeAndLoadArguments(args, call_target)) {
|
if (!MaybeMaterializeAndLoadArguments(args, call_target)) {
|
||||||
|
@ -2012,7 +2011,7 @@ sem::Call* Resolver::Call(const ast::CallExpression* expr) {
|
||||||
auto stage = args_stage; // The evaluation stage of the call
|
auto stage = args_stage; // The evaluation stage of the call
|
||||||
const constant::Value* value = nullptr; // The constant value for the call
|
const constant::Value* value = nullptr; // The constant value for the call
|
||||||
if (stage == sem::EvaluationStage::kConstant) {
|
if (stage == sem::EvaluationStage::kConstant) {
|
||||||
if (auto r = const_eval_.ArrayOrStructInit(ty, args)) {
|
if (auto r = const_eval_.ArrayOrStructCtor(ty, args)) {
|
||||||
value = r.Get();
|
value = r.Get();
|
||||||
} else {
|
} else {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -2021,7 +2020,7 @@ sem::Call* Resolver::Call(const ast::CallExpression* expr) {
|
||||||
// Constant evaluation failed.
|
// Constant evaluation failed.
|
||||||
// Can happen for expressions that will fail validation (later).
|
// Can happen for expressions that will fail validation (later).
|
||||||
// Use the kRuntime EvaluationStage, as kConstant will trigger an assertion in
|
// Use the kRuntime EvaluationStage, as kConstant will trigger an assertion in
|
||||||
// the sem::ValueExpression initializer, which checks that kConstant is paired
|
// the sem::ValueExpression constructor, which checks that kConstant is paired
|
||||||
// with a constant value.
|
// with a constant value.
|
||||||
stage = sem::EvaluationStage::kRuntime;
|
stage = sem::EvaluationStage::kRuntime;
|
||||||
}
|
}
|
||||||
|
@ -2034,25 +2033,25 @@ sem::Call* Resolver::Call(const ast::CallExpression* expr) {
|
||||||
auto ty_init_or_conv = [&](const type::Type* type) {
|
auto ty_init_or_conv = [&](const type::Type* type) {
|
||||||
return Switch(
|
return Switch(
|
||||||
type, //
|
type, //
|
||||||
[&](const type::I32*) { return init_or_conv(InitConvIntrinsic::kI32, nullptr); },
|
[&](const type::I32*) { return ctor_or_conv(CtorConvIntrinsic::kI32, nullptr); },
|
||||||
[&](const type::U32*) { return init_or_conv(InitConvIntrinsic::kU32, nullptr); },
|
[&](const type::U32*) { return ctor_or_conv(CtorConvIntrinsic::kU32, nullptr); },
|
||||||
[&](const type::F16*) {
|
[&](const type::F16*) {
|
||||||
return validator_.CheckF16Enabled(expr->source)
|
return validator_.CheckF16Enabled(expr->source)
|
||||||
? init_or_conv(InitConvIntrinsic::kF16, nullptr)
|
? ctor_or_conv(CtorConvIntrinsic::kF16, nullptr)
|
||||||
: nullptr;
|
: nullptr;
|
||||||
},
|
},
|
||||||
[&](const type::F32*) { return init_or_conv(InitConvIntrinsic::kF32, nullptr); },
|
[&](const type::F32*) { return ctor_or_conv(CtorConvIntrinsic::kF32, nullptr); },
|
||||||
[&](const type::Bool*) { return init_or_conv(InitConvIntrinsic::kBool, nullptr); },
|
[&](const type::Bool*) { return ctor_or_conv(CtorConvIntrinsic::kBool, nullptr); },
|
||||||
[&](const type::Vector* v) {
|
[&](const type::Vector* v) {
|
||||||
return init_or_conv(VectorInitConvIntrinsic(v->Width()), v->type());
|
return ctor_or_conv(VectorCtorConvIntrinsic(v->Width()), v->type());
|
||||||
},
|
},
|
||||||
[&](const type::Matrix* m) {
|
[&](const type::Matrix* m) {
|
||||||
return init_or_conv(MatrixInitConvIntrinsic(m->columns(), m->rows()), m->type());
|
return ctor_or_conv(MatrixCtorConvIntrinsic(m->columns(), m->rows()), m->type());
|
||||||
},
|
},
|
||||||
[&](const type::Array* arr) -> sem::Call* {
|
[&](const type::Array* arr) -> sem::Call* {
|
||||||
auto* call_target = array_inits_.GetOrCreate(
|
auto* call_target = array_ctors_.GetOrCreate(
|
||||||
ArrayInitializerSig{{arr, args.Length(), args_stage}},
|
ArrayConstructorSig{{arr, args.Length(), args_stage}},
|
||||||
[&]() -> sem::TypeInitializer* {
|
[&]() -> sem::ValueConstructor* {
|
||||||
auto params = utils::Transform(args, [&](auto, size_t i) {
|
auto params = utils::Transform(args, [&](auto, size_t i) {
|
||||||
return builder_->create<sem::Parameter>(
|
return builder_->create<sem::Parameter>(
|
||||||
nullptr, // declaration
|
nullptr, // declaration
|
||||||
|
@ -2061,8 +2060,8 @@ sem::Call* Resolver::Call(const ast::CallExpression* expr) {
|
||||||
builtin::AddressSpace::kUndefined, // address_space
|
builtin::AddressSpace::kUndefined, // address_space
|
||||||
builtin::Access::kUndefined);
|
builtin::Access::kUndefined);
|
||||||
});
|
});
|
||||||
return builder_->create<sem::TypeInitializer>(arr, std::move(params),
|
return builder_->create<sem::ValueConstructor>(arr, std::move(params),
|
||||||
args_stage);
|
args_stage);
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* call = arr_or_str_init(arr, call_target);
|
auto* call = arr_or_str_init(arr, call_target);
|
||||||
|
@ -2071,15 +2070,15 @@ sem::Call* Resolver::Call(const ast::CallExpression* expr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validation must occur after argument materialization in arr_or_str_init().
|
// Validation must occur after argument materialization in arr_or_str_init().
|
||||||
if (!validator_.ArrayInitializer(expr, arr)) {
|
if (!validator_.ArrayConstructor(expr, arr)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return call;
|
return call;
|
||||||
},
|
},
|
||||||
[&](const sem::Struct* str) -> sem::Call* {
|
[&](const sem::Struct* str) -> sem::Call* {
|
||||||
auto* call_target = struct_inits_.GetOrCreate(
|
auto* call_target = struct_ctors_.GetOrCreate(
|
||||||
StructInitializerSig{{str, args.Length(), args_stage}},
|
StructConstructorSig{{str, args.Length(), args_stage}},
|
||||||
[&]() -> sem::TypeInitializer* {
|
[&]() -> sem::ValueConstructor* {
|
||||||
utils::Vector<const sem::Parameter*, 8> params;
|
utils::Vector<const sem::Parameter*, 8> params;
|
||||||
params.Resize(std::min(args.Length(), str->Members().Length()));
|
params.Resize(std::min(args.Length(), str->Members().Length()));
|
||||||
for (size_t i = 0, n = params.Length(); i < n; i++) {
|
for (size_t i = 0, n = params.Length(); i < n; i++) {
|
||||||
|
@ -2090,8 +2089,8 @@ sem::Call* Resolver::Call(const ast::CallExpression* expr) {
|
||||||
builtin::AddressSpace::kUndefined, // address_space
|
builtin::AddressSpace::kUndefined, // address_space
|
||||||
builtin::Access::kUndefined); // access
|
builtin::Access::kUndefined); // access
|
||||||
}
|
}
|
||||||
return builder_->create<sem::TypeInitializer>(str, std::move(params),
|
return builder_->create<sem::ValueConstructor>(str, std::move(params),
|
||||||
args_stage);
|
args_stage);
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* call = arr_or_str_init(str, call_target);
|
auto* call = arr_or_str_init(str, call_target);
|
||||||
|
@ -2117,7 +2116,7 @@ sem::Call* Resolver::Call(const ast::CallExpression* expr) {
|
||||||
auto arg_tys = utils::Transform(args, [](auto* arg) { return arg->Type()->UnwrapRef(); });
|
auto arg_tys = utils::Transform(args, [](auto* arg) { return arg->Type()->UnwrapRef(); });
|
||||||
auto el_ty = type::Type::Common(arg_tys);
|
auto el_ty = type::Type::Common(arg_tys);
|
||||||
if (!el_ty) {
|
if (!el_ty) {
|
||||||
AddError("cannot infer common array element type from initializer arguments",
|
AddError("cannot infer common array element type from constructor arguments",
|
||||||
expr->source);
|
expr->source);
|
||||||
utils::Hashset<const type::Type*, 8> types;
|
utils::Hashset<const type::Type*, 8> types;
|
||||||
for (size_t i = 0; i < args.Length(); i++) {
|
for (size_t i = 0; i < args.Length(); i++) {
|
||||||
|
@ -2172,29 +2171,29 @@ sem::Call* Resolver::Call(const ast::CallExpression* expr) {
|
||||||
case builtin::Builtin::kArray:
|
case builtin::Builtin::kArray:
|
||||||
return inferred_array();
|
return inferred_array();
|
||||||
case builtin::Builtin::kVec2:
|
case builtin::Builtin::kVec2:
|
||||||
return init_or_conv(InitConvIntrinsic::kVec2, nullptr);
|
return ctor_or_conv(CtorConvIntrinsic::kVec2, nullptr);
|
||||||
case builtin::Builtin::kVec3:
|
case builtin::Builtin::kVec3:
|
||||||
return init_or_conv(InitConvIntrinsic::kVec3, nullptr);
|
return ctor_or_conv(CtorConvIntrinsic::kVec3, nullptr);
|
||||||
case builtin::Builtin::kVec4:
|
case builtin::Builtin::kVec4:
|
||||||
return init_or_conv(InitConvIntrinsic::kVec4, nullptr);
|
return ctor_or_conv(CtorConvIntrinsic::kVec4, nullptr);
|
||||||
case builtin::Builtin::kMat2X2:
|
case builtin::Builtin::kMat2X2:
|
||||||
return init_or_conv(InitConvIntrinsic::kMat2x2, nullptr);
|
return ctor_or_conv(CtorConvIntrinsic::kMat2x2, nullptr);
|
||||||
case builtin::Builtin::kMat2X3:
|
case builtin::Builtin::kMat2X3:
|
||||||
return init_or_conv(InitConvIntrinsic::kMat2x3, nullptr);
|
return ctor_or_conv(CtorConvIntrinsic::kMat2x3, nullptr);
|
||||||
case builtin::Builtin::kMat2X4:
|
case builtin::Builtin::kMat2X4:
|
||||||
return init_or_conv(InitConvIntrinsic::kMat2x4, nullptr);
|
return ctor_or_conv(CtorConvIntrinsic::kMat2x4, nullptr);
|
||||||
case builtin::Builtin::kMat3X2:
|
case builtin::Builtin::kMat3X2:
|
||||||
return init_or_conv(InitConvIntrinsic::kMat3x2, nullptr);
|
return ctor_or_conv(CtorConvIntrinsic::kMat3x2, nullptr);
|
||||||
case builtin::Builtin::kMat3X3:
|
case builtin::Builtin::kMat3X3:
|
||||||
return init_or_conv(InitConvIntrinsic::kMat3x3, nullptr);
|
return ctor_or_conv(CtorConvIntrinsic::kMat3x3, nullptr);
|
||||||
case builtin::Builtin::kMat3X4:
|
case builtin::Builtin::kMat3X4:
|
||||||
return init_or_conv(InitConvIntrinsic::kMat3x4, nullptr);
|
return ctor_or_conv(CtorConvIntrinsic::kMat3x4, nullptr);
|
||||||
case builtin::Builtin::kMat4X2:
|
case builtin::Builtin::kMat4X2:
|
||||||
return init_or_conv(InitConvIntrinsic::kMat4x2, nullptr);
|
return ctor_or_conv(CtorConvIntrinsic::kMat4x2, nullptr);
|
||||||
case builtin::Builtin::kMat4X3:
|
case builtin::Builtin::kMat4X3:
|
||||||
return init_or_conv(InitConvIntrinsic::kMat4x3, nullptr);
|
return ctor_or_conv(CtorConvIntrinsic::kMat4x3, nullptr);
|
||||||
case builtin::Builtin::kMat4X4:
|
case builtin::Builtin::kMat4X4:
|
||||||
return init_or_conv(InitConvIntrinsic::kMat4x4, nullptr);
|
return ctor_or_conv(CtorConvIntrinsic::kMat4x4, nullptr);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2219,7 +2218,7 @@ sem::Call* Resolver::Call(const ast::CallExpression* expr) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (call->Target()->IsAnyOf<sem::TypeInitializer, sem::TypeConversion>()) {
|
if (call->Target()->IsAnyOf<sem::ValueConstructor, sem::ValueConversion>()) {
|
||||||
// The target of the call was a type.
|
// The target of the call was a type.
|
||||||
// Associate the target identifier expression with the resolved type.
|
// Associate the target identifier expression with the resolved type.
|
||||||
auto* ty_expr =
|
auto* ty_expr =
|
||||||
|
|
|
@ -67,7 +67,6 @@ class LoopStatement;
|
||||||
class Statement;
|
class Statement;
|
||||||
class StructMember;
|
class StructMember;
|
||||||
class SwitchStatement;
|
class SwitchStatement;
|
||||||
class TypeInitializer;
|
|
||||||
class WhileStatement;
|
class WhileStatement;
|
||||||
} // namespace tint::sem
|
} // namespace tint::sem
|
||||||
namespace tint::type {
|
namespace tint::type {
|
||||||
|
@ -497,15 +496,15 @@ class Resolver {
|
||||||
/// @note: Will raise an ICE if @p symbol is not a builtin type.
|
/// @note: Will raise an ICE if @p symbol is not a builtin type.
|
||||||
type::Type* BuiltinType(builtin::Builtin builtin_ty, const ast::Identifier* ident);
|
type::Type* BuiltinType(builtin::Builtin builtin_ty, const ast::Identifier* ident);
|
||||||
|
|
||||||
// ArrayInitializerSig represents a unique array initializer signature.
|
// ArrayConstructorSig represents a unique array constructor signature.
|
||||||
// It is a tuple of the array type, number of arguments provided and earliest evaluation stage.
|
// It is a tuple of the array type, number of arguments provided and earliest evaluation stage.
|
||||||
using ArrayInitializerSig =
|
using ArrayConstructorSig =
|
||||||
utils::UnorderedKeyWrapper<std::tuple<const type::Array*, size_t, sem::EvaluationStage>>;
|
utils::UnorderedKeyWrapper<std::tuple<const type::Array*, size_t, sem::EvaluationStage>>;
|
||||||
|
|
||||||
// StructInitializerSig represents a unique structure initializer signature.
|
// StructConstructorSig represents a unique structure constructor signature.
|
||||||
// It is a tuple of the structure type, number of arguments provided and earliest evaluation
|
// It is a tuple of the structure type, number of arguments provided and earliest evaluation
|
||||||
// stage.
|
// stage.
|
||||||
using StructInitializerSig =
|
using StructConstructorSig =
|
||||||
utils::UnorderedKeyWrapper<std::tuple<const sem::Struct*, size_t, sem::EvaluationStage>>;
|
utils::UnorderedKeyWrapper<std::tuple<const sem::Struct*, size_t, sem::EvaluationStage>>;
|
||||||
|
|
||||||
/// ExprEvalStageConstraint describes a constraint on when expressions can be evaluated.
|
/// ExprEvalStageConstraint describes a constraint on when expressions can be evaluated.
|
||||||
|
@ -555,8 +554,8 @@ class Resolver {
|
||||||
ExprEvalStageConstraint expr_eval_stage_constraint_;
|
ExprEvalStageConstraint expr_eval_stage_constraint_;
|
||||||
std::unordered_map<const sem::Function*, AliasAnalysisInfo> alias_analysis_infos_;
|
std::unordered_map<const sem::Function*, AliasAnalysisInfo> alias_analysis_infos_;
|
||||||
utils::Hashmap<OverrideId, const sem::Variable*, 8> override_ids_;
|
utils::Hashmap<OverrideId, const sem::Variable*, 8> override_ids_;
|
||||||
utils::Hashmap<ArrayInitializerSig, sem::CallTarget*, 8> array_inits_;
|
utils::Hashmap<ArrayConstructorSig, sem::CallTarget*, 8> array_ctors_;
|
||||||
utils::Hashmap<StructInitializerSig, sem::CallTarget*, 8> struct_inits_;
|
utils::Hashmap<StructConstructorSig, sem::CallTarget*, 8> struct_ctors_;
|
||||||
sem::Function* current_function_ = nullptr;
|
sem::Function* current_function_ = nullptr;
|
||||||
sem::Statement* current_statement_ = nullptr;
|
sem::Statement* current_statement_ = nullptr;
|
||||||
sem::CompoundStatement* current_compound_statement_ = nullptr;
|
sem::CompoundStatement* current_compound_statement_ = nullptr;
|
||||||
|
|
|
@ -114,7 +114,7 @@ void SemHelper::ErrorExpectedValueExpr(const sem::Expression* expr) const {
|
||||||
ErrorUnexpectedExprKind(expr, "value");
|
ErrorUnexpectedExprKind(expr, "value");
|
||||||
if (auto* ty_expr = expr->As<sem::TypeExpression>()) {
|
if (auto* ty_expr = expr->As<sem::TypeExpression>()) {
|
||||||
if (auto* ident = ty_expr->Declaration()->As<ast::IdentifierExpression>()) {
|
if (auto* ident = ty_expr->Declaration()->As<ast::IdentifierExpression>()) {
|
||||||
AddNote("are you missing '()' for type initializer?",
|
AddNote("are you missing '()' for value constructor?",
|
||||||
Source{{ident->source.range.end}});
|
Source{{ident->source.range.end}});
|
||||||
}
|
}
|
||||||
if (auto* str = ty_expr->Type()->As<type::Struct>()) {
|
if (auto* str = ty_expr->Type()->As<type::Struct>()) {
|
||||||
|
|
|
@ -34,8 +34,8 @@
|
||||||
#include "src/tint/sem/loop_statement.h"
|
#include "src/tint/sem/loop_statement.h"
|
||||||
#include "src/tint/sem/statement.h"
|
#include "src/tint/sem/statement.h"
|
||||||
#include "src/tint/sem/switch_statement.h"
|
#include "src/tint/sem/switch_statement.h"
|
||||||
#include "src/tint/sem/type_conversion.h"
|
#include "src/tint/sem/value_constructor.h"
|
||||||
#include "src/tint/sem/type_initializer.h"
|
#include "src/tint/sem/value_conversion.h"
|
||||||
#include "src/tint/sem/variable.h"
|
#include "src/tint/sem/variable.h"
|
||||||
#include "src/tint/sem/while_statement.h"
|
#include "src/tint/sem/while_statement.h"
|
||||||
#include "src/tint/utils/block_allocator.h"
|
#include "src/tint/utils/block_allocator.h"
|
||||||
|
@ -1541,11 +1541,11 @@ class UniformityGraph {
|
||||||
function_tag = info->function_tag;
|
function_tag = info->function_tag;
|
||||||
func_info = info;
|
func_info = info;
|
||||||
},
|
},
|
||||||
[&](const sem::TypeInitializer*) {
|
[&](const sem::ValueConstructor*) {
|
||||||
callsite_tag = {CallSiteTag::CallSiteNoRestriction};
|
callsite_tag = {CallSiteTag::CallSiteNoRestriction};
|
||||||
function_tag = NoRestriction;
|
function_tag = NoRestriction;
|
||||||
},
|
},
|
||||||
[&](const sem::TypeConversion*) {
|
[&](const sem::ValueConversion*) {
|
||||||
callsite_tag = {CallSiteTag::CallSiteNoRestriction};
|
callsite_tag = {CallSiteTag::CallSiteNoRestriction};
|
||||||
function_tag = NoRestriction;
|
function_tag = NoRestriction;
|
||||||
},
|
},
|
||||||
|
@ -1631,7 +1631,7 @@ class UniformityGraph {
|
||||||
current_function_->RequiredToBeUniform(default_severity)->AddEdge(args[i]);
|
current_function_->RequiredToBeUniform(default_severity)->AddEdge(args[i]);
|
||||||
} else {
|
} else {
|
||||||
// All other builtin function parameters are RequiredToBeUniformForReturnValue,
|
// All other builtin function parameters are RequiredToBeUniformForReturnValue,
|
||||||
// as are parameters for type initializers and type conversions.
|
// as are parameters for value constructors and value conversions.
|
||||||
result->AddEdge(args[i]);
|
result->AddEdge(args[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,8 +49,8 @@
|
||||||
#include "src/tint/sem/statement.h"
|
#include "src/tint/sem/statement.h"
|
||||||
#include "src/tint/sem/struct.h"
|
#include "src/tint/sem/struct.h"
|
||||||
#include "src/tint/sem/switch_statement.h"
|
#include "src/tint/sem/switch_statement.h"
|
||||||
#include "src/tint/sem/type_conversion.h"
|
#include "src/tint/sem/value_constructor.h"
|
||||||
#include "src/tint/sem/type_initializer.h"
|
#include "src/tint/sem/value_conversion.h"
|
||||||
#include "src/tint/sem/variable.h"
|
#include "src/tint/sem/variable.h"
|
||||||
#include "src/tint/sem/while_statement.h"
|
#include "src/tint/sem/while_statement.h"
|
||||||
#include "src/tint/type/abstract_numeric.h"
|
#include "src/tint/type/abstract_numeric.h"
|
||||||
|
@ -1507,11 +1507,11 @@ bool Validator::Call(const sem::Call* call, sem::Statement* current_statement) c
|
||||||
AddError("ignoring return value of builtin '" + utils::ToString(b->Type()) + "'",
|
AddError("ignoring return value of builtin '" + utils::ToString(b->Type()) + "'",
|
||||||
call->Declaration()->source);
|
call->Declaration()->source);
|
||||||
},
|
},
|
||||||
[&](const sem::TypeConversion*) {
|
[&](const sem::ValueConversion*) {
|
||||||
AddError("type conversion evaluated but not used", call->Declaration()->source);
|
AddError("value conversion evaluated but not used", call->Declaration()->source);
|
||||||
},
|
},
|
||||||
[&](const sem::TypeInitializer*) {
|
[&](const sem::ValueConstructor*) {
|
||||||
AddError("type initializer evaluated but not used", call->Declaration()->source);
|
AddError("value constructor evaluated but not used", call->Declaration()->source);
|
||||||
},
|
},
|
||||||
[&](Default) {
|
[&](Default) {
|
||||||
AddError("return value of call not used", call->Declaration()->source);
|
AddError("return value of call not used", call->Declaration()->source);
|
||||||
|
@ -1825,14 +1825,14 @@ bool Validator::FunctionCall(const sem::Call* call, sem::Statement* current_stat
|
||||||
bool Validator::StructureInitializer(const ast::CallExpression* ctor,
|
bool Validator::StructureInitializer(const ast::CallExpression* ctor,
|
||||||
const sem::Struct* struct_type) const {
|
const sem::Struct* struct_type) const {
|
||||||
if (!struct_type->IsConstructible()) {
|
if (!struct_type->IsConstructible()) {
|
||||||
AddError("struct initializer has non-constructible type", ctor->source);
|
AddError("structure constructor has non-constructible type", ctor->source);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctor->args.Length() > 0) {
|
if (ctor->args.Length() > 0) {
|
||||||
if (ctor->args.Length() != struct_type->Members().Length()) {
|
if (ctor->args.Length() != struct_type->Members().Length()) {
|
||||||
std::string fm = ctor->args.Length() < struct_type->Members().Length() ? "few" : "many";
|
std::string fm = ctor->args.Length() < struct_type->Members().Length() ? "few" : "many";
|
||||||
AddError("struct initializer has too " + fm + " inputs: expected " +
|
AddError("structure constructor has too " + fm + " inputs: expected " +
|
||||||
std::to_string(struct_type->Members().Length()) + ", found " +
|
std::to_string(struct_type->Members().Length()) + ", found " +
|
||||||
std::to_string(ctor->args.Length()),
|
std::to_string(ctor->args.Length()),
|
||||||
ctor->source);
|
ctor->source);
|
||||||
|
@ -1843,7 +1843,7 @@ bool Validator::StructureInitializer(const ast::CallExpression* ctor,
|
||||||
auto* value_ty = sem_.TypeOf(value);
|
auto* value_ty = sem_.TypeOf(value);
|
||||||
if (member->Type() != value_ty->UnwrapRef()) {
|
if (member->Type() != value_ty->UnwrapRef()) {
|
||||||
AddError(
|
AddError(
|
||||||
"type in struct initializer does not match struct member type: expected '" +
|
"type in structure constructor does not match struct member type: expected '" +
|
||||||
sem_.TypeNameOf(member->Type()) + "', found '" + sem_.TypeNameOf(value_ty) +
|
sem_.TypeNameOf(member->Type()) + "', found '" + sem_.TypeNameOf(value_ty) +
|
||||||
"'",
|
"'",
|
||||||
value->source);
|
value->source);
|
||||||
|
@ -1854,7 +1854,7 @@ bool Validator::StructureInitializer(const ast::CallExpression* ctor,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Validator::ArrayInitializer(const ast::CallExpression* ctor,
|
bool Validator::ArrayConstructor(const ast::CallExpression* ctor,
|
||||||
const type::Array* array_type) const {
|
const type::Array* array_type) const {
|
||||||
auto& values = ctor->args;
|
auto& values = ctor->args;
|
||||||
auto* elem_ty = array_type->ElemType();
|
auto* elem_ty = array_type->ElemType();
|
||||||
|
@ -1881,7 +1881,7 @@ bool Validator::ArrayInitializer(const ast::CallExpression* ctor,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!elem_ty->IsConstructible()) {
|
if (!elem_ty->IsConstructible()) {
|
||||||
AddError("array initializer has non-constructible element type", ctor->source);
|
AddError("array constructor has non-constructible element type", ctor->source);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1893,7 +1893,7 @@ bool Validator::ArrayInitializer(const ast::CallExpression* ctor,
|
||||||
const auto count = c->As<type::ConstantArrayCount>()->value;
|
const auto count = c->As<type::ConstantArrayCount>()->value;
|
||||||
if (!values.IsEmpty() && (values.Length() != count)) {
|
if (!values.IsEmpty() && (values.Length() != count)) {
|
||||||
std::string fm = values.Length() < count ? "few" : "many";
|
std::string fm = values.Length() < count ? "few" : "many";
|
||||||
AddError("array initializer has too " + fm + " elements: expected " +
|
AddError("array constructor has too " + fm + " elements: expected " +
|
||||||
std::to_string(count) + ", found " + std::to_string(values.Length()),
|
std::to_string(count) + ", found " + std::to_string(values.Length()),
|
||||||
ctor->source);
|
ctor->source);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -61,7 +61,6 @@ class LoopStatement;
|
||||||
class Materialize;
|
class Materialize;
|
||||||
class Statement;
|
class Statement;
|
||||||
class SwitchStatement;
|
class SwitchStatement;
|
||||||
class TypeInitializer;
|
|
||||||
class WhileStatement;
|
class WhileStatement;
|
||||||
} // namespace tint::sem
|
} // namespace tint::sem
|
||||||
namespace tint::type {
|
namespace tint::type {
|
||||||
|
@ -445,11 +444,11 @@ class Validator {
|
||||||
/// @returns true on success, false otherwise
|
/// @returns true on success, false otherwise
|
||||||
bool Vector(const type::Type* el_ty, const Source& source) const;
|
bool Vector(const type::Type* el_ty, const Source& source) const;
|
||||||
|
|
||||||
/// Validates an array initializer
|
/// Validates an array constructor
|
||||||
/// @param ctor the call expresion to validate
|
/// @param ctor the call expresion to validate
|
||||||
/// @param arr_type the type of the array
|
/// @param arr_type the type of the array
|
||||||
/// @returns true on success, false otherwise
|
/// @returns true on success, false otherwise
|
||||||
bool ArrayInitializer(const ast::CallExpression* ctor, const type::Array* arr_type) const;
|
bool ArrayConstructor(const ast::CallExpression* ctor, const type::Array* arr_type) const;
|
||||||
|
|
||||||
/// Validates a texture builtin function
|
/// Validates a texture builtin function
|
||||||
/// @param call the builtin call to validate
|
/// @param call the builtin call to validate
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -62,8 +62,8 @@ struct CallTargetSignature {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// CallTarget is the base for callable functions, builtins, type initializers
|
/// CallTarget is the base for callable functions, builtins, value constructors and value
|
||||||
/// and type casts.
|
/// conversions.
|
||||||
class CallTarget : public Castable<CallTarget, Node> {
|
class CallTarget : public Castable<CallTarget, Node> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
|
|
@ -12,19 +12,19 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "src/tint/sem/type_initializer.h"
|
#include "src/tint/sem/value_constructor.h"
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
TINT_INSTANTIATE_TYPEINFO(tint::sem::TypeInitializer);
|
TINT_INSTANTIATE_TYPEINFO(tint::sem::ValueConstructor);
|
||||||
|
|
||||||
namespace tint::sem {
|
namespace tint::sem {
|
||||||
|
|
||||||
TypeInitializer::TypeInitializer(const type::Type* type,
|
ValueConstructor::ValueConstructor(const type::Type* type,
|
||||||
utils::VectorRef<const Parameter*> parameters,
|
utils::VectorRef<const Parameter*> parameters,
|
||||||
EvaluationStage stage)
|
EvaluationStage stage)
|
||||||
: Base(type, std::move(parameters), stage, /* must_use */ true) {}
|
: Base(type, std::move(parameters), stage, /* must_use */ true) {}
|
||||||
|
|
||||||
TypeInitializer::~TypeInitializer() = default;
|
ValueConstructor::~ValueConstructor() = default;
|
||||||
|
|
||||||
} // namespace tint::sem
|
} // namespace tint::sem
|
|
@ -12,29 +12,29 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#ifndef SRC_TINT_SEM_TYPE_INITIALIZER_H_
|
#ifndef SRC_TINT_SEM_VALUE_CONSTRUCTOR_H_
|
||||||
#define SRC_TINT_SEM_TYPE_INITIALIZER_H_
|
#define SRC_TINT_SEM_VALUE_CONSTRUCTOR_H_
|
||||||
|
|
||||||
#include "src/tint/sem/call_target.h"
|
#include "src/tint/sem/call_target.h"
|
||||||
#include "src/tint/utils/vector.h"
|
#include "src/tint/utils/vector.h"
|
||||||
|
|
||||||
namespace tint::sem {
|
namespace tint::sem {
|
||||||
|
|
||||||
/// TypeInitializer is the CallTarget for a type initializer.
|
/// ValueConstructor is the CallTarget for a value constructor.
|
||||||
class TypeInitializer final : public Castable<TypeInitializer, CallTarget> {
|
class ValueConstructor final : public Castable<ValueConstructor, CallTarget> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// @param type the type that's being constructed
|
/// @param type the type that's being constructed
|
||||||
/// @param parameters the type initializer parameters
|
/// @param parameters the constructor parameters
|
||||||
/// @param stage the earliest evaluation stage for the expression
|
/// @param stage the earliest evaluation stage for the expression
|
||||||
TypeInitializer(const type::Type* type,
|
ValueConstructor(const type::Type* type,
|
||||||
utils::VectorRef<const Parameter*> parameters,
|
utils::VectorRef<const Parameter*> parameters,
|
||||||
EvaluationStage stage);
|
EvaluationStage stage);
|
||||||
|
|
||||||
/// Destructor
|
/// Destructor
|
||||||
~TypeInitializer() override;
|
~ValueConstructor() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace tint::sem
|
} // namespace tint::sem
|
||||||
|
|
||||||
#endif // SRC_TINT_SEM_TYPE_INITIALIZER_H_
|
#endif // SRC_TINT_SEM_VALUE_CONSTRUCTOR_H_
|
|
@ -12,17 +12,17 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "src/tint/sem/type_conversion.h"
|
#include "src/tint/sem/value_conversion.h"
|
||||||
|
|
||||||
TINT_INSTANTIATE_TYPEINFO(tint::sem::TypeConversion);
|
TINT_INSTANTIATE_TYPEINFO(tint::sem::ValueConversion);
|
||||||
|
|
||||||
namespace tint::sem {
|
namespace tint::sem {
|
||||||
|
|
||||||
TypeConversion::TypeConversion(const type::Type* type,
|
ValueConversion::ValueConversion(const type::Type* type,
|
||||||
const sem::Parameter* parameter,
|
const sem::Parameter* parameter,
|
||||||
EvaluationStage stage)
|
EvaluationStage stage)
|
||||||
: Base(type, utils::Vector<const sem::Parameter*, 1>{parameter}, stage, /* must_use */ true) {}
|
: Base(type, utils::Vector<const sem::Parameter*, 1>{parameter}, stage, /* must_use */ true) {}
|
||||||
|
|
||||||
TypeConversion::~TypeConversion() = default;
|
ValueConversion::~ValueConversion() = default;
|
||||||
|
|
||||||
} // namespace tint::sem
|
} // namespace tint::sem
|
|
@ -12,24 +12,24 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#ifndef SRC_TINT_SEM_TYPE_CONVERSION_H_
|
#ifndef SRC_TINT_SEM_VALUE_CONVERSION_H_
|
||||||
#define SRC_TINT_SEM_TYPE_CONVERSION_H_
|
#define SRC_TINT_SEM_VALUE_CONVERSION_H_
|
||||||
|
|
||||||
#include "src/tint/sem/call_target.h"
|
#include "src/tint/sem/call_target.h"
|
||||||
|
|
||||||
namespace tint::sem {
|
namespace tint::sem {
|
||||||
|
|
||||||
/// TypeConversion is the CallTarget for a type conversion (cast).
|
/// ValueConversion is the CallTarget for a value conversion (cast).
|
||||||
class TypeConversion final : public Castable<TypeConversion, CallTarget> {
|
class ValueConversion final : public Castable<ValueConversion, CallTarget> {
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// @param type the target type of the cast
|
/// @param type the target type of the cast
|
||||||
/// @param parameter the type cast parameter
|
/// @param parameter the type cast parameter
|
||||||
/// @param stage the earliest evaluation stage for the expression
|
/// @param stage the earliest evaluation stage for the expression
|
||||||
TypeConversion(const type::Type* type, const sem::Parameter* parameter, EvaluationStage stage);
|
ValueConversion(const type::Type* type, const sem::Parameter* parameter, EvaluationStage stage);
|
||||||
|
|
||||||
/// Destructor
|
/// Destructor
|
||||||
~TypeConversion() override;
|
~ValueConversion() override;
|
||||||
|
|
||||||
/// @returns the cast source type
|
/// @returns the cast source type
|
||||||
const type::Type* Source() const { return Parameters()[0]->Type(); }
|
const type::Type* Source() const { return Parameters()[0]->Type(); }
|
||||||
|
@ -40,4 +40,4 @@ class TypeConversion final : public Castable<TypeConversion, CallTarget> {
|
||||||
|
|
||||||
} // namespace tint::sem
|
} // namespace tint::sem
|
||||||
|
|
||||||
#endif // SRC_TINT_SEM_TYPE_CONVERSION_H_
|
#endif // SRC_TINT_SEM_VALUE_CONVERSION_H_
|
|
@ -22,7 +22,7 @@
|
||||||
#include "src/tint/sem/call.h"
|
#include "src/tint/sem/call.h"
|
||||||
#include "src/tint/sem/member_accessor_expression.h"
|
#include "src/tint/sem/member_accessor_expression.h"
|
||||||
#include "src/tint/sem/type_expression.h"
|
#include "src/tint/sem/type_expression.h"
|
||||||
#include "src/tint/sem/type_initializer.h"
|
#include "src/tint/sem/value_constructor.h"
|
||||||
#include "src/tint/sem/value_expression.h"
|
#include "src/tint/sem/value_expression.h"
|
||||||
#include "src/tint/transform/simplify_pointers.h"
|
#include "src/tint/transform/simplify_pointers.h"
|
||||||
#include "src/tint/utils/hash.h"
|
#include "src/tint/utils/hash.h"
|
||||||
|
@ -134,18 +134,16 @@ Transform::ApplyResult DecomposeStridedArray::Apply(const Program* src,
|
||||||
return nullptr;
|
return nullptr;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Find all array type initializer expressions for array types that have had
|
// Find all constructor expressions for array types that have had their element changed to a
|
||||||
// their element changed to a single field structure. These initializers are
|
// single field structure. These constructors are adjusted to wrap each of the arguments with an
|
||||||
// adjusted to wrap each of the arguments with an additional initializer for
|
// additional initializer for the new element structure type. Example:
|
||||||
// the new element structure type.
|
|
||||||
// Example:
|
|
||||||
// `@stride(32) array<i32, 3>(1, 2, 3)`
|
// `@stride(32) array<i32, 3>(1, 2, 3)`
|
||||||
// ->
|
// ->
|
||||||
// `array<strided_arr, 3>(strided_arr(1), strided_arr(2), strided_arr(3))`
|
// `array<strided_arr, 3>(strided_arr(1), strided_arr(2), strided_arr(3))`
|
||||||
ctx.ReplaceAll([&](const ast::CallExpression* expr) -> const ast::Expression* {
|
ctx.ReplaceAll([&](const ast::CallExpression* expr) -> const ast::Expression* {
|
||||||
if (!expr->args.IsEmpty()) {
|
if (!expr->args.IsEmpty()) {
|
||||||
if (auto* call = sem.Get(expr)->UnwrapMaterialize()->As<sem::Call>()) {
|
if (auto* call = sem.Get(expr)->UnwrapMaterialize()->As<sem::Call>()) {
|
||||||
if (auto* ctor = call->Target()->As<sem::TypeInitializer>()) {
|
if (auto* ctor = call->Target()->As<sem::ValueConstructor>()) {
|
||||||
if (auto* arr = ctor->ReturnType()->As<type::Array>()) {
|
if (auto* arr = ctor->ReturnType()->As<type::Array>()) {
|
||||||
// Begin by cloning the array initializer type or name
|
// Begin by cloning the array initializer type or name
|
||||||
// If this is an unaliased array, this may add a new entry to
|
// If this is an unaliased array, this may add a new entry to
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "src/tint/program_builder.h"
|
#include "src/tint/program_builder.h"
|
||||||
#include "src/tint/sem/call.h"
|
#include "src/tint/sem/call.h"
|
||||||
#include "src/tint/sem/module.h"
|
#include "src/tint/sem/module.h"
|
||||||
#include "src/tint/sem/type_initializer.h"
|
#include "src/tint/sem/value_constructor.h"
|
||||||
|
|
||||||
using namespace tint::number_suffixes; // NOLINT
|
using namespace tint::number_suffixes; // NOLINT
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ Transform::ApplyResult PadStructs::Apply(const Program* src, const DataMap&, Dat
|
||||||
if (!call) {
|
if (!call) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
auto* cons = call->Target()->As<sem::TypeInitializer>();
|
auto* cons = call->Target()->As<sem::ValueConstructor>();
|
||||||
if (!cons) {
|
if (!cons) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "src/tint/program_builder.h"
|
#include "src/tint/program_builder.h"
|
||||||
#include "src/tint/sem/call.h"
|
#include "src/tint/sem/call.h"
|
||||||
#include "src/tint/sem/statement.h"
|
#include "src/tint/sem/statement.h"
|
||||||
#include "src/tint/sem/type_initializer.h"
|
#include "src/tint/sem/value_constructor.h"
|
||||||
#include "src/tint/transform/utils/hoist_to_decl_before.h"
|
#include "src/tint/transform/utils/hoist_to_decl_before.h"
|
||||||
#include "src/tint/type/struct.h"
|
#include "src/tint/type/struct.h"
|
||||||
#include "src/tint/utils/hashset.h"
|
#include "src/tint/utils/hashset.h"
|
||||||
|
@ -58,8 +58,8 @@ Transform::ApplyResult PromoteInitializersToLet::Apply(const Program* src,
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* ctor = root_expr->UnwrapMaterialize()->As<sem::Call>();
|
auto* ctor = root_expr->UnwrapMaterialize()->As<sem::Call>();
|
||||||
if (!ctor || !ctor->Target()->Is<sem::TypeInitializer>()) {
|
if (!ctor || !ctor->Target()->Is<sem::ValueConstructor>()) {
|
||||||
// Root expression is not a type constructor. Not interested in this.
|
// Root expression is not a value constructor. Not interested in this.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,8 +61,8 @@ Transform::ApplyResult RemovePhonies::Apply(const Program* src, const DataMap&,
|
||||||
if (!ast::TraverseExpressions(
|
if (!ast::TraverseExpressions(
|
||||||
stmt->rhs, b.Diagnostics(), [&](const ast::CallExpression* expr) {
|
stmt->rhs, b.Diagnostics(), [&](const ast::CallExpression* expr) {
|
||||||
// ast::CallExpression may map to a function or builtin call
|
// ast::CallExpression may map to a function or builtin call
|
||||||
// (both may have side-effects), or a type initializer or
|
// (both may have side-effects), or a value constructor or value
|
||||||
// type conversion (both do not have side effects).
|
// conversion (both do not have side effects).
|
||||||
auto* call = sem.Get<sem::Call>(expr);
|
auto* call = sem.Get<sem::Call>(expr);
|
||||||
if (!call) {
|
if (!call) {
|
||||||
// Semantic node must be a Materialize, in which case the
|
// Semantic node must be a Materialize, in which case the
|
||||||
|
|
|
@ -21,9 +21,9 @@
|
||||||
#include "src/tint/sem/builtin_enum_expression.h"
|
#include "src/tint/sem/builtin_enum_expression.h"
|
||||||
#include "src/tint/sem/call.h"
|
#include "src/tint/sem/call.h"
|
||||||
#include "src/tint/sem/member_accessor_expression.h"
|
#include "src/tint/sem/member_accessor_expression.h"
|
||||||
#include "src/tint/sem/type_conversion.h"
|
|
||||||
#include "src/tint/sem/type_expression.h"
|
#include "src/tint/sem/type_expression.h"
|
||||||
#include "src/tint/sem/type_initializer.h"
|
#include "src/tint/sem/value_constructor.h"
|
||||||
|
#include "src/tint/sem/value_conversion.h"
|
||||||
#include "src/tint/text/unicode.h"
|
#include "src/tint/text/unicode.h"
|
||||||
|
|
||||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::Renamer);
|
TINT_INSTANTIATE_TYPEINFO(tint::transform::Renamer);
|
||||||
|
@ -1309,10 +1309,10 @@ Transform::ApplyResult Renamer::Apply(const Program* src,
|
||||||
[&](const sem::Builtin*) {
|
[&](const sem::Builtin*) {
|
||||||
preserved_identifiers.Add(call->target->identifier);
|
preserved_identifiers.Add(call->target->identifier);
|
||||||
},
|
},
|
||||||
[&](const sem::TypeConversion*) {
|
[&](const sem::ValueConversion*) {
|
||||||
preserve_if_builtin_type(call->target->identifier);
|
preserve_if_builtin_type(call->target->identifier);
|
||||||
},
|
},
|
||||||
[&](const sem::TypeInitializer*) {
|
[&](const sem::ValueConstructor*) {
|
||||||
preserve_if_builtin_type(call->target->identifier);
|
preserve_if_builtin_type(call->target->identifier);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1792,7 +1792,7 @@ fn tint_symbol() {
|
||||||
|
|
||||||
TEST_P(RenamerBuiltinTypeTest, PreserveTypeConversion) {
|
TEST_P(RenamerBuiltinTypeTest, PreserveTypeConversion) {
|
||||||
if (std::string_view(GetParam()) == "array") {
|
if (std::string_view(GetParam()) == "array") {
|
||||||
return; // Cannot type convert arrays.
|
return; // Cannot value convert arrays.
|
||||||
}
|
}
|
||||||
|
|
||||||
auto expand = [&](const char* source) {
|
auto expand = [&](const char* source) {
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include "src/tint/program_builder.h"
|
#include "src/tint/program_builder.h"
|
||||||
#include "src/tint/sem/call.h"
|
#include "src/tint/sem/call.h"
|
||||||
#include "src/tint/sem/type_conversion.h"
|
#include "src/tint/sem/value_conversion.h"
|
||||||
#include "src/tint/sem/value_expression.h"
|
#include "src/tint/sem/value_expression.h"
|
||||||
#include "src/tint/type/abstract_numeric.h"
|
#include "src/tint/type/abstract_numeric.h"
|
||||||
#include "src/tint/utils/hash.h"
|
#include "src/tint/utils/hash.h"
|
||||||
|
@ -36,7 +36,8 @@ bool ShouldRun(const Program* program) {
|
||||||
for (auto* node : program->ASTNodes().Objects()) {
|
for (auto* node : program->ASTNodes().Objects()) {
|
||||||
if (auto* sem = program->Sem().GetVal(node)) {
|
if (auto* sem = program->Sem().GetVal(node)) {
|
||||||
if (auto* call = sem->UnwrapMaterialize()->As<sem::Call>()) {
|
if (auto* call = sem->UnwrapMaterialize()->As<sem::Call>()) {
|
||||||
if (call->Target()->Is<sem::TypeConversion>() && call->Type()->Is<type::Matrix>()) {
|
if (call->Target()->Is<sem::ValueConversion>() &&
|
||||||
|
call->Type()->Is<type::Matrix>()) {
|
||||||
auto& args = call->Arguments();
|
auto& args = call->Arguments();
|
||||||
if (args.Length() == 1 && args[0]->Type()->UnwrapRef()->is_float_matrix()) {
|
if (args.Length() == 1 && args[0]->Type()->UnwrapRef()->is_float_matrix()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -71,7 +72,7 @@ Transform::ApplyResult VectorizeMatrixConversions::Apply(const Program* src,
|
||||||
|
|
||||||
ctx.ReplaceAll([&](const ast::CallExpression* expr) -> const ast::CallExpression* {
|
ctx.ReplaceAll([&](const ast::CallExpression* expr) -> const ast::CallExpression* {
|
||||||
auto* call = src->Sem().Get(expr)->UnwrapMaterialize()->As<sem::Call>();
|
auto* call = src->Sem().Get(expr)->UnwrapMaterialize()->As<sem::Call>();
|
||||||
auto* ty_conv = call->Target()->As<sem::TypeConversion>();
|
auto* ty_conv = call->Target()->As<sem::ValueConversion>();
|
||||||
if (!ty_conv) {
|
if (!ty_conv) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include "src/tint/program_builder.h"
|
#include "src/tint/program_builder.h"
|
||||||
#include "src/tint/sem/call.h"
|
#include "src/tint/sem/call.h"
|
||||||
#include "src/tint/sem/type_initializer.h"
|
#include "src/tint/sem/value_constructor.h"
|
||||||
#include "src/tint/sem/value_expression.h"
|
#include "src/tint/sem/value_expression.h"
|
||||||
#include "src/tint/type/abstract_numeric.h"
|
#include "src/tint/type/abstract_numeric.h"
|
||||||
#include "src/tint/utils/map.h"
|
#include "src/tint/utils/map.h"
|
||||||
|
@ -32,7 +32,7 @@ namespace {
|
||||||
bool ShouldRun(const Program* program) {
|
bool ShouldRun(const Program* program) {
|
||||||
for (auto* node : program->ASTNodes().Objects()) {
|
for (auto* node : program->ASTNodes().Objects()) {
|
||||||
if (auto* call = program->Sem().Get<sem::Call>(node)) {
|
if (auto* call = program->Sem().Get<sem::Call>(node)) {
|
||||||
if (call->Target()->Is<sem::TypeInitializer>() && call->Type()->Is<type::Matrix>()) {
|
if (call->Target()->Is<sem::ValueConstructor>() && call->Type()->Is<type::Matrix>()) {
|
||||||
auto& args = call->Arguments();
|
auto& args = call->Arguments();
|
||||||
if (!args.IsEmpty() && args[0]->Type()->UnwrapRef()->is_scalar()) {
|
if (!args.IsEmpty() && args[0]->Type()->UnwrapRef()->is_scalar()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -63,7 +63,7 @@ Transform::ApplyResult VectorizeScalarMatrixInitializers::Apply(const Program* s
|
||||||
|
|
||||||
ctx.ReplaceAll([&](const ast::CallExpression* expr) -> const ast::CallExpression* {
|
ctx.ReplaceAll([&](const ast::CallExpression* expr) -> const ast::CallExpression* {
|
||||||
auto* call = src->Sem().Get(expr)->UnwrapMaterialize()->As<sem::Call>();
|
auto* call = src->Sem().Get(expr)->UnwrapMaterialize()->As<sem::Call>();
|
||||||
auto* ty_init = call->Target()->As<sem::TypeInitializer>();
|
auto* ty_init = call->Target()->As<sem::ValueConstructor>();
|
||||||
if (!ty_init) {
|
if (!ty_init) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -436,9 +436,8 @@ struct ZeroInitWorkgroupMemory::State {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @returns true if a variable with store type `ty` can be efficiently zeroed
|
/// @returns true if a variable with store type `ty` can be efficiently zeroed
|
||||||
/// by assignment of a type initializer without operands. If
|
/// by assignment of a value constructor without operands. If CanTriviallyZero() returns false,
|
||||||
/// CanTriviallyZero() returns false, then the type needs to be
|
/// then the type needs to be initialized by decomposing the initialization into multiple
|
||||||
/// initialized by decomposing the initialization into multiple
|
|
||||||
/// sub-initializations.
|
/// sub-initializations.
|
||||||
/// @param ty the type to inspect
|
/// @param ty the type to inspect
|
||||||
bool CanTriviallyZero(const type::Type* ty) {
|
bool CanTriviallyZero(const type::Type* ty) {
|
||||||
|
|
|
@ -210,7 +210,7 @@ class BlockAllocator {
|
||||||
|
|
||||||
/// Creates a new `TYPE` owned by the BlockAllocator.
|
/// Creates a new `TYPE` owned by the BlockAllocator.
|
||||||
/// When the BlockAllocator is destructed the object will be destructed and freed.
|
/// When the BlockAllocator is destructed the object will be destructed and freed.
|
||||||
/// @param args the arguments to pass to the type constructor
|
/// @param args the arguments to pass to the constructor
|
||||||
/// @returns the pointer to the constructed object
|
/// @returns the pointer to the constructed object
|
||||||
template <typename TYPE = T, typename... ARGS>
|
template <typename TYPE = T, typename... ARGS>
|
||||||
TYPE* Create(ARGS&&... args) {
|
TYPE* Create(ARGS&&... args) {
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "src/tint/sem/call.h"
|
#include "src/tint/sem/call.h"
|
||||||
#include "src/tint/sem/type_conversion.h"
|
#include "src/tint/sem/value_constructor.h"
|
||||||
#include "src/tint/sem/type_initializer.h"
|
#include "src/tint/sem/value_conversion.h"
|
||||||
#include "src/tint/sem/value_expression.h"
|
#include "src/tint/sem/value_expression.h"
|
||||||
#include "src/tint/utils/transform.h"
|
#include "src/tint/utils/transform.h"
|
||||||
|
|
||||||
|
@ -28,14 +28,14 @@ using namespace tint::number_suffixes; // NOLINT
|
||||||
namespace tint::writer {
|
namespace tint::writer {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
struct VectorInitializerInfo {
|
struct VectorConstructorInfo {
|
||||||
const sem::Call* call = nullptr;
|
const sem::Call* call = nullptr;
|
||||||
const sem::TypeInitializer* ctor = nullptr;
|
const sem::ValueConstructor* ctor = nullptr;
|
||||||
operator bool() const { return call != nullptr; }
|
operator bool() const { return call != nullptr; }
|
||||||
};
|
};
|
||||||
VectorInitializerInfo AsVectorInitializer(const sem::ValueExpression* expr) {
|
VectorConstructorInfo AsVectorConstructor(const sem::ValueExpression* expr) {
|
||||||
if (auto* call = expr->As<sem::Call>()) {
|
if (auto* call = expr->As<sem::Call>()) {
|
||||||
if (auto* ctor = call->Target()->As<sem::TypeInitializer>()) {
|
if (auto* ctor = call->Target()->As<sem::ValueConstructor>()) {
|
||||||
if (ctor->ReturnType()->Is<type::Vector>()) {
|
if (ctor->ReturnType()->Is<type::Vector>()) {
|
||||||
return {call, ctor};
|
return {call, ctor};
|
||||||
}
|
}
|
||||||
|
@ -103,20 +103,20 @@ const sem::Call* AppendVector(ProgramBuilder* b,
|
||||||
auto packed_ast_ty = b->ty.vec(packed_el_ast_ty, packed_size);
|
auto packed_ast_ty = b->ty.vec(packed_el_ast_ty, packed_size);
|
||||||
auto* packed_sem_ty = b->create<type::Vector>(packed_el_sem_ty, packed_size);
|
auto* packed_sem_ty = b->create<type::Vector>(packed_el_sem_ty, packed_size);
|
||||||
|
|
||||||
// If the coordinates are already passed in a vector initializer, with only
|
// If the coordinates are already passed in a vector constructor, with only
|
||||||
// scalar components supplied, extract the elements into the new vector
|
// scalar components supplied, extract the elements into the new vector
|
||||||
// instead of nesting a vector-in-vector.
|
// instead of nesting a vector-in-vector.
|
||||||
// If the coordinates are a zero-initializer of the vector, then expand that
|
// If the coordinates are a zero-constructor of the vector, then expand that
|
||||||
// to scalar zeros.
|
// to scalar zeros.
|
||||||
// The other cases for a nested vector initializer are when it is used
|
// The other cases for a nested vector constructor are when it is used
|
||||||
// to convert a vector of a different type, e.g. vec2<i32>(vec2<u32>()).
|
// to convert a vector of a different type, e.g. vec2<i32>(vec2<u32>()).
|
||||||
// In that case, preserve the original argument, or you'll get a type error.
|
// In that case, preserve the original argument, or you'll get a type error.
|
||||||
|
|
||||||
utils::Vector<const sem::ValueExpression*, 4> packed;
|
utils::Vector<const sem::ValueExpression*, 4> packed;
|
||||||
if (auto vc = AsVectorInitializer(vector_sem)) {
|
if (auto vc = AsVectorConstructor(vector_sem)) {
|
||||||
const auto num_supplied = vc.call->Arguments().Length();
|
const auto num_supplied = vc.call->Arguments().Length();
|
||||||
if (num_supplied == 0) {
|
if (num_supplied == 0) {
|
||||||
// Zero-value vector initializer. Populate with zeros
|
// Zero-value vector constructor. Populate with zeros
|
||||||
for (uint32_t i = 0; i < packed_size - 1; i++) {
|
for (uint32_t i = 0; i < packed_size - 1; i++) {
|
||||||
auto* zero = Zero(*b, packed_el_sem_ty, statement);
|
auto* zero = Zero(*b, packed_el_sem_ty, statement);
|
||||||
packed.Push(zero);
|
packed.Push(zero);
|
||||||
|
@ -134,7 +134,7 @@ const sem::Call* AppendVector(ProgramBuilder* b,
|
||||||
if (packed_el_sem_ty != scalar_sem->Type()->UnwrapRef()) {
|
if (packed_el_sem_ty != scalar_sem->Type()->UnwrapRef()) {
|
||||||
// Cast scalar to the vector element type
|
// Cast scalar to the vector element type
|
||||||
auto* scalar_cast_ast = b->Call(packed_el_ast_ty, scalar_ast);
|
auto* scalar_cast_ast = b->Call(packed_el_ast_ty, scalar_ast);
|
||||||
auto* scalar_cast_target = b->create<sem::TypeConversion>(
|
auto* scalar_cast_target = b->create<sem::ValueConversion>(
|
||||||
packed_el_sem_ty,
|
packed_el_sem_ty,
|
||||||
b->create<sem::Parameter>(nullptr, 0u, scalar_sem->Type()->UnwrapRef(),
|
b->create<sem::Parameter>(nullptr, 0u, scalar_sem->Type()->UnwrapRef(),
|
||||||
builtin::AddressSpace::kUndefined,
|
builtin::AddressSpace::kUndefined,
|
||||||
|
@ -150,11 +150,11 @@ const sem::Call* AppendVector(ProgramBuilder* b,
|
||||||
packed.Push(scalar_sem);
|
packed.Push(scalar_sem);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* initializer_ast =
|
auto* ctor_ast =
|
||||||
b->Call(packed_ast_ty, utils::Transform(packed, [&](const sem::ValueExpression* expr) {
|
b->Call(packed_ast_ty, utils::Transform(packed, [&](const sem::ValueExpression* expr) {
|
||||||
return expr->Declaration();
|
return expr->Declaration();
|
||||||
}));
|
}));
|
||||||
auto* initializer_target = b->create<sem::TypeInitializer>(
|
auto* ctor_target = b->create<sem::ValueConstructor>(
|
||||||
packed_sem_ty,
|
packed_sem_ty,
|
||||||
utils::Transform(
|
utils::Transform(
|
||||||
packed,
|
packed,
|
||||||
|
@ -164,13 +164,12 @@ const sem::Call* AppendVector(ProgramBuilder* b,
|
||||||
builtin::AddressSpace::kUndefined, builtin::Access::kUndefined);
|
builtin::AddressSpace::kUndefined, builtin::Access::kUndefined);
|
||||||
}),
|
}),
|
||||||
sem::EvaluationStage::kRuntime);
|
sem::EvaluationStage::kRuntime);
|
||||||
auto* initializer_sem =
|
auto* ctor_sem = b->create<sem::Call>(ctor_ast, ctor_target, sem::EvaluationStage::kRuntime,
|
||||||
b->create<sem::Call>(initializer_ast, initializer_target, sem::EvaluationStage::kRuntime,
|
std::move(packed), statement,
|
||||||
std::move(packed), statement,
|
/* constant_value */ nullptr,
|
||||||
/* constant_value */ nullptr,
|
/* has_side_effects */ false);
|
||||||
/* has_side_effects */ false);
|
b->Sem().Add(ctor_ast, ctor_sem);
|
||||||
b->Sem().Add(initializer_ast, initializer_sem);
|
return ctor_sem;
|
||||||
return initializer_sem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace tint::writer
|
} // namespace tint::writer
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace tint::writer {
|
||||||
|
|
||||||
/// A helper function used to append a vector with an additional scalar.
|
/// A helper function used to append a vector with an additional scalar.
|
||||||
/// If the scalar's type does not match the target vector element type,
|
/// If the scalar's type does not match the target vector element type,
|
||||||
/// then it is value-converted (via TypeInitializer) before being added.
|
/// then it is value-converted (via ValueConstructor) before being added.
|
||||||
/// All types must have been assigned to the expressions and their child nodes
|
/// All types must have been assigned to the expressions and their child nodes
|
||||||
/// before calling.
|
/// before calling.
|
||||||
/// @param builder the program builder.
|
/// @param builder the program builder.
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include "src/tint/ast/test_helper.h"
|
#include "src/tint/ast/test_helper.h"
|
||||||
#include "src/tint/program_builder.h"
|
#include "src/tint/program_builder.h"
|
||||||
#include "src/tint/resolver/resolver.h"
|
#include "src/tint/resolver/resolver.h"
|
||||||
#include "src/tint/sem/type_initializer.h"
|
#include "src/tint/sem/value_constructor.h"
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ TEST_F(AppendVectorTest, Vec2i32_i32) {
|
||||||
EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_2));
|
EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_2));
|
||||||
EXPECT_EQ(call->Arguments()[2], Sem().Get(scalar_3));
|
EXPECT_EQ(call->Arguments()[2], Sem().Get(scalar_3));
|
||||||
|
|
||||||
auto* ctor = call->Target()->As<sem::TypeInitializer>();
|
auto* ctor = call->Target()->As<sem::ValueConstructor>();
|
||||||
ASSERT_NE(ctor, nullptr);
|
ASSERT_NE(ctor, nullptr);
|
||||||
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
|
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
|
||||||
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 3u);
|
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 3u);
|
||||||
|
@ -99,7 +99,7 @@ TEST_F(AppendVectorTest, Vec2i32_u32) {
|
||||||
EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_2));
|
EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_2));
|
||||||
EXPECT_EQ(call->Arguments()[2], Sem().Get(u32_to_i32));
|
EXPECT_EQ(call->Arguments()[2], Sem().Get(u32_to_i32));
|
||||||
|
|
||||||
auto* ctor = call->Target()->As<sem::TypeInitializer>();
|
auto* ctor = call->Target()->As<sem::ValueConstructor>();
|
||||||
ASSERT_NE(ctor, nullptr);
|
ASSERT_NE(ctor, nullptr);
|
||||||
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
|
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
|
||||||
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 3u);
|
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 3u);
|
||||||
|
@ -149,7 +149,7 @@ TEST_F(AppendVectorTest, Vec2i32FromVec2u32_u32) {
|
||||||
EXPECT_EQ(call->Arguments()[0], Sem().Get(vec_12));
|
EXPECT_EQ(call->Arguments()[0], Sem().Get(vec_12));
|
||||||
EXPECT_EQ(call->Arguments()[1], Sem().Get(u32_to_i32));
|
EXPECT_EQ(call->Arguments()[1], Sem().Get(u32_to_i32));
|
||||||
|
|
||||||
auto* ctor = call->Target()->As<sem::TypeInitializer>();
|
auto* ctor = call->Target()->As<sem::ValueConstructor>();
|
||||||
ASSERT_NE(ctor, nullptr);
|
ASSERT_NE(ctor, nullptr);
|
||||||
|
|
||||||
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
|
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
|
||||||
|
@ -193,7 +193,7 @@ TEST_F(AppendVectorTest, Vec2i32_f32) {
|
||||||
EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_2));
|
EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_2));
|
||||||
EXPECT_EQ(call->Arguments()[2], Sem().Get(f32_to_i32));
|
EXPECT_EQ(call->Arguments()[2], Sem().Get(f32_to_i32));
|
||||||
|
|
||||||
auto* ctor = call->Target()->As<sem::TypeInitializer>();
|
auto* ctor = call->Target()->As<sem::ValueConstructor>();
|
||||||
ASSERT_NE(ctor, nullptr);
|
ASSERT_NE(ctor, nullptr);
|
||||||
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
|
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
|
||||||
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 3u);
|
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 3u);
|
||||||
|
@ -236,7 +236,7 @@ TEST_F(AppendVectorTest, Vec3i32_i32) {
|
||||||
EXPECT_EQ(call->Arguments()[2], Sem().Get(scalar_3));
|
EXPECT_EQ(call->Arguments()[2], Sem().Get(scalar_3));
|
||||||
EXPECT_EQ(call->Arguments()[3], Sem().Get(scalar_4));
|
EXPECT_EQ(call->Arguments()[3], Sem().Get(scalar_4));
|
||||||
|
|
||||||
auto* ctor = call->Target()->As<sem::TypeInitializer>();
|
auto* ctor = call->Target()->As<sem::ValueConstructor>();
|
||||||
ASSERT_NE(ctor, nullptr);
|
ASSERT_NE(ctor, nullptr);
|
||||||
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
|
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
|
||||||
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 4u);
|
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 4u);
|
||||||
|
@ -274,7 +274,7 @@ TEST_F(AppendVectorTest, Vec2i32Var_i32) {
|
||||||
EXPECT_EQ(call->Arguments()[0], Sem().Get(vec_12));
|
EXPECT_EQ(call->Arguments()[0], Sem().Get(vec_12));
|
||||||
EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_3));
|
EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_3));
|
||||||
|
|
||||||
auto* ctor = call->Target()->As<sem::TypeInitializer>();
|
auto* ctor = call->Target()->As<sem::ValueConstructor>();
|
||||||
ASSERT_NE(ctor, nullptr);
|
ASSERT_NE(ctor, nullptr);
|
||||||
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
|
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
|
||||||
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 3u);
|
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 3u);
|
||||||
|
@ -314,7 +314,7 @@ TEST_F(AppendVectorTest, Vec2i32_i32Var) {
|
||||||
EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_2));
|
EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_2));
|
||||||
EXPECT_EQ(call->Arguments()[2], Sem().Get(scalar_3));
|
EXPECT_EQ(call->Arguments()[2], Sem().Get(scalar_3));
|
||||||
|
|
||||||
auto* ctor = call->Target()->As<sem::TypeInitializer>();
|
auto* ctor = call->Target()->As<sem::ValueConstructor>();
|
||||||
ASSERT_NE(ctor, nullptr);
|
ASSERT_NE(ctor, nullptr);
|
||||||
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
|
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
|
||||||
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 3u);
|
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 3u);
|
||||||
|
@ -352,7 +352,7 @@ TEST_F(AppendVectorTest, Vec2i32Var_i32Var) {
|
||||||
EXPECT_EQ(call->Arguments()[0], Sem().Get(vec_12));
|
EXPECT_EQ(call->Arguments()[0], Sem().Get(vec_12));
|
||||||
EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_3));
|
EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_3));
|
||||||
|
|
||||||
auto* ctor = call->Target()->As<sem::TypeInitializer>();
|
auto* ctor = call->Target()->As<sem::ValueConstructor>();
|
||||||
ASSERT_NE(ctor, nullptr);
|
ASSERT_NE(ctor, nullptr);
|
||||||
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
|
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
|
||||||
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 3u);
|
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 3u);
|
||||||
|
@ -393,7 +393,7 @@ TEST_F(AppendVectorTest, Vec2i32Var_f32Var) {
|
||||||
EXPECT_EQ(call->Arguments()[0], Sem().Get(vec_12));
|
EXPECT_EQ(call->Arguments()[0], Sem().Get(vec_12));
|
||||||
EXPECT_EQ(call->Arguments()[1], Sem().Get(f32_to_i32));
|
EXPECT_EQ(call->Arguments()[1], Sem().Get(f32_to_i32));
|
||||||
|
|
||||||
auto* ctor = call->Target()->As<sem::TypeInitializer>();
|
auto* ctor = call->Target()->As<sem::ValueConstructor>();
|
||||||
ASSERT_NE(ctor, nullptr);
|
ASSERT_NE(ctor, nullptr);
|
||||||
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
|
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
|
||||||
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 3u);
|
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 3u);
|
||||||
|
@ -430,7 +430,7 @@ TEST_F(AppendVectorTest, Vec2boolVar_boolVar) {
|
||||||
EXPECT_EQ(call->Arguments()[0], Sem().Get(vec_12));
|
EXPECT_EQ(call->Arguments()[0], Sem().Get(vec_12));
|
||||||
EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_3));
|
EXPECT_EQ(call->Arguments()[1], Sem().Get(scalar_3));
|
||||||
|
|
||||||
auto* ctor = call->Target()->As<sem::TypeInitializer>();
|
auto* ctor = call->Target()->As<sem::ValueConstructor>();
|
||||||
ASSERT_NE(ctor, nullptr);
|
ASSERT_NE(ctor, nullptr);
|
||||||
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
|
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
|
||||||
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 3u);
|
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 3u);
|
||||||
|
@ -471,7 +471,7 @@ TEST_F(AppendVectorTest, ZeroVec3i32_i32) {
|
||||||
EXPECT_EQ(call->Arguments()[2], Sem().Get(vec_0004->args[2]));
|
EXPECT_EQ(call->Arguments()[2], Sem().Get(vec_0004->args[2]));
|
||||||
EXPECT_EQ(call->Arguments()[3], Sem().Get(scalar));
|
EXPECT_EQ(call->Arguments()[3], Sem().Get(scalar));
|
||||||
|
|
||||||
auto* ctor = call->Target()->As<sem::TypeInitializer>();
|
auto* ctor = call->Target()->As<sem::ValueConstructor>();
|
||||||
ASSERT_NE(ctor, nullptr);
|
ASSERT_NE(ctor, nullptr);
|
||||||
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
|
ASSERT_TRUE(ctor->ReturnType()->Is<type::Vector>());
|
||||||
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 4u);
|
EXPECT_EQ(ctor->ReturnType()->As<type::Vector>()->Width(), 4u);
|
||||||
|
|
|
@ -36,8 +36,8 @@
|
||||||
#include "src/tint/sem/statement.h"
|
#include "src/tint/sem/statement.h"
|
||||||
#include "src/tint/sem/struct.h"
|
#include "src/tint/sem/struct.h"
|
||||||
#include "src/tint/sem/switch_statement.h"
|
#include "src/tint/sem/switch_statement.h"
|
||||||
#include "src/tint/sem/type_conversion.h"
|
#include "src/tint/sem/value_constructor.h"
|
||||||
#include "src/tint/sem/type_initializer.h"
|
#include "src/tint/sem/value_conversion.h"
|
||||||
#include "src/tint/sem/variable.h"
|
#include "src/tint/sem/variable.h"
|
||||||
#include "src/tint/transform/add_block_attribute.h"
|
#include "src/tint/transform/add_block_attribute.h"
|
||||||
#include "src/tint/transform/add_empty_entry_point.h"
|
#include "src/tint/transform/add_empty_entry_point.h"
|
||||||
|
@ -712,8 +712,8 @@ bool GeneratorImpl::EmitCall(std::ostream& out, const ast::CallExpression* expr)
|
||||||
call->Target(), //
|
call->Target(), //
|
||||||
[&](const sem::Function* fn) { return EmitFunctionCall(out, call, fn); },
|
[&](const sem::Function* fn) { return EmitFunctionCall(out, call, fn); },
|
||||||
[&](const sem::Builtin* builtin) { return EmitBuiltinCall(out, call, builtin); },
|
[&](const sem::Builtin* builtin) { return EmitBuiltinCall(out, call, builtin); },
|
||||||
[&](const sem::TypeConversion* conv) { return EmitTypeConversion(out, call, conv); },
|
[&](const sem::ValueConversion* conv) { return EmitValueConversion(out, call, conv); },
|
||||||
[&](const sem::TypeInitializer* init) { return EmitTypeInitializer(out, call, init); },
|
[&](const sem::ValueConstructor* ctor) { return EmitValueConstructor(out, call, ctor); },
|
||||||
[&](Default) {
|
[&](Default) {
|
||||||
TINT_ICE(Writer, diagnostics_)
|
TINT_ICE(Writer, diagnostics_)
|
||||||
<< "unhandled call target: " << call->Target()->TypeInfo().name;
|
<< "unhandled call target: " << call->Target()->TypeInfo().name;
|
||||||
|
@ -827,9 +827,9 @@ bool GeneratorImpl::EmitBuiltinCall(std::ostream& out,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GeneratorImpl::EmitTypeConversion(std::ostream& out,
|
bool GeneratorImpl::EmitValueConversion(std::ostream& out,
|
||||||
const sem::Call* call,
|
const sem::Call* call,
|
||||||
const sem::TypeConversion* conv) {
|
const sem::ValueConversion* conv) {
|
||||||
if (!EmitType(out, conv->Target(), builtin::AddressSpace::kUndefined,
|
if (!EmitType(out, conv->Target(), builtin::AddressSpace::kUndefined,
|
||||||
builtin::Access::kReadWrite, "")) {
|
builtin::Access::kReadWrite, "")) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -843,13 +843,13 @@ bool GeneratorImpl::EmitTypeConversion(std::ostream& out,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GeneratorImpl::EmitTypeInitializer(std::ostream& out,
|
bool GeneratorImpl::EmitValueConstructor(std::ostream& out,
|
||||||
const sem::Call* call,
|
const sem::Call* call,
|
||||||
const sem::TypeInitializer* ctor) {
|
const sem::ValueConstructor* ctor) {
|
||||||
auto* type = ctor->ReturnType();
|
auto* type = ctor->ReturnType();
|
||||||
|
|
||||||
// If the type initializer is empty then we need to construct with the zero
|
// If the value constructor is empty then we need to construct with the zero value for all
|
||||||
// value for all components.
|
// components.
|
||||||
if (call->Arguments().IsEmpty()) {
|
if (call->Arguments().IsEmpty()) {
|
||||||
return EmitZeroValue(out, type);
|
return EmitZeroValue(out, type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,10 +43,10 @@
|
||||||
|
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
namespace tint::sem {
|
namespace tint::sem {
|
||||||
class Call;
|
|
||||||
class Builtin;
|
class Builtin;
|
||||||
class TypeInitializer;
|
class Call;
|
||||||
class TypeConversion;
|
class ValueConstructor;
|
||||||
|
class ValueConversion;
|
||||||
} // namespace tint::sem
|
} // namespace tint::sem
|
||||||
|
|
||||||
namespace tint::writer::glsl {
|
namespace tint::writer::glsl {
|
||||||
|
@ -160,22 +160,22 @@ class GeneratorImpl : public TextGenerator {
|
||||||
/// @param builtin the builtin being called
|
/// @param builtin the builtin being called
|
||||||
/// @returns true if the expression is emitted
|
/// @returns true if the expression is emitted
|
||||||
bool EmitBuiltinCall(std::ostream& out, const sem::Call* call, const sem::Builtin* builtin);
|
bool EmitBuiltinCall(std::ostream& out, const sem::Call* call, const sem::Builtin* builtin);
|
||||||
/// Handles generating a type conversion expression
|
/// Handles generating a value conversion expression
|
||||||
/// @param out the output of the expression stream
|
/// @param out the output of the expression stream
|
||||||
/// @param call the call expression
|
/// @param call the call expression
|
||||||
/// @param conv the type conversion
|
/// @param conv the value conversion
|
||||||
/// @returns true if the expression is emitted
|
/// @returns true if the expression is emitted
|
||||||
bool EmitTypeConversion(std::ostream& out,
|
bool EmitValueConversion(std::ostream& out,
|
||||||
const sem::Call* call,
|
|
||||||
const sem::TypeConversion* conv);
|
|
||||||
/// Handles generating a type initializer expression
|
|
||||||
/// @param out the output of the expression stream
|
|
||||||
/// @param call the call expression
|
|
||||||
/// @param ctor the type initializer
|
|
||||||
/// @returns true if the expression is emitted
|
|
||||||
bool EmitTypeInitializer(std::ostream& out,
|
|
||||||
const sem::Call* call,
|
const sem::Call* call,
|
||||||
const sem::TypeInitializer* ctor);
|
const sem::ValueConversion* conv);
|
||||||
|
/// Handles generating a value constructor expression
|
||||||
|
/// @param out the output of the expression stream
|
||||||
|
/// @param call the call expression
|
||||||
|
/// @param ctor the value constructor
|
||||||
|
/// @returns true if the expression is emitted
|
||||||
|
bool EmitValueConstructor(std::ostream& out,
|
||||||
|
const sem::Call* call,
|
||||||
|
const sem::ValueConstructor* ctor);
|
||||||
/// Handles generating a barrier builtin call
|
/// Handles generating a barrier builtin call
|
||||||
/// @param out the output of the expression stream
|
/// @param out the output of the expression stream
|
||||||
/// @param builtin the semantic information for the barrier builtin
|
/// @param builtin the semantic information for the barrier builtin
|
||||||
|
|
|
@ -22,9 +22,9 @@ namespace {
|
||||||
|
|
||||||
using ::testing::HasSubstr;
|
using ::testing::HasSubstr;
|
||||||
|
|
||||||
using GlslGeneratorImplTest_Initializer = TestHelper;
|
using GlslGeneratorImplTest_Constructor = TestHelper;
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Bool) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Bool) {
|
||||||
WrapInFunction(Expr(false));
|
WrapInFunction(Expr(false));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -33,7 +33,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Bool) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("false"));
|
EXPECT_THAT(gen.result(), HasSubstr("false"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Int) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Int) {
|
||||||
WrapInFunction(Expr(-12345_i));
|
WrapInFunction(Expr(-12345_i));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -42,7 +42,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Int) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("-12345"));
|
EXPECT_THAT(gen.result(), HasSubstr("-12345"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_UInt) {
|
TEST_F(GlslGeneratorImplTest_Constructor, UInt) {
|
||||||
WrapInFunction(Expr(56779_u));
|
WrapInFunction(Expr(56779_u));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -51,7 +51,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_UInt) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("56779u"));
|
EXPECT_THAT(gen.result(), HasSubstr("56779u"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Float) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Float) {
|
||||||
// Use a number close to 1<<30 but whose decimal representation ends in 0.
|
// Use a number close to 1<<30 but whose decimal representation ends in 0.
|
||||||
WrapInFunction(Expr(f32((1 << 30) - 4)));
|
WrapInFunction(Expr(f32((1 << 30) - 4)));
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Float) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("1073741824.0f"));
|
EXPECT_THAT(gen.result(), HasSubstr("1073741824.0f"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_F16) {
|
TEST_F(GlslGeneratorImplTest_Constructor, F16) {
|
||||||
Enable(builtin::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.
|
||||||
|
@ -73,7 +73,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_F16) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("32752.0hf"));
|
EXPECT_THAT(gen.result(), HasSubstr("32752.0hf"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Float) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Float) {
|
||||||
WrapInFunction(Call<f32>(-1.2e-5_f));
|
WrapInFunction(Call<f32>(-1.2e-5_f));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -82,7 +82,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Float) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("-0.000012f"));
|
EXPECT_THAT(gen.result(), HasSubstr("-0.000012f"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_F16) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_F16) {
|
||||||
Enable(builtin::Extension::kF16);
|
Enable(builtin::Extension::kF16);
|
||||||
|
|
||||||
WrapInFunction(Call<f16>(-1.2e-3_h));
|
WrapInFunction(Call<f16>(-1.2e-3_h));
|
||||||
|
@ -93,7 +93,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_F16) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("-0.00119972229hf"));
|
EXPECT_THAT(gen.result(), HasSubstr("-0.00119972229hf"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Bool) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Bool) {
|
||||||
WrapInFunction(Call<bool>(true));
|
WrapInFunction(Call<bool>(true));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -102,7 +102,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Bool) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("true"));
|
EXPECT_THAT(gen.result(), HasSubstr("true"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Int) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Int) {
|
||||||
WrapInFunction(Call<i32>(-12345_i));
|
WrapInFunction(Call<i32>(-12345_i));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -111,7 +111,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Int) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("-12345"));
|
EXPECT_THAT(gen.result(), HasSubstr("-12345"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Uint) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Uint) {
|
||||||
WrapInFunction(Call<u32>(12345_u));
|
WrapInFunction(Call<u32>(12345_u));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -120,7 +120,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Uint) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("12345u"));
|
EXPECT_THAT(gen.result(), HasSubstr("12345u"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_F32) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Vec_F32) {
|
||||||
WrapInFunction(vec3<f32>(1_f, 2_f, 3_f));
|
WrapInFunction(vec3<f32>(1_f, 2_f, 3_f));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -129,7 +129,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_F32) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("vec3(1.0f, 2.0f, 3.0f)"));
|
EXPECT_THAT(gen.result(), HasSubstr("vec3(1.0f, 2.0f, 3.0f)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_F16) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Vec_F16) {
|
||||||
Enable(builtin::Extension::kF16);
|
Enable(builtin::Extension::kF16);
|
||||||
|
|
||||||
WrapInFunction(vec3<f16>(1_h, 2_h, 3_h));
|
WrapInFunction(vec3<f16>(1_h, 2_h, 3_h));
|
||||||
|
@ -140,7 +140,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_F16) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("f16vec3(1.0hf, 2.0hf, 3.0hf)"));
|
EXPECT_THAT(gen.result(), HasSubstr("f16vec3(1.0hf, 2.0hf, 3.0hf)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_Empty_F32) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Vec_Empty_F32) {
|
||||||
WrapInFunction(vec3<f32>());
|
WrapInFunction(vec3<f32>());
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -149,7 +149,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_Empty_F32) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("vec3(0.0f)"));
|
EXPECT_THAT(gen.result(), HasSubstr("vec3(0.0f)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_Empty_F16) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Vec_Empty_F16) {
|
||||||
Enable(builtin::Extension::kF16);
|
Enable(builtin::Extension::kF16);
|
||||||
|
|
||||||
WrapInFunction(vec3<f16>());
|
WrapInFunction(vec3<f16>());
|
||||||
|
@ -160,7 +160,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_Empty_F16) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("f16vec3(0.0hf)"));
|
EXPECT_THAT(gen.result(), HasSubstr("f16vec3(0.0hf)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F32_Literal) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_F32_Literal) {
|
||||||
WrapInFunction(vec3<f32>(2_f));
|
WrapInFunction(vec3<f32>(2_f));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -169,7 +169,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("vec3(2.0f)"));
|
EXPECT_THAT(gen.result(), HasSubstr("vec3(2.0f)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F16_Literal) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_F16_Literal) {
|
||||||
Enable(builtin::Extension::kF16);
|
Enable(builtin::Extension::kF16);
|
||||||
|
|
||||||
WrapInFunction(vec3<f16>(2_h));
|
WrapInFunction(vec3<f16>(2_h));
|
||||||
|
@ -180,7 +180,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("f16vec3(2.0hf)"));
|
EXPECT_THAT(gen.result(), HasSubstr("f16vec3(2.0hf)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F32_Var) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_F32_Var) {
|
||||||
auto* var = Var("v", Expr(2_f));
|
auto* var = Var("v", Expr(2_f));
|
||||||
auto* cast = vec3<f32>(var);
|
auto* cast = vec3<f32>(var);
|
||||||
WrapInFunction(var, cast);
|
WrapInFunction(var, cast);
|
||||||
|
@ -192,7 +192,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_
|
||||||
vec3 tint_symbol = vec3(v);)"));
|
vec3 tint_symbol = vec3(v);)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F16_Var) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_F16_Var) {
|
||||||
Enable(builtin::Extension::kF16);
|
Enable(builtin::Extension::kF16);
|
||||||
|
|
||||||
auto* var = Var("v", Expr(2_h));
|
auto* var = Var("v", Expr(2_h));
|
||||||
|
@ -206,7 +206,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_
|
||||||
f16vec3 tint_symbol = f16vec3(v);)"));
|
f16vec3 tint_symbol = f16vec3(v);)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_Bool) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_Bool) {
|
||||||
WrapInFunction(vec3<bool>(true));
|
WrapInFunction(vec3<bool>(true));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -215,7 +215,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("bvec3(true)"));
|
EXPECT_THAT(gen.result(), HasSubstr("bvec3(true)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_Int) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_Int) {
|
||||||
WrapInFunction(vec3<i32>(2_i));
|
WrapInFunction(vec3<i32>(2_i));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -224,7 +224,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("ivec3(2)"));
|
EXPECT_THAT(gen.result(), HasSubstr("ivec3(2)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_UInt) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_UInt) {
|
||||||
WrapInFunction(vec3<u32>(2_u));
|
WrapInFunction(vec3<u32>(2_u));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -233,7 +233,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("uvec3(2u)"));
|
EXPECT_THAT(gen.result(), HasSubstr("uvec3(2u)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_F32) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Mat_F32) {
|
||||||
WrapInFunction(mat2x3<f32>(vec3<f32>(1_f, 2_f, 3_f), vec3<f32>(3_f, 4_f, 5_f)));
|
WrapInFunction(mat2x3<f32>(vec3<f32>(1_f, 2_f, 3_f), vec3<f32>(3_f, 4_f, 5_f)));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -243,7 +243,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_F32) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("mat2x3(vec3(1.0f, 2.0f, 3.0f), vec3(3.0f, 4.0f, 5.0f))"));
|
EXPECT_THAT(gen.result(), HasSubstr("mat2x3(vec3(1.0f, 2.0f, 3.0f), vec3(3.0f, 4.0f, 5.0f))"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_F16) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Mat_F16) {
|
||||||
Enable(builtin::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)));
|
||||||
|
@ -256,7 +256,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_F16) {
|
||||||
HasSubstr("f16mat2x3(f16vec3(1.0hf, 2.0hf, 3.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf))"));
|
HasSubstr("f16mat2x3(f16vec3(1.0hf, 2.0hf, 3.0hf), f16vec3(3.0hf, 4.0hf, 5.0hf))"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Complex_F32) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Mat_Complex_F32) {
|
||||||
// mat4x4<f32>(
|
// mat4x4<f32>(
|
||||||
// vec4<f32>(2.0f, 3.0f, 4.0f, 8.0f),
|
// vec4<f32>(2.0f, 3.0f, 4.0f, 8.0f),
|
||||||
// vec4<f32>(),
|
// vec4<f32>(),
|
||||||
|
@ -270,10 +270,10 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Complex_F32)
|
||||||
auto* vector_identical_init =
|
auto* vector_identical_init =
|
||||||
vec4<f32>(vec4<f32>(Expr(f32(42.0)), Expr(f32(21.0)), Expr(f32(6.0)), Expr(f32(-5.0))));
|
vec4<f32>(vec4<f32>(Expr(f32(42.0)), Expr(f32(21.0)), Expr(f32(6.0)), Expr(f32(-5.0))));
|
||||||
|
|
||||||
auto* initializer = mat4x4<f32>(vector_literal, vector_zero_init, vector_single_scalar_init,
|
auto* ctor = mat4x4<f32>(vector_literal, vector_zero_init, vector_single_scalar_init,
|
||||||
vector_identical_init);
|
vector_identical_init);
|
||||||
|
|
||||||
WrapInFunction(initializer);
|
WrapInFunction(ctor);
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
|
@ -283,7 +283,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Complex_F32)
|
||||||
"vec4(7.0f), vec4(42.0f, 21.0f, 6.0f, -5.0f))"));
|
"vec4(7.0f), vec4(42.0f, 21.0f, 6.0f, -5.0f))"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Complex_F16) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Mat_Complex_F16) {
|
||||||
// mat4x4<f16>(
|
// mat4x4<f16>(
|
||||||
// vec4<f16>(2.0h, 3.0h, 4.0h, 8.0h),
|
// vec4<f16>(2.0h, 3.0h, 4.0h, 8.0h),
|
||||||
// vec4<f16>(),
|
// vec4<f16>(),
|
||||||
|
@ -299,10 +299,10 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Complex_F16)
|
||||||
auto* vector_identical_init =
|
auto* vector_identical_init =
|
||||||
vec4<f16>(vec4<f16>(Expr(f16(42.0)), Expr(f16(21.0)), Expr(f16(6.0)), Expr(f16(-5.0))));
|
vec4<f16>(vec4<f16>(Expr(f16(42.0)), Expr(f16(21.0)), Expr(f16(6.0)), Expr(f16(-5.0))));
|
||||||
|
|
||||||
auto* initializer = mat4x4<f16>(vector_literal, vector_zero_init, vector_single_scalar_init,
|
auto* ctor = mat4x4<f16>(vector_literal, vector_zero_init, vector_single_scalar_init,
|
||||||
vector_identical_init);
|
vector_identical_init);
|
||||||
|
|
||||||
WrapInFunction(initializer);
|
WrapInFunction(ctor);
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Complex_F16)
|
||||||
"f16vec4(7.0hf), f16vec4(42.0hf, 21.0hf, 6.0hf, -5.0hf))"));
|
"f16vec4(7.0hf), f16vec4(42.0hf, 21.0hf, 6.0hf, -5.0hf))"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Empty_F32) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Mat_Empty_F32) {
|
||||||
WrapInFunction(mat2x3<f32>());
|
WrapInFunction(mat2x3<f32>());
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -323,7 +323,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Empty_F32) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("mat2x3 tint_symbol = mat2x3(vec3(0.0f), vec3(0.0f))"));
|
EXPECT_THAT(gen.result(), HasSubstr("mat2x3 tint_symbol = mat2x3(vec3(0.0f), vec3(0.0f))"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Empty_F16) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Mat_Empty_F16) {
|
||||||
Enable(builtin::Extension::kF16);
|
Enable(builtin::Extension::kF16);
|
||||||
|
|
||||||
WrapInFunction(mat2x3<f16>());
|
WrapInFunction(mat2x3<f16>());
|
||||||
|
@ -336,7 +336,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Empty_F16) {
|
||||||
HasSubstr("f16mat2x3 tint_symbol = f16mat2x3(f16vec3(0.0hf), f16vec3(0.0hf))"));
|
HasSubstr("f16mat2x3 tint_symbol = f16mat2x3(f16vec3(0.0hf), f16vec3(0.0hf))"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Identity_F32) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Mat_Identity_F32) {
|
||||||
// fn f() {
|
// fn f() {
|
||||||
// var m_1: mat4x4<f32> = mat4x4<f32>();
|
// var m_1: mat4x4<f32> = mat4x4<f32>();
|
||||||
// var m_2: mat4x4<f32> = mat4x4<f32>(m_1);
|
// var m_2: mat4x4<f32> = mat4x4<f32>(m_1);
|
||||||
|
@ -354,7 +354,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Identity_F32)
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("mat4 m_2 = mat4(m_1);"));
|
EXPECT_THAT(gen.result(), HasSubstr("mat4 m_2 = mat4(m_1);"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Identity_F16) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Mat_Identity_F16) {
|
||||||
// fn f() {
|
// fn f() {
|
||||||
// var m_1: mat4x4<f16> = mat4x4<f16>();
|
// var m_1: mat4x4<f16> = mat4x4<f16>();
|
||||||
// var m_2: mat4x4<f16> = mat4x4<f16>(m_1);
|
// var m_2: mat4x4<f16> = mat4x4<f16>(m_1);
|
||||||
|
@ -374,7 +374,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Identity_F16)
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("f16mat4 m_2 = f16mat4(m_1);"));
|
EXPECT_THAT(gen.result(), HasSubstr("f16mat4 m_2 = f16mat4(m_1);"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Array) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Array) {
|
||||||
WrapInFunction(Call(ty.array(ty.vec3<f32>(), 3_u), vec3<f32>(1_f, 2_f, 3_f),
|
WrapInFunction(Call(ty.array(ty.vec3<f32>(), 3_u), vec3<f32>(1_f, 2_f, 3_f),
|
||||||
vec3<f32>(4_f, 5_f, 6_f), vec3<f32>(7_f, 8_f, 9_f)));
|
vec3<f32>(4_f, 5_f, 6_f), vec3<f32>(7_f, 8_f, 9_f)));
|
||||||
|
|
||||||
|
@ -386,7 +386,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Array) {
|
||||||
"vec3(7.0f, 8.0f, 9.0f))"));
|
"vec3(7.0f, 8.0f, 9.0f))"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Array_Empty) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Array_Empty) {
|
||||||
WrapInFunction(Call(ty.array(ty.vec3<f32>(), 3_u)));
|
WrapInFunction(Call(ty.array(ty.vec3<f32>(), 3_u)));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -395,7 +395,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Array_Empty) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("vec3[3](vec3(0.0f), vec3(0.0f), vec3(0.0f))"));
|
EXPECT_THAT(gen.result(), HasSubstr("vec3[3](vec3(0.0f), vec3(0.0f), vec3(0.0f))"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Struct) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Struct) {
|
||||||
auto* str = Structure("S", utils::Vector{
|
auto* str = Structure("S", utils::Vector{
|
||||||
Member("a", ty.i32()),
|
Member("a", ty.i32()),
|
||||||
Member("b", ty.f32()),
|
Member("b", ty.f32()),
|
||||||
|
@ -410,7 +410,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Struct) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("S(1, 2.0f, ivec3(3, 4, 5))"));
|
EXPECT_THAT(gen.result(), HasSubstr("S(1, 2.0f, ivec3(3, 4, 5))"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Struct_Empty) {
|
TEST_F(GlslGeneratorImplTest_Constructor, Type_Struct_Empty) {
|
||||||
auto* str = Structure("S", utils::Vector{
|
auto* str = Structure("S", utils::Vector{
|
||||||
Member("a", ty.i32()),
|
Member("a", ty.i32()),
|
||||||
Member("b", ty.f32()),
|
Member("b", ty.f32()),
|
|
@ -37,8 +37,8 @@
|
||||||
#include "src/tint/sem/statement.h"
|
#include "src/tint/sem/statement.h"
|
||||||
#include "src/tint/sem/struct.h"
|
#include "src/tint/sem/struct.h"
|
||||||
#include "src/tint/sem/switch_statement.h"
|
#include "src/tint/sem/switch_statement.h"
|
||||||
#include "src/tint/sem/type_conversion.h"
|
#include "src/tint/sem/value_constructor.h"
|
||||||
#include "src/tint/sem/type_initializer.h"
|
#include "src/tint/sem/value_conversion.h"
|
||||||
#include "src/tint/sem/variable.h"
|
#include "src/tint/sem/variable.h"
|
||||||
#include "src/tint/transform/add_empty_entry_point.h"
|
#include "src/tint/transform/add_empty_entry_point.h"
|
||||||
#include "src/tint/transform/array_length_from_uniform.h"
|
#include "src/tint/transform/array_length_from_uniform.h"
|
||||||
|
@ -876,10 +876,11 @@ bool GeneratorImpl::EmitCall(std::ostream& out, const ast::CallExpression* expr)
|
||||||
auto* call = builder_.Sem().Get<sem::Call>(expr);
|
auto* call = builder_.Sem().Get<sem::Call>(expr);
|
||||||
auto* target = call->Target();
|
auto* target = call->Target();
|
||||||
return Switch(
|
return Switch(
|
||||||
target, [&](const sem::Function* func) { return EmitFunctionCall(out, call, func); },
|
target, //
|
||||||
|
[&](const sem::Function* func) { return EmitFunctionCall(out, call, func); },
|
||||||
[&](const sem::Builtin* builtin) { return EmitBuiltinCall(out, call, builtin); },
|
[&](const sem::Builtin* builtin) { return EmitBuiltinCall(out, call, builtin); },
|
||||||
[&](const sem::TypeConversion* conv) { return EmitTypeConversion(out, call, conv); },
|
[&](const sem::ValueConversion* conv) { return EmitValueConversion(out, call, conv); },
|
||||||
[&](const sem::TypeInitializer* ctor) { return EmitTypeInitializer(out, call, ctor); },
|
[&](const sem::ValueConstructor* ctor) { return EmitValueConstructor(out, call, ctor); },
|
||||||
[&](Default) {
|
[&](Default) {
|
||||||
TINT_ICE(Writer, diagnostics_) << "unhandled call target: " << target->TypeInfo().name;
|
TINT_ICE(Writer, diagnostics_) << "unhandled call target: " << target->TypeInfo().name;
|
||||||
return false;
|
return false;
|
||||||
|
@ -1027,9 +1028,9 @@ bool GeneratorImpl::EmitBuiltinCall(std::ostream& out,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GeneratorImpl::EmitTypeConversion(std::ostream& out,
|
bool GeneratorImpl::EmitValueConversion(std::ostream& out,
|
||||||
const sem::Call* call,
|
const sem::Call* call,
|
||||||
const sem::TypeConversion* conv) {
|
const sem::ValueConversion* conv) {
|
||||||
if (!EmitType(out, conv->Target(), builtin::AddressSpace::kUndefined,
|
if (!EmitType(out, conv->Target(), builtin::AddressSpace::kUndefined,
|
||||||
builtin::Access::kReadWrite, "")) {
|
builtin::Access::kReadWrite, "")) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1044,13 +1045,13 @@ bool GeneratorImpl::EmitTypeConversion(std::ostream& out,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GeneratorImpl::EmitTypeInitializer(std::ostream& out,
|
bool GeneratorImpl::EmitValueConstructor(std::ostream& out,
|
||||||
const sem::Call* call,
|
const sem::Call* call,
|
||||||
const sem::TypeInitializer* ctor) {
|
const sem::ValueConstructor* ctor) {
|
||||||
auto* type = call->Type();
|
auto* type = call->Type();
|
||||||
|
|
||||||
// If the type initializer is empty then we need to construct with the zero
|
// If the value constructor arguments are empty then we need to construct with the zero value
|
||||||
// value for all components.
|
// for all components.
|
||||||
if (call->Arguments().IsEmpty()) {
|
if (call->Arguments().IsEmpty()) {
|
||||||
return EmitZeroValue(out, type);
|
return EmitZeroValue(out, type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,10 +43,10 @@
|
||||||
|
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
namespace tint::sem {
|
namespace tint::sem {
|
||||||
class Call;
|
|
||||||
class Builtin;
|
class Builtin;
|
||||||
class TypeInitializer;
|
class Call;
|
||||||
class TypeConversion;
|
class ValueConstructor;
|
||||||
|
class ValueConversion;
|
||||||
} // namespace tint::sem
|
} // namespace tint::sem
|
||||||
|
|
||||||
namespace tint::writer::hlsl {
|
namespace tint::writer::hlsl {
|
||||||
|
@ -140,22 +140,22 @@ class GeneratorImpl : public TextGenerator {
|
||||||
/// @param builtin the builtin being called
|
/// @param builtin the builtin being called
|
||||||
/// @returns true if the expression is emitted
|
/// @returns true if the expression is emitted
|
||||||
bool EmitBuiltinCall(std::ostream& out, const sem::Call* call, const sem::Builtin* builtin);
|
bool EmitBuiltinCall(std::ostream& out, const sem::Call* call, const sem::Builtin* builtin);
|
||||||
/// Handles generating a type conversion expression
|
/// Handles generating a value conversion expression
|
||||||
/// @param out the output of the expression stream
|
/// @param out the output of the expression stream
|
||||||
/// @param call the call expression
|
/// @param call the call expression
|
||||||
/// @param conv the type conversion
|
/// @param conv the value conversion
|
||||||
/// @returns true if the expression is emitted
|
/// @returns true if the expression is emitted
|
||||||
bool EmitTypeConversion(std::ostream& out,
|
bool EmitValueConversion(std::ostream& out,
|
||||||
const sem::Call* call,
|
|
||||||
const sem::TypeConversion* conv);
|
|
||||||
/// Handles generating a type initializer expression
|
|
||||||
/// @param out the output of the expression stream
|
|
||||||
/// @param call the call expression
|
|
||||||
/// @param ctor the type initializer
|
|
||||||
/// @returns true if the expression is emitted
|
|
||||||
bool EmitTypeInitializer(std::ostream& out,
|
|
||||||
const sem::Call* call,
|
const sem::Call* call,
|
||||||
const sem::TypeInitializer* ctor);
|
const sem::ValueConversion* conv);
|
||||||
|
/// Handles generating a value constructor expression
|
||||||
|
/// @param out the output of the expression stream
|
||||||
|
/// @param call the call expression
|
||||||
|
/// @param ctor the value constructor
|
||||||
|
/// @returns true if the expression is emitted
|
||||||
|
bool EmitValueConstructor(std::ostream& out,
|
||||||
|
const sem::Call* call,
|
||||||
|
const sem::ValueConstructor* ctor);
|
||||||
/// Handles generating a call expression to a
|
/// Handles generating a call expression to a
|
||||||
/// transform::DecomposeMemoryAccess::Intrinsic for a uniform buffer
|
/// transform::DecomposeMemoryAccess::Intrinsic for a uniform buffer
|
||||||
/// @param out the output of the expression stream
|
/// @param out the output of the expression stream
|
||||||
|
|
|
@ -22,9 +22,9 @@ namespace {
|
||||||
|
|
||||||
using ::testing::HasSubstr;
|
using ::testing::HasSubstr;
|
||||||
|
|
||||||
using HlslGeneratorImplTest_Initializer = TestHelper;
|
using HlslGeneratorImplTest_Constructor = TestHelper;
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Bool) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Bool) {
|
||||||
WrapInFunction(Expr(false));
|
WrapInFunction(Expr(false));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -33,7 +33,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Bool) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("false"));
|
EXPECT_THAT(gen.result(), HasSubstr("false"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Int) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Int) {
|
||||||
WrapInFunction(Expr(-12345_i));
|
WrapInFunction(Expr(-12345_i));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -42,7 +42,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Int) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("-12345"));
|
EXPECT_THAT(gen.result(), HasSubstr("-12345"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_UInt) {
|
TEST_F(HlslGeneratorImplTest_Constructor, UInt) {
|
||||||
WrapInFunction(Expr(56779_u));
|
WrapInFunction(Expr(56779_u));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -51,7 +51,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_UInt) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("56779u"));
|
EXPECT_THAT(gen.result(), HasSubstr("56779u"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Float) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Float) {
|
||||||
// Use a number close to 1<<30 but whose decimal representation ends in 0.
|
// Use a number close to 1<<30 but whose decimal representation ends in 0.
|
||||||
WrapInFunction(Expr(f32((1 << 30) - 4)));
|
WrapInFunction(Expr(f32((1 << 30) - 4)));
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Float) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("1073741824.0f"));
|
EXPECT_THAT(gen.result(), HasSubstr("1073741824.0f"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_F16) {
|
TEST_F(HlslGeneratorImplTest_Constructor, F16) {
|
||||||
Enable(builtin::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.
|
||||||
|
@ -73,7 +73,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_F16) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("float16_t(32752.0h)"));
|
EXPECT_THAT(gen.result(), HasSubstr("float16_t(32752.0h)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Float) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Float) {
|
||||||
WrapInFunction(Call<f32>(-1.2e-5_f));
|
WrapInFunction(Call<f32>(-1.2e-5_f));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -82,7 +82,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Float) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("-0.000012f"));
|
EXPECT_THAT(gen.result(), HasSubstr("-0.000012f"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_F16) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_F16) {
|
||||||
Enable(builtin::Extension::kF16);
|
Enable(builtin::Extension::kF16);
|
||||||
|
|
||||||
WrapInFunction(Call<f16>(-1.2e-3_h));
|
WrapInFunction(Call<f16>(-1.2e-3_h));
|
||||||
|
@ -93,7 +93,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_F16) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("float16_t(-0.00119972229h)"));
|
EXPECT_THAT(gen.result(), HasSubstr("float16_t(-0.00119972229h)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Bool) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Bool) {
|
||||||
WrapInFunction(Call<bool>(true));
|
WrapInFunction(Call<bool>(true));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -102,7 +102,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Bool) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("true"));
|
EXPECT_THAT(gen.result(), HasSubstr("true"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Int) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Int) {
|
||||||
WrapInFunction(Call<i32>(-12345_i));
|
WrapInFunction(Call<i32>(-12345_i));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -111,7 +111,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Int) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("-12345"));
|
EXPECT_THAT(gen.result(), HasSubstr("-12345"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Uint) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Uint) {
|
||||||
WrapInFunction(Call<u32>(12345_u));
|
WrapInFunction(Call<u32>(12345_u));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -120,7 +120,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Uint) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("12345u"));
|
EXPECT_THAT(gen.result(), HasSubstr("12345u"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_F32) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Vec_F32) {
|
||||||
WrapInFunction(vec3<f32>(1_f, 2_f, 3_f));
|
WrapInFunction(vec3<f32>(1_f, 2_f, 3_f));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -129,7 +129,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_F32) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("float3(1.0f, 2.0f, 3.0f)"));
|
EXPECT_THAT(gen.result(), HasSubstr("float3(1.0f, 2.0f, 3.0f)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_F16) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Vec_F16) {
|
||||||
Enable(builtin::Extension::kF16);
|
Enable(builtin::Extension::kF16);
|
||||||
|
|
||||||
WrapInFunction(vec3<f16>(1_h, 2_h, 3_h));
|
WrapInFunction(vec3<f16>(1_h, 2_h, 3_h));
|
||||||
|
@ -142,7 +142,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_F16) {
|
||||||
HasSubstr("vector<float16_t, 3>(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h))"));
|
HasSubstr("vector<float16_t, 3>(float16_t(1.0h), float16_t(2.0h), float16_t(3.0h))"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_Empty_F32) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Vec_Empty_F32) {
|
||||||
WrapInFunction(vec3<f32>());
|
WrapInFunction(vec3<f32>());
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -151,7 +151,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_Empty_F32) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("0.0f).xxx"));
|
EXPECT_THAT(gen.result(), HasSubstr("0.0f).xxx"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_Empty_F16) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Vec_Empty_F16) {
|
||||||
Enable(builtin::Extension::kF16);
|
Enable(builtin::Extension::kF16);
|
||||||
|
|
||||||
WrapInFunction(vec3<f16>());
|
WrapInFunction(vec3<f16>());
|
||||||
|
@ -162,7 +162,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_Empty_F16) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("(float16_t(0.0h)).xxx"));
|
EXPECT_THAT(gen.result(), HasSubstr("(float16_t(0.0h)).xxx"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F32_Literal) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_F32_Literal) {
|
||||||
WrapInFunction(vec3<f32>(2_f));
|
WrapInFunction(vec3<f32>(2_f));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -171,7 +171,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("2.0f).xxx"));
|
EXPECT_THAT(gen.result(), HasSubstr("2.0f).xxx"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F16_Literal) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_F16_Literal) {
|
||||||
Enable(builtin::Extension::kF16);
|
Enable(builtin::Extension::kF16);
|
||||||
|
|
||||||
WrapInFunction(vec3<f16>(2_h));
|
WrapInFunction(vec3<f16>(2_h));
|
||||||
|
@ -182,7 +182,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("(float16_t(2.0h)).xxx"));
|
EXPECT_THAT(gen.result(), HasSubstr("(float16_t(2.0h)).xxx"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F32_Var) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_F32_Var) {
|
||||||
auto* var = Var("v", Expr(2_f));
|
auto* var = Var("v", Expr(2_f));
|
||||||
auto* cast = vec3<f32>(var);
|
auto* cast = vec3<f32>(var);
|
||||||
WrapInFunction(var, cast);
|
WrapInFunction(var, cast);
|
||||||
|
@ -194,7 +194,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_
|
||||||
const float3 tint_symbol = float3((v).xxx);)"));
|
const float3 tint_symbol = float3((v).xxx);)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F16_Var) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_F16_Var) {
|
||||||
Enable(builtin::Extension::kF16);
|
Enable(builtin::Extension::kF16);
|
||||||
|
|
||||||
auto* var = Var("v", Expr(2_h));
|
auto* var = Var("v", Expr(2_h));
|
||||||
|
@ -208,7 +208,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_
|
||||||
const vector<float16_t, 3> tint_symbol = vector<float16_t, 3>((v).xxx);)"));
|
const vector<float16_t, 3> tint_symbol = vector<float16_t, 3>((v).xxx);)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_Bool_Literal) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_Bool_Literal) {
|
||||||
WrapInFunction(vec3<bool>(true));
|
WrapInFunction(vec3<bool>(true));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -217,7 +217,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("(true).xxx"));
|
EXPECT_THAT(gen.result(), HasSubstr("(true).xxx"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_Bool_Var) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_Bool_Var) {
|
||||||
auto* var = Var("v", Expr(true));
|
auto* var = Var("v", Expr(true));
|
||||||
auto* cast = vec3<bool>(var);
|
auto* cast = vec3<bool>(var);
|
||||||
WrapInFunction(var, cast);
|
WrapInFunction(var, cast);
|
||||||
|
@ -229,7 +229,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_
|
||||||
const bool3 tint_symbol = bool3((v).xxx);)"));
|
const bool3 tint_symbol = bool3((v).xxx);)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_Int) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_Int) {
|
||||||
WrapInFunction(vec3<i32>(2_i));
|
WrapInFunction(vec3<i32>(2_i));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -238,7 +238,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("2).xxx"));
|
EXPECT_THAT(gen.result(), HasSubstr("2).xxx"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_UInt) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_UInt) {
|
||||||
WrapInFunction(vec3<u32>(2_u));
|
WrapInFunction(vec3<u32>(2_u));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -247,7 +247,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("2u).xxx"));
|
EXPECT_THAT(gen.result(), HasSubstr("2u).xxx"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_F32) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Mat_F32) {
|
||||||
WrapInFunction(mat2x3<f32>(vec3<f32>(1_f, 2_f, 3_f), vec3<f32>(3_f, 4_f, 5_f)));
|
WrapInFunction(mat2x3<f32>(vec3<f32>(1_f, 2_f, 3_f), vec3<f32>(3_f, 4_f, 5_f)));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -258,7 +258,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_F32) {
|
||||||
HasSubstr("float2x3(float3(1.0f, 2.0f, 3.0f), float3(3.0f, 4.0f, 5.0f))"));
|
HasSubstr("float2x3(float3(1.0f, 2.0f, 3.0f), float3(3.0f, 4.0f, 5.0f))"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_F16) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Mat_F16) {
|
||||||
Enable(builtin::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)));
|
||||||
|
@ -273,7 +273,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_F16) {
|
||||||
"3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)))"));
|
"3>(float16_t(3.0h), float16_t(4.0h), float16_t(5.0h)))"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Complex_F32) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Mat_Complex_F32) {
|
||||||
// mat4x4<f32>(
|
// mat4x4<f32>(
|
||||||
// vec4<f32>(2.0f, 3.0f, 4.0f, 8.0f),
|
// vec4<f32>(2.0f, 3.0f, 4.0f, 8.0f),
|
||||||
// vec4<f32>(),
|
// vec4<f32>(),
|
||||||
|
@ -287,10 +287,10 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Complex_F32)
|
||||||
auto* vector_identical_init =
|
auto* vector_identical_init =
|
||||||
vec4<f32>(vec4<f32>(Expr(f32(42.0)), Expr(f32(21.0)), Expr(f32(6.0)), Expr(f32(-5.0))));
|
vec4<f32>(vec4<f32>(Expr(f32(42.0)), Expr(f32(21.0)), Expr(f32(6.0)), Expr(f32(-5.0))));
|
||||||
|
|
||||||
auto* initializer = mat4x4<f32>(vector_literal, vector_zero_init, vector_single_scalar_init,
|
auto* constructor = mat4x4<f32>(vector_literal, vector_zero_init, vector_single_scalar_init,
|
||||||
vector_identical_init);
|
vector_identical_init);
|
||||||
|
|
||||||
WrapInFunction(initializer);
|
WrapInFunction(constructor);
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
|
@ -300,7 +300,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Complex_F32)
|
||||||
"(7.0f).xxxx, float4(42.0f, 21.0f, 6.0f, -5.0f))"));
|
"(7.0f).xxxx, float4(42.0f, 21.0f, 6.0f, -5.0f))"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Complex_F16) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Mat_Complex_F16) {
|
||||||
// mat4x4<f16>(
|
// mat4x4<f16>(
|
||||||
// vec4<f16>(2.0h, 3.0h, 4.0h, 8.0h),
|
// vec4<f16>(2.0h, 3.0h, 4.0h, 8.0h),
|
||||||
// vec4<f16>(),
|
// vec4<f16>(),
|
||||||
|
@ -316,10 +316,10 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Complex_F16)
|
||||||
auto* vector_identical_init =
|
auto* vector_identical_init =
|
||||||
vec4<f16>(vec4<f16>(Expr(f16(42.0)), Expr(f16(21.0)), Expr(f16(6.0)), Expr(f16(-5.0))));
|
vec4<f16>(vec4<f16>(Expr(f16(42.0)), Expr(f16(21.0)), Expr(f16(6.0)), Expr(f16(-5.0))));
|
||||||
|
|
||||||
auto* initializer = mat4x4<f16>(vector_literal, vector_zero_init, vector_single_scalar_init,
|
auto* constructor = mat4x4<f16>(vector_literal, vector_zero_init, vector_single_scalar_init,
|
||||||
vector_identical_init);
|
vector_identical_init);
|
||||||
|
|
||||||
WrapInFunction(initializer);
|
WrapInFunction(constructor);
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Complex_F16)
|
||||||
"float16_t(6.0h), float16_t(-5.0h)))"));
|
"float16_t(6.0h), float16_t(-5.0h)))"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Empty_F32) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Mat_Empty_F32) {
|
||||||
WrapInFunction(mat2x3<f32>());
|
WrapInFunction(mat2x3<f32>());
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -343,7 +343,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Empty_F32) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("float2x3 tint_symbol = float2x3((0.0f).xxx, (0.0f).xxx)"));
|
EXPECT_THAT(gen.result(), HasSubstr("float2x3 tint_symbol = float2x3((0.0f).xxx, (0.0f).xxx)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Empty_F16) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Mat_Empty_F16) {
|
||||||
Enable(builtin::Extension::kF16);
|
Enable(builtin::Extension::kF16);
|
||||||
|
|
||||||
WrapInFunction(mat2x3<f16>());
|
WrapInFunction(mat2x3<f16>());
|
||||||
|
@ -356,7 +356,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Empty_F16) {
|
||||||
HasSubstr("matrix<float16_t, 2, 3>((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx)"));
|
HasSubstr("matrix<float16_t, 2, 3>((float16_t(0.0h)).xxx, (float16_t(0.0h)).xxx)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Identity_F32) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Mat_Identity_F32) {
|
||||||
// fn f() {
|
// fn f() {
|
||||||
// var m_1: mat4x4<f32> = mat4x4<f32>();
|
// var m_1: mat4x4<f32> = mat4x4<f32>();
|
||||||
// var m_2: mat4x4<f32> = mat4x4<f32>(m_1);
|
// var m_2: mat4x4<f32> = mat4x4<f32>(m_1);
|
||||||
|
@ -374,7 +374,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Identity_F32)
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("float4x4 m_2 = float4x4(m_1);"));
|
EXPECT_THAT(gen.result(), HasSubstr("float4x4 m_2 = float4x4(m_1);"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Identity_F16) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Mat_Identity_F16) {
|
||||||
// fn f() {
|
// fn f() {
|
||||||
// var m_1: mat4x4<f16> = mat4x4<f16>();
|
// var m_1: mat4x4<f16> = mat4x4<f16>();
|
||||||
// var m_2: mat4x4<f16> = mat4x4<f16>(m_1);
|
// var m_2: mat4x4<f16> = mat4x4<f16>(m_1);
|
||||||
|
@ -395,7 +395,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Identity_F16)
|
||||||
HasSubstr("matrix<float16_t, 4, 4> m_2 = matrix<float16_t, 4, 4>(m_1);"));
|
HasSubstr("matrix<float16_t, 4, 4> m_2 = matrix<float16_t, 4, 4>(m_1);"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Array) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Array) {
|
||||||
WrapInFunction(Call(ty.array(ty.vec3<f32>(), 3_u), vec3<f32>(1_f, 2_f, 3_f),
|
WrapInFunction(Call(ty.array(ty.vec3<f32>(), 3_u), vec3<f32>(1_f, 2_f, 3_f),
|
||||||
vec3<f32>(4_f, 5_f, 6_f), vec3<f32>(7_f, 8_f, 9_f)));
|
vec3<f32>(4_f, 5_f, 6_f), vec3<f32>(7_f, 8_f, 9_f)));
|
||||||
|
|
||||||
|
@ -406,7 +406,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Array) {
|
||||||
" float3(7.0f, 8.0f, 9.0f)}"));
|
" float3(7.0f, 8.0f, 9.0f)}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Array_Empty) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Array_Empty) {
|
||||||
WrapInFunction(Call(ty.array(ty.vec3<f32>(), 3_u)));
|
WrapInFunction(Call(ty.array(ty.vec3<f32>(), 3_u)));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -415,7 +415,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Array_Empty) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("(float3[3])0"));
|
EXPECT_THAT(gen.result(), HasSubstr("(float3[3])0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Struct) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Struct) {
|
||||||
auto* str = Structure("S", utils::Vector{
|
auto* str = Structure("S", utils::Vector{
|
||||||
Member("a", ty.i32()),
|
Member("a", ty.i32()),
|
||||||
Member("b", ty.f32()),
|
Member("b", ty.f32()),
|
||||||
|
@ -430,7 +430,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Struct) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("{1, 2.0f, int3(3, 4, 5)}"));
|
EXPECT_THAT(gen.result(), HasSubstr("{1, 2.0f, int3(3, 4, 5)}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Struct_Empty) {
|
TEST_F(HlslGeneratorImplTest_Constructor, Type_Struct_Empty) {
|
||||||
auto* str = Structure("S", utils::Vector{
|
auto* str = Structure("S", utils::Vector{
|
||||||
Member("a", ty.i32()),
|
Member("a", ty.i32()),
|
||||||
Member("b", ty.f32()),
|
Member("b", ty.f32()),
|
|
@ -37,8 +37,8 @@
|
||||||
#include "src/tint/sem/module.h"
|
#include "src/tint/sem/module.h"
|
||||||
#include "src/tint/sem/struct.h"
|
#include "src/tint/sem/struct.h"
|
||||||
#include "src/tint/sem/switch_statement.h"
|
#include "src/tint/sem/switch_statement.h"
|
||||||
#include "src/tint/sem/type_conversion.h"
|
#include "src/tint/sem/value_constructor.h"
|
||||||
#include "src/tint/sem/type_initializer.h"
|
#include "src/tint/sem/value_conversion.h"
|
||||||
#include "src/tint/sem/variable.h"
|
#include "src/tint/sem/variable.h"
|
||||||
#include "src/tint/transform/array_length_from_uniform.h"
|
#include "src/tint/transform/array_length_from_uniform.h"
|
||||||
#include "src/tint/transform/builtin_polyfill.h"
|
#include "src/tint/transform/builtin_polyfill.h"
|
||||||
|
@ -640,8 +640,8 @@ bool GeneratorImpl::EmitCall(std::ostream& out, const ast::CallExpression* expr)
|
||||||
return Switch(
|
return Switch(
|
||||||
target, [&](const sem::Function* func) { return EmitFunctionCall(out, call, func); },
|
target, [&](const sem::Function* func) { return EmitFunctionCall(out, call, func); },
|
||||||
[&](const sem::Builtin* builtin) { return EmitBuiltinCall(out, call, builtin); },
|
[&](const sem::Builtin* builtin) { return EmitBuiltinCall(out, call, builtin); },
|
||||||
[&](const sem::TypeConversion* conv) { return EmitTypeConversion(out, call, conv); },
|
[&](const sem::ValueConversion* conv) { return EmitTypeConversion(out, call, conv); },
|
||||||
[&](const sem::TypeInitializer* ctor) { return EmitTypeInitializer(out, call, ctor); },
|
[&](const sem::ValueConstructor* ctor) { return EmitTypeInitializer(out, call, ctor); },
|
||||||
[&](Default) {
|
[&](Default) {
|
||||||
TINT_ICE(Writer, diagnostics_) << "unhandled call target: " << target->TypeInfo().name;
|
TINT_ICE(Writer, diagnostics_) << "unhandled call target: " << target->TypeInfo().name;
|
||||||
return false;
|
return false;
|
||||||
|
@ -785,7 +785,7 @@ bool GeneratorImpl::EmitBuiltinCall(std::ostream& out,
|
||||||
|
|
||||||
bool GeneratorImpl::EmitTypeConversion(std::ostream& out,
|
bool GeneratorImpl::EmitTypeConversion(std::ostream& out,
|
||||||
const sem::Call* call,
|
const sem::Call* call,
|
||||||
const sem::TypeConversion* conv) {
|
const sem::ValueConversion* conv) {
|
||||||
if (!EmitType(out, conv->Target(), "")) {
|
if (!EmitType(out, conv->Target(), "")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -801,7 +801,7 @@ bool GeneratorImpl::EmitTypeConversion(std::ostream& out,
|
||||||
|
|
||||||
bool GeneratorImpl::EmitTypeInitializer(std::ostream& out,
|
bool GeneratorImpl::EmitTypeInitializer(std::ostream& out,
|
||||||
const sem::Call* call,
|
const sem::Call* call,
|
||||||
const sem::TypeInitializer* ctor) {
|
const sem::ValueConstructor* ctor) {
|
||||||
auto* type = ctor->ReturnType();
|
auto* type = ctor->ReturnType();
|
||||||
|
|
||||||
const char* terminator = ")";
|
const char* terminator = ")";
|
||||||
|
|
|
@ -46,10 +46,10 @@
|
||||||
|
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
namespace tint::sem {
|
namespace tint::sem {
|
||||||
class Call;
|
|
||||||
class Builtin;
|
class Builtin;
|
||||||
class TypeInitializer;
|
class Call;
|
||||||
class TypeConversion;
|
class ValueConstructor;
|
||||||
|
class ValueConversion;
|
||||||
} // namespace tint::sem
|
} // namespace tint::sem
|
||||||
|
|
||||||
namespace tint::writer::msl {
|
namespace tint::writer::msl {
|
||||||
|
@ -144,22 +144,22 @@ class GeneratorImpl : public TextGenerator {
|
||||||
/// @param builtin the builtin being called
|
/// @param builtin the builtin being called
|
||||||
/// @returns true if the call expression is emitted
|
/// @returns true if the call expression is emitted
|
||||||
bool EmitBuiltinCall(std::ostream& out, const sem::Call* call, const sem::Builtin* builtin);
|
bool EmitBuiltinCall(std::ostream& out, const sem::Call* call, const sem::Builtin* builtin);
|
||||||
/// Handles generating a type conversion expression
|
/// Handles generating a value conversion expression
|
||||||
/// @param out the output of the expression stream
|
/// @param out the output of the expression stream
|
||||||
/// @param call the call expression
|
/// @param call the call expression
|
||||||
/// @param conv the type conversion
|
/// @param conv the value conversion
|
||||||
/// @returns true if the expression is emitted
|
/// @returns true if the expression is emitted
|
||||||
bool EmitTypeConversion(std::ostream& out,
|
bool EmitTypeConversion(std::ostream& out,
|
||||||
const sem::Call* call,
|
const sem::Call* call,
|
||||||
const sem::TypeConversion* conv);
|
const sem::ValueConversion* conv);
|
||||||
/// Handles generating a type initializer
|
/// Handles generating a value constructor
|
||||||
/// @param out the output of the expression stream
|
/// @param out the output of the expression stream
|
||||||
/// @param call the call expression
|
/// @param call the call expression
|
||||||
/// @param ctor the type initializer
|
/// @param ctor the value constructor
|
||||||
/// @returns true if the initializer is emitted
|
/// @returns true if the initializer is emitted
|
||||||
bool EmitTypeInitializer(std::ostream& out,
|
bool EmitTypeInitializer(std::ostream& out,
|
||||||
const sem::Call* call,
|
const sem::Call* call,
|
||||||
const sem::TypeInitializer* ctor);
|
const sem::ValueConstructor* ctor);
|
||||||
/// Handles generating a function call
|
/// Handles generating a function call
|
||||||
/// @param out the output of the expression stream
|
/// @param out the output of the expression stream
|
||||||
/// @param call the call expression
|
/// @param call the call expression
|
||||||
|
|
|
@ -22,9 +22,9 @@ namespace {
|
||||||
|
|
||||||
using ::testing::HasSubstr;
|
using ::testing::HasSubstr;
|
||||||
|
|
||||||
using MslGeneratorImplTest = TestHelper;
|
using MslGeneratorImplTest_Constructor = TestHelper;
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Bool) {
|
TEST_F(MslGeneratorImplTest_Constructor, Bool) {
|
||||||
WrapInFunction(Expr(false));
|
WrapInFunction(Expr(false));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -33,7 +33,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Bool) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("false"));
|
EXPECT_THAT(gen.result(), HasSubstr("false"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Int) {
|
TEST_F(MslGeneratorImplTest_Constructor, Int) {
|
||||||
WrapInFunction(Expr(-12345_i));
|
WrapInFunction(Expr(-12345_i));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -42,7 +42,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Int) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("-12345"));
|
EXPECT_THAT(gen.result(), HasSubstr("-12345"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_UInt) {
|
TEST_F(MslGeneratorImplTest_Constructor, UInt) {
|
||||||
WrapInFunction(Expr(56779_u));
|
WrapInFunction(Expr(56779_u));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -51,7 +51,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_UInt) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("56779u"));
|
EXPECT_THAT(gen.result(), HasSubstr("56779u"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Float) {
|
TEST_F(MslGeneratorImplTest_Constructor, Float) {
|
||||||
// Use a number close to 1<<30 but whose decimal representation ends in 0.
|
// Use a number close to 1<<30 but whose decimal representation ends in 0.
|
||||||
WrapInFunction(Expr(f32((1 << 30) - 4)));
|
WrapInFunction(Expr(f32((1 << 30) - 4)));
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Float) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("1073741824.0f"));
|
EXPECT_THAT(gen.result(), HasSubstr("1073741824.0f"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_F16) {
|
TEST_F(MslGeneratorImplTest_Constructor, F16) {
|
||||||
Enable(builtin::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.
|
||||||
|
@ -73,7 +73,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_F16) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("32752.0h"));
|
EXPECT_THAT(gen.result(), HasSubstr("32752.0h"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Float) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_Float) {
|
||||||
WrapInFunction(Call<f32>(-1.2e-5_f));
|
WrapInFunction(Call<f32>(-1.2e-5_f));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -82,7 +82,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Float) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("-0.000012f"));
|
EXPECT_THAT(gen.result(), HasSubstr("-0.000012f"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_F16) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_F16) {
|
||||||
Enable(builtin::Extension::kF16);
|
Enable(builtin::Extension::kF16);
|
||||||
|
|
||||||
WrapInFunction(Call<f16>(-1.2e-3_h));
|
WrapInFunction(Call<f16>(-1.2e-3_h));
|
||||||
|
@ -93,7 +93,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_F16) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("-0.00119972229h"));
|
EXPECT_THAT(gen.result(), HasSubstr("-0.00119972229h"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Bool) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_Bool) {
|
||||||
WrapInFunction(Call<bool>(true));
|
WrapInFunction(Call<bool>(true));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -102,7 +102,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Bool) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("true"));
|
EXPECT_THAT(gen.result(), HasSubstr("true"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Int) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_Int) {
|
||||||
WrapInFunction(Call<i32>(-12345_i));
|
WrapInFunction(Call<i32>(-12345_i));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -111,7 +111,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Int) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("-12345"));
|
EXPECT_THAT(gen.result(), HasSubstr("-12345"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Uint) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_Uint) {
|
||||||
WrapInFunction(Call<u32>(12345_u));
|
WrapInFunction(Call<u32>(12345_u));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -120,7 +120,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Uint) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("12345u"));
|
EXPECT_THAT(gen.result(), HasSubstr("12345u"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_F32) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_Vec_F32) {
|
||||||
WrapInFunction(vec3<f32>(1_f, 2_f, 3_f));
|
WrapInFunction(vec3<f32>(1_f, 2_f, 3_f));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -129,7 +129,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_F32) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("float3(1.0f, 2.0f, 3.0f)"));
|
EXPECT_THAT(gen.result(), HasSubstr("float3(1.0f, 2.0f, 3.0f)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_F16) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_Vec_F16) {
|
||||||
Enable(builtin::Extension::kF16);
|
Enable(builtin::Extension::kF16);
|
||||||
|
|
||||||
WrapInFunction(vec3<f16>(1_h, 2_h, 3_h));
|
WrapInFunction(vec3<f16>(1_h, 2_h, 3_h));
|
||||||
|
@ -140,7 +140,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_F16) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("half3(1.0h, 2.0h, 3.0h)"));
|
EXPECT_THAT(gen.result(), HasSubstr("half3(1.0h, 2.0h, 3.0h)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_Empty_F32) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_Vec_Empty_F32) {
|
||||||
WrapInFunction(vec3<f32>());
|
WrapInFunction(vec3<f32>());
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -149,7 +149,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_Empty_F32) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("float3(0.0f)"));
|
EXPECT_THAT(gen.result(), HasSubstr("float3(0.0f)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_Empty_F16) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_Vec_Empty_F16) {
|
||||||
Enable(builtin::Extension::kF16);
|
Enable(builtin::Extension::kF16);
|
||||||
|
|
||||||
WrapInFunction(vec3<f16>());
|
WrapInFunction(vec3<f16>());
|
||||||
|
@ -160,7 +160,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_Empty_F16) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("half3(0.0h)"));
|
EXPECT_THAT(gen.result(), HasSubstr("half3(0.0h)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_F32_Literal) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_F32_Literal) {
|
||||||
WrapInFunction(vec3<f32>(2_f));
|
WrapInFunction(vec3<f32>(2_f));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -169,7 +169,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_F32_Literal)
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("float3(2.0f)"));
|
EXPECT_THAT(gen.result(), HasSubstr("float3(2.0f)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_F16_Literal) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_F16_Literal) {
|
||||||
Enable(builtin::Extension::kF16);
|
Enable(builtin::Extension::kF16);
|
||||||
|
|
||||||
WrapInFunction(vec3<f16>(2_h));
|
WrapInFunction(vec3<f16>(2_h));
|
||||||
|
@ -180,7 +180,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_F16_Literal)
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("half3(2.0h)"));
|
EXPECT_THAT(gen.result(), HasSubstr("half3(2.0h)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_F32_Var) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_F32_Var) {
|
||||||
auto* var = Var("v", Expr(2_f));
|
auto* var = Var("v", Expr(2_f));
|
||||||
auto* cast = vec3<f32>(var);
|
auto* cast = vec3<f32>(var);
|
||||||
WrapInFunction(var, cast);
|
WrapInFunction(var, cast);
|
||||||
|
@ -192,7 +192,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_F32_Var) {
|
||||||
float3 const tint_symbol = float3(v);)"));
|
float3 const tint_symbol = float3(v);)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_F16_Var) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_F16_Var) {
|
||||||
Enable(builtin::Extension::kF16);
|
Enable(builtin::Extension::kF16);
|
||||||
|
|
||||||
auto* var = Var("v", Expr(2_h));
|
auto* var = Var("v", Expr(2_h));
|
||||||
|
@ -206,7 +206,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_F16_Var) {
|
||||||
half3 const tint_symbol = half3(v);)"));
|
half3 const tint_symbol = half3(v);)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_Bool) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_Bool) {
|
||||||
WrapInFunction(vec3<bool>(true));
|
WrapInFunction(vec3<bool>(true));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -215,7 +215,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_Bool) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("bool3(true)"));
|
EXPECT_THAT(gen.result(), HasSubstr("bool3(true)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_Int) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_Int) {
|
||||||
WrapInFunction(vec3<i32>(2_i));
|
WrapInFunction(vec3<i32>(2_i));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -224,7 +224,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_Int) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("int3(2)"));
|
EXPECT_THAT(gen.result(), HasSubstr("int3(2)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_UInt) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_Vec_SingleScalar_UInt) {
|
||||||
WrapInFunction(vec3<u32>(2_u));
|
WrapInFunction(vec3<u32>(2_u));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -233,7 +233,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_UInt) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("uint3(2u)"));
|
EXPECT_THAT(gen.result(), HasSubstr("uint3(2u)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_F32) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_Mat_F32) {
|
||||||
WrapInFunction(mat2x3<f32>(vec3<f32>(1_f, 2_f, 3_f), vec3<f32>(3_f, 4_f, 5_f)));
|
WrapInFunction(mat2x3<f32>(vec3<f32>(1_f, 2_f, 3_f), vec3<f32>(3_f, 4_f, 5_f)));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -244,7 +244,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_F32) {
|
||||||
HasSubstr("float2x3(float3(1.0f, 2.0f, 3.0f), float3(3.0f, 4.0f, 5.0f))"));
|
HasSubstr("float2x3(float3(1.0f, 2.0f, 3.0f), float3(3.0f, 4.0f, 5.0f))"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_F16) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_Mat_F16) {
|
||||||
Enable(builtin::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)));
|
||||||
|
@ -257,7 +257,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_F16) {
|
||||||
HasSubstr("half2x3(half3(1.0h, 2.0h, 3.0h), half3(3.0h, 4.0h, 5.0h))"));
|
HasSubstr("half2x3(half3(1.0h, 2.0h, 3.0h), half3(3.0h, 4.0h, 5.0h))"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Complex_F32) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_Mat_Complex_F32) {
|
||||||
// mat4x4<f32>(
|
// mat4x4<f32>(
|
||||||
// vec4<f32>(2.0f, 3.0f, 4.0f, 8.0f),
|
// vec4<f32>(2.0f, 3.0f, 4.0f, 8.0f),
|
||||||
// vec4<f32>(),
|
// vec4<f32>(),
|
||||||
|
@ -271,10 +271,10 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Complex_F32) {
|
||||||
auto* vector_identical_init =
|
auto* vector_identical_init =
|
||||||
vec4<f32>(vec4<f32>(Expr(f32(42.0)), Expr(f32(21.0)), Expr(f32(6.0)), Expr(f32(-5.0))));
|
vec4<f32>(vec4<f32>(Expr(f32(42.0)), Expr(f32(21.0)), Expr(f32(6.0)), Expr(f32(-5.0))));
|
||||||
|
|
||||||
auto* initializer = mat4x4<f32>(vector_literal, vector_zero_init, vector_single_scalar_init,
|
auto* constructor = mat4x4<f32>(vector_literal, vector_zero_init, vector_single_scalar_init,
|
||||||
vector_identical_init);
|
vector_identical_init);
|
||||||
|
|
||||||
WrapInFunction(initializer);
|
WrapInFunction(constructor);
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Complex_F32) {
|
||||||
"float4(7.0f), float4(42.0f, 21.0f, 6.0f, -5.0f))"));
|
"float4(7.0f), float4(42.0f, 21.0f, 6.0f, -5.0f))"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Complex_F16) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_Mat_Complex_F16) {
|
||||||
// mat4x4<f16>(
|
// mat4x4<f16>(
|
||||||
// vec4<f16>(2.0h, 3.0h, 4.0h, 8.0h),
|
// vec4<f16>(2.0h, 3.0h, 4.0h, 8.0h),
|
||||||
// vec4<f16>(),
|
// vec4<f16>(),
|
||||||
|
@ -300,10 +300,10 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Complex_F16) {
|
||||||
auto* vector_identical_init =
|
auto* vector_identical_init =
|
||||||
vec4<f16>(vec4<f16>(Expr(f16(42.0)), Expr(f16(21.0)), Expr(f16(6.0)), Expr(f16(-5.0))));
|
vec4<f16>(vec4<f16>(Expr(f16(42.0)), Expr(f16(21.0)), Expr(f16(6.0)), Expr(f16(-5.0))));
|
||||||
|
|
||||||
auto* initializer = mat4x4<f16>(vector_literal, vector_zero_init, vector_single_scalar_init,
|
auto* constructor = mat4x4<f16>(vector_literal, vector_zero_init, vector_single_scalar_init,
|
||||||
vector_identical_init);
|
vector_identical_init);
|
||||||
|
|
||||||
WrapInFunction(initializer);
|
WrapInFunction(constructor);
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Complex_F16) {
|
||||||
"half4(7.0h), half4(42.0h, 21.0h, 6.0h, -5.0h))"));
|
"half4(7.0h), half4(42.0h, 21.0h, 6.0h, -5.0h))"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Empty_F32) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_Mat_Empty_F32) {
|
||||||
WrapInFunction(mat2x3<f32>());
|
WrapInFunction(mat2x3<f32>());
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -324,7 +324,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Empty_F32) {
|
||||||
HasSubstr("float2x3 const tint_symbol = float2x3(float3(0.0f), float3(0.0f))"));
|
HasSubstr("float2x3 const tint_symbol = float2x3(float3(0.0f), float3(0.0f))"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Empty_F16) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_Mat_Empty_F16) {
|
||||||
Enable(builtin::Extension::kF16);
|
Enable(builtin::Extension::kF16);
|
||||||
|
|
||||||
WrapInFunction(mat2x3<f16>());
|
WrapInFunction(mat2x3<f16>());
|
||||||
|
@ -337,7 +337,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Empty_F16) {
|
||||||
HasSubstr("half2x3 const tint_symbol = half2x3(half3(0.0h), half3(0.0h))"));
|
HasSubstr("half2x3 const tint_symbol = half2x3(half3(0.0h), half3(0.0h))"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Identity_F32) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_Mat_Identity_F32) {
|
||||||
// fn f() {
|
// fn f() {
|
||||||
// var m_1: mat4x4<f32> = mat4x4<f32>();
|
// var m_1: mat4x4<f32> = mat4x4<f32>();
|
||||||
// var m_2: mat4x4<f32> = mat4x4<f32>(m_1);
|
// var m_2: mat4x4<f32> = mat4x4<f32>(m_1);
|
||||||
|
@ -355,7 +355,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Identity_F32) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("float4x4 m_2 = float4x4(m_1);"));
|
EXPECT_THAT(gen.result(), HasSubstr("float4x4 m_2 = float4x4(m_1);"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Identity_F16) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_Mat_Identity_F16) {
|
||||||
// fn f() {
|
// fn f() {
|
||||||
// var m_1: mat4x4<f16> = mat4x4<f16>();
|
// var m_1: mat4x4<f16> = mat4x4<f16>();
|
||||||
// var m_2: mat4x4<f16> = mat4x4<f16>(m_1);
|
// var m_2: mat4x4<f16> = mat4x4<f16>(m_1);
|
||||||
|
@ -375,7 +375,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Identity_F16) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("half4x4 m_2 = half4x4(m_1);"));
|
EXPECT_THAT(gen.result(), HasSubstr("half4x4 m_2 = half4x4(m_1);"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Array) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_Array) {
|
||||||
WrapInFunction(Call(ty.array(ty.vec3<f32>(), 3_u), vec3<f32>(1_f, 2_f, 3_f),
|
WrapInFunction(Call(ty.array(ty.vec3<f32>(), 3_u), vec3<f32>(1_f, 2_f, 3_f),
|
||||||
vec3<f32>(4_f, 5_f, 6_f), vec3<f32>(7_f, 8_f, 9_f)));
|
vec3<f32>(4_f, 5_f, 6_f), vec3<f32>(7_f, 8_f, 9_f)));
|
||||||
|
|
||||||
|
@ -386,7 +386,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Array) {
|
||||||
"float3(7.0f, 8.0f, 9.0f)}"));
|
"float3(7.0f, 8.0f, 9.0f)}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Struct) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_Struct) {
|
||||||
auto* str = Structure("S", utils::Vector{
|
auto* str = Structure("S", utils::Vector{
|
||||||
Member("a", ty.i32()),
|
Member("a", ty.i32()),
|
||||||
Member("b", ty.f32()),
|
Member("b", ty.f32()),
|
||||||
|
@ -401,7 +401,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Struct) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("{.a=1, .b=2.0f, .c=int3(3, 4, 5)}"));
|
EXPECT_THAT(gen.result(), HasSubstr("{.a=1, .b=2.0f, .c=int3(3, 4, 5)}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Struct_Empty) {
|
TEST_F(MslGeneratorImplTest_Constructor, Type_Struct_Empty) {
|
||||||
auto* str = Structure("S", utils::Vector{
|
auto* str = Structure("S", utils::Vector{
|
||||||
Member("a", ty.i32()),
|
Member("a", ty.i32()),
|
||||||
Member("b", ty.f32()),
|
Member("b", ty.f32()),
|
|
@ -33,8 +33,8 @@
|
||||||
#include "src/tint/sem/statement.h"
|
#include "src/tint/sem/statement.h"
|
||||||
#include "src/tint/sem/struct.h"
|
#include "src/tint/sem/struct.h"
|
||||||
#include "src/tint/sem/switch_statement.h"
|
#include "src/tint/sem/switch_statement.h"
|
||||||
#include "src/tint/sem/type_conversion.h"
|
#include "src/tint/sem/value_constructor.h"
|
||||||
#include "src/tint/sem/type_initializer.h"
|
#include "src/tint/sem/value_conversion.h"
|
||||||
#include "src/tint/sem/variable.h"
|
#include "src/tint/sem/variable.h"
|
||||||
#include "src/tint/transform/add_block_attribute.h"
|
#include "src/tint/transform/add_block_attribute.h"
|
||||||
#include "src/tint/type/array.h"
|
#include "src/tint/type/array.h"
|
||||||
|
@ -770,7 +770,7 @@ bool Builder::GenerateGlobalVariable(const ast::Variable* v) {
|
||||||
|
|
||||||
uint32_t init_id = 0;
|
uint32_t init_id = 0;
|
||||||
if (auto* ctor = v->initializer) {
|
if (auto* ctor = v->initializer) {
|
||||||
init_id = GenerateInitializerExpression(v, ctor);
|
init_id = GenerateConstructorExpression(v, ctor);
|
||||||
if (init_id == 0) {
|
if (init_id == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1247,7 +1247,7 @@ uint32_t Builder::GetGLSLstd450Import() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Builder::GenerateInitializerExpression(const ast::Variable* var,
|
uint32_t Builder::GenerateConstructorExpression(const ast::Variable* var,
|
||||||
const ast::Expression* expr) {
|
const ast::Expression* expr) {
|
||||||
if (auto* sem = builder_.Sem().GetVal(expr)) {
|
if (auto* sem = builder_.Sem().GetVal(expr)) {
|
||||||
if (auto constant = sem->ConstantValue()) {
|
if (auto constant = sem->ConstantValue()) {
|
||||||
|
@ -1255,15 +1255,15 @@ uint32_t Builder::GenerateInitializerExpression(const ast::Variable* var,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (auto* call = builder_.Sem().Get<sem::Call>(expr)) {
|
if (auto* call = builder_.Sem().Get<sem::Call>(expr)) {
|
||||||
if (call->Target()->IsAnyOf<sem::TypeInitializer, sem::TypeConversion>()) {
|
if (call->Target()->IsAnyOf<sem::ValueConstructor, sem::ValueConversion>()) {
|
||||||
return GenerateTypeInitializerOrConversion(call, var);
|
return GenerateValueConstructorOrConversion(call, var);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
error_ = "unknown initializer expression";
|
error_ = "unknown constructor expression";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Builder::IsInitializerConst(const ast::Expression* expr) {
|
bool Builder::IsConstructorConst(const ast::Expression* expr) {
|
||||||
bool is_const = true;
|
bool is_const = true;
|
||||||
ast::TraverseExpressions(expr, builder_.Diagnostics(), [&](const ast::Expression* e) {
|
ast::TraverseExpressions(expr, builder_.Diagnostics(), [&](const ast::Expression* e) {
|
||||||
if (e->Is<ast::LiteralExpression>()) {
|
if (e->Is<ast::LiteralExpression>()) {
|
||||||
|
@ -1277,7 +1277,7 @@ bool Builder::IsInitializerConst(const ast::Expression* expr) {
|
||||||
return ast::TraverseAction::Skip;
|
return ast::TraverseAction::Skip;
|
||||||
}
|
}
|
||||||
auto* call = sem->As<sem::Call>();
|
auto* call = sem->As<sem::Call>();
|
||||||
if (call->Target()->Is<sem::TypeInitializer>()) {
|
if (call->Target()->Is<sem::ValueConstructor>()) {
|
||||||
return ast::TraverseAction::Descend;
|
return ast::TraverseAction::Descend;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1288,19 +1288,19 @@ bool Builder::IsInitializerConst(const ast::Expression* expr) {
|
||||||
return is_const;
|
return is_const;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Builder::GenerateTypeInitializerOrConversion(const sem::Call* call,
|
uint32_t Builder::GenerateValueConstructorOrConversion(const sem::Call* call,
|
||||||
const ast::Variable* var) {
|
const ast::Variable* var) {
|
||||||
auto& args = call->Arguments();
|
auto& args = call->Arguments();
|
||||||
auto* global_var = builder_.Sem().Get<sem::GlobalVariable>(var);
|
auto* global_var = builder_.Sem().Get<sem::GlobalVariable>(var);
|
||||||
auto* result_type = call->Type();
|
auto* result_type = call->Type();
|
||||||
|
|
||||||
// Generate the zero initializer if there are no values provided.
|
// Generate the zero constructor if there are no values provided.
|
||||||
if (args.IsEmpty()) {
|
if (args.IsEmpty()) {
|
||||||
return GenerateConstantNullIfNeeded(result_type->UnwrapRef());
|
return GenerateConstantNullIfNeeded(result_type->UnwrapRef());
|
||||||
}
|
}
|
||||||
|
|
||||||
result_type = result_type->UnwrapRef();
|
result_type = result_type->UnwrapRef();
|
||||||
bool initializer_is_const = IsInitializerConst(call->Declaration());
|
bool constructor_is_const = IsConstructorConst(call->Declaration());
|
||||||
if (has_error()) {
|
if (has_error()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1335,7 +1335,7 @@ uint32_t Builder::GenerateTypeInitializerOrConversion(const sem::Call* call,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool result_is_constant_composite = initializer_is_const;
|
bool result_is_constant_composite = constructor_is_const;
|
||||||
bool result_is_spec_composite = false;
|
bool result_is_spec_composite = false;
|
||||||
|
|
||||||
if (auto* vec = result_type->As<type::Vector>()) {
|
if (auto* vec = result_type->As<type::Vector>()) {
|
||||||
|
@ -2243,13 +2243,14 @@ uint32_t Builder::GenerateCallExpression(const ast::CallExpression* expr) {
|
||||||
auto* call = builder_.Sem().Get<sem::Call>(expr);
|
auto* call = builder_.Sem().Get<sem::Call>(expr);
|
||||||
auto* target = call->Target();
|
auto* target = call->Target();
|
||||||
return Switch(
|
return Switch(
|
||||||
target, [&](const sem::Function* func) { return GenerateFunctionCall(call, func); },
|
target, //
|
||||||
|
[&](const sem::Function* func) { return GenerateFunctionCall(call, func); },
|
||||||
[&](const sem::Builtin* builtin) { return GenerateBuiltinCall(call, builtin); },
|
[&](const sem::Builtin* builtin) { return GenerateBuiltinCall(call, builtin); },
|
||||||
[&](const sem::TypeConversion*) {
|
[&](const sem::ValueConversion*) {
|
||||||
return GenerateTypeInitializerOrConversion(call, nullptr);
|
return GenerateValueConstructorOrConversion(call, nullptr);
|
||||||
},
|
},
|
||||||
[&](const sem::TypeInitializer*) {
|
[&](const sem::ValueConstructor*) {
|
||||||
return GenerateTypeInitializerOrConversion(call, nullptr);
|
return GenerateValueConstructorOrConversion(call, nullptr);
|
||||||
},
|
},
|
||||||
[&](Default) {
|
[&](Default) {
|
||||||
TINT_ICE(Writer, builder_.Diagnostics())
|
TINT_ICE(Writer, builder_.Diagnostics())
|
||||||
|
|
|
@ -45,8 +45,8 @@
|
||||||
namespace tint::sem {
|
namespace tint::sem {
|
||||||
class Call;
|
class Call;
|
||||||
class Load;
|
class Load;
|
||||||
class TypeInitializer;
|
class ValueConstructor;
|
||||||
class TypeConversion;
|
class ValueConversion;
|
||||||
} // namespace tint::sem
|
} // namespace tint::sem
|
||||||
namespace tint::type {
|
namespace tint::type {
|
||||||
class Reference;
|
class Reference;
|
||||||
|
@ -338,11 +338,11 @@ class Builder {
|
||||||
/// instruction set, if one doesn't exist yet, and returns the import ID.
|
/// instruction set, if one doesn't exist yet, and returns the import ID.
|
||||||
/// @returns the import ID, or 0 on error.
|
/// @returns the import ID, or 0 on error.
|
||||||
uint32_t GetGLSLstd450Import();
|
uint32_t GetGLSLstd450Import();
|
||||||
/// Generates a initializer expression
|
/// Generates a constructor expression
|
||||||
/// @param var the variable generated for, nullptr if no variable associated.
|
/// @param var the variable generated for, nullptr if no variable associated.
|
||||||
/// @param expr the expression to generate
|
/// @param expr the expression to generate
|
||||||
/// @returns the ID of the expression or 0 on failure.
|
/// @returns the ID of the expression or 0 on failure.
|
||||||
uint32_t GenerateInitializerExpression(const ast::Variable* var, const ast::Expression* expr);
|
uint32_t GenerateConstructorExpression(const ast::Variable* var, const ast::Expression* expr);
|
||||||
/// Generates a literal constant if needed
|
/// Generates a literal constant if needed
|
||||||
/// @param lit the literal to generate
|
/// @param lit the literal to generate
|
||||||
/// @returns the ID on success or 0 on failure
|
/// @returns the ID on success or 0 on failure
|
||||||
|
@ -373,11 +373,11 @@ class Builder {
|
||||||
/// @param builtin the builtin being called
|
/// @param builtin the builtin being called
|
||||||
/// @returns the expression ID on success or 0 otherwise
|
/// @returns the expression ID on success or 0 otherwise
|
||||||
uint32_t GenerateBuiltinCall(const sem::Call* call, const sem::Builtin* builtin);
|
uint32_t GenerateBuiltinCall(const sem::Call* call, const sem::Builtin* builtin);
|
||||||
/// Handles generating a type initializer or type conversion expression
|
/// Handles generating a value constructor or value conversion expression
|
||||||
/// @param call the call expression
|
/// @param call the call expression
|
||||||
/// @param var the variable that is being initialized. May be null.
|
/// @param var the variable that is being initialized. May be null.
|
||||||
/// @returns the expression ID on success or 0 otherwise
|
/// @returns the expression ID on success or 0 otherwise
|
||||||
uint32_t GenerateTypeInitializerOrConversion(const sem::Call* call, const ast::Variable* var);
|
uint32_t GenerateValueConstructorOrConversion(const sem::Call* call, const ast::Variable* var);
|
||||||
/// Generates a texture builtin call. Emits an error and returns false if
|
/// Generates a texture builtin call. Emits an error and returns false if
|
||||||
/// we're currently outside a function.
|
/// we're currently outside a function.
|
||||||
/// @param call the call expression
|
/// @param call the call expression
|
||||||
|
@ -538,10 +538,10 @@ class Builder {
|
||||||
/// @returns SPIR-V image format type
|
/// @returns SPIR-V image format type
|
||||||
SpvImageFormat convert_texel_format_to_spv(const builtin::TexelFormat format);
|
SpvImageFormat convert_texel_format_to_spv(const builtin::TexelFormat format);
|
||||||
|
|
||||||
/// Determines if the given type initializer is created from constant values
|
/// Determines if the given value constructor is created from constant values
|
||||||
/// @param expr the expression to check
|
/// @param expr the expression to check
|
||||||
/// @returns true if the initializer is constant
|
/// @returns true if the constructor is constant
|
||||||
bool IsInitializerConst(const ast::Expression* expr);
|
bool IsConstructorConst(const ast::Expression* expr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// @returns an Operand with a new result ID in it. Increments the next_id_
|
/// @returns an Operand with a new result ID in it. Increments the next_id_
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -22,9 +22,9 @@ using namespace tint::number_suffixes; // NOLINT
|
||||||
namespace tint::writer::wgsl {
|
namespace tint::writer::wgsl {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
using WgslGeneratorImplTest = TestHelper;
|
using WgslGeneratorImplTest_Constructor = TestHelper;
|
||||||
|
|
||||||
TEST_F(WgslGeneratorImplTest, EmitInitializer_Bool) {
|
TEST_F(WgslGeneratorImplTest_Constructor, Bool) {
|
||||||
WrapInFunction(Expr(false));
|
WrapInFunction(Expr(false));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -33,7 +33,7 @@ TEST_F(WgslGeneratorImplTest, EmitInitializer_Bool) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("false"));
|
EXPECT_THAT(gen.result(), HasSubstr("false"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WgslGeneratorImplTest, EmitInitializer_Int) {
|
TEST_F(WgslGeneratorImplTest_Constructor, Int) {
|
||||||
WrapInFunction(Expr(-12345_i));
|
WrapInFunction(Expr(-12345_i));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -42,7 +42,7 @@ TEST_F(WgslGeneratorImplTest, EmitInitializer_Int) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("-12345"));
|
EXPECT_THAT(gen.result(), HasSubstr("-12345"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WgslGeneratorImplTest, EmitInitializer_UInt) {
|
TEST_F(WgslGeneratorImplTest_Constructor, UInt) {
|
||||||
WrapInFunction(Expr(56779_u));
|
WrapInFunction(Expr(56779_u));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -51,7 +51,7 @@ TEST_F(WgslGeneratorImplTest, EmitInitializer_UInt) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("56779u"));
|
EXPECT_THAT(gen.result(), HasSubstr("56779u"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WgslGeneratorImplTest, EmitInitializer_F32) {
|
TEST_F(WgslGeneratorImplTest_Constructor, F32) {
|
||||||
// Use a number close to 1<<30 but whose decimal representation ends in 0.
|
// Use a number close to 1<<30 but whose decimal representation ends in 0.
|
||||||
WrapInFunction(Expr(f32((1 << 30) - 4)));
|
WrapInFunction(Expr(f32((1 << 30) - 4)));
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ TEST_F(WgslGeneratorImplTest, EmitInitializer_F32) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("1073741824.0f"));
|
EXPECT_THAT(gen.result(), HasSubstr("1073741824.0f"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WgslGeneratorImplTest, EmitInitializer_F16) {
|
TEST_F(WgslGeneratorImplTest_Constructor, F16) {
|
||||||
Enable(builtin::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.
|
||||||
|
@ -73,7 +73,7 @@ TEST_F(WgslGeneratorImplTest, EmitInitializer_F16) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("32752.0h"));
|
EXPECT_THAT(gen.result(), HasSubstr("32752.0h"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_F32) {
|
TEST_F(WgslGeneratorImplTest_Constructor, Type_F32) {
|
||||||
WrapInFunction(Call<f32>(Expr(-1.2e-5_f)));
|
WrapInFunction(Call<f32>(Expr(-1.2e-5_f)));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -82,7 +82,7 @@ TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_F32) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("f32(-0.000012f)"));
|
EXPECT_THAT(gen.result(), HasSubstr("f32(-0.000012f)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_F16) {
|
TEST_F(WgslGeneratorImplTest_Constructor, Type_F16) {
|
||||||
Enable(builtin::Extension::kF16);
|
Enable(builtin::Extension::kF16);
|
||||||
|
|
||||||
WrapInFunction(Call<f16>(Expr(-1.2e-5_h)));
|
WrapInFunction(Call<f16>(Expr(-1.2e-5_h)));
|
||||||
|
@ -93,7 +93,7 @@ TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_F16) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("f16(-1.19805336e-05h)"));
|
EXPECT_THAT(gen.result(), HasSubstr("f16(-1.19805336e-05h)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Bool) {
|
TEST_F(WgslGeneratorImplTest_Constructor, Type_Bool) {
|
||||||
WrapInFunction(Call<bool>(true));
|
WrapInFunction(Call<bool>(true));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -102,7 +102,7 @@ TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Bool) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("bool(true)"));
|
EXPECT_THAT(gen.result(), HasSubstr("bool(true)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Int) {
|
TEST_F(WgslGeneratorImplTest_Constructor, Type_Int) {
|
||||||
WrapInFunction(Call<i32>(-12345_i));
|
WrapInFunction(Call<i32>(-12345_i));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -111,7 +111,7 @@ TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Int) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("i32(-12345i)"));
|
EXPECT_THAT(gen.result(), HasSubstr("i32(-12345i)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Uint) {
|
TEST_F(WgslGeneratorImplTest_Constructor, Type_Uint) {
|
||||||
WrapInFunction(Call<u32>(12345_u));
|
WrapInFunction(Call<u32>(12345_u));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -120,7 +120,7 @@ TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Uint) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("u32(12345u)"));
|
EXPECT_THAT(gen.result(), HasSubstr("u32(12345u)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Vec_F32) {
|
TEST_F(WgslGeneratorImplTest_Constructor, Type_Vec_F32) {
|
||||||
WrapInFunction(vec3<f32>(1_f, 2_f, 3_f));
|
WrapInFunction(vec3<f32>(1_f, 2_f, 3_f));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -129,7 +129,7 @@ TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Vec_F32) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("vec3<f32>(1.0f, 2.0f, 3.0f)"));
|
EXPECT_THAT(gen.result(), HasSubstr("vec3<f32>(1.0f, 2.0f, 3.0f)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Vec_F16) {
|
TEST_F(WgslGeneratorImplTest_Constructor, Type_Vec_F16) {
|
||||||
Enable(builtin::Extension::kF16);
|
Enable(builtin::Extension::kF16);
|
||||||
|
|
||||||
WrapInFunction(vec3<f16>(1_h, 2_h, 3_h));
|
WrapInFunction(vec3<f16>(1_h, 2_h, 3_h));
|
||||||
|
@ -140,7 +140,7 @@ TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Vec_F16) {
|
||||||
EXPECT_THAT(gen.result(), HasSubstr("vec3<f16>(1.0h, 2.0h, 3.0h)"));
|
EXPECT_THAT(gen.result(), HasSubstr("vec3<f16>(1.0h, 2.0h, 3.0h)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Mat_F32) {
|
TEST_F(WgslGeneratorImplTest_Constructor, Type_Mat_F32) {
|
||||||
WrapInFunction(mat2x3<f32>(vec3<f32>(1_f, 2_f, 3_f), vec3<f32>(3_f, 4_f, 5_f)));
|
WrapInFunction(mat2x3<f32>(vec3<f32>(1_f, 2_f, 3_f), vec3<f32>(3_f, 4_f, 5_f)));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
@ -150,7 +150,7 @@ TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Mat_F32) {
|
||||||
"vec3<f32>(3.0f, 4.0f, 5.0f))"));
|
"vec3<f32>(3.0f, 4.0f, 5.0f))"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Mat_F16) {
|
TEST_F(WgslGeneratorImplTest_Constructor, Type_Mat_F16) {
|
||||||
Enable(builtin::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)));
|
||||||
|
@ -162,7 +162,7 @@ TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Mat_F16) {
|
||||||
"vec3<f16>(3.0h, 4.0h, 5.0h))"));
|
"vec3<f16>(3.0h, 4.0h, 5.0h))"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Array) {
|
TEST_F(WgslGeneratorImplTest_Constructor, Type_Array) {
|
||||||
WrapInFunction(Call(ty.array(ty.vec3<f32>(), 3_u), vec3<f32>(1_f, 2_f, 3_f),
|
WrapInFunction(Call(ty.array(ty.vec3<f32>(), 3_u), vec3<f32>(1_f, 2_f, 3_f),
|
||||||
vec3<f32>(4_f, 5_f, 6_f), vec3<f32>(7_f, 8_f, 9_f)));
|
vec3<f32>(4_f, 5_f, 6_f), vec3<f32>(7_f, 8_f, 9_f)));
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Array) {
|
||||||
"vec3<f32>(4.0f, 5.0f, 6.0f), vec3<f32>(7.0f, 8.0f, 9.0f))"));
|
"vec3<f32>(4.0f, 5.0f, 6.0f), vec3<f32>(7.0f, 8.0f, 9.0f))"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_ImplicitArray) {
|
TEST_F(WgslGeneratorImplTest_Constructor, Type_ImplicitArray) {
|
||||||
WrapInFunction(Call(ty.array<Infer>(), vec3<f32>(1_f, 2_f, 3_f), vec3<f32>(4_f, 5_f, 6_f),
|
WrapInFunction(Call(ty.array<Infer>(), vec3<f32>(1_f, 2_f, 3_f), vec3<f32>(4_f, 5_f, 6_f),
|
||||||
vec3<f32>(7_f, 8_f, 9_f)));
|
vec3<f32>(7_f, 8_f, 9_f)));
|
||||||
|
|
|
@ -22,7 +22,7 @@ fn foo(src_param : ArrayType) {
|
||||||
|
|
||||||
var dst : ArrayType;
|
var dst : ArrayType;
|
||||||
|
|
||||||
// Assign from type constructor.
|
// Assign from value constructor.
|
||||||
dst = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
|
dst = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
|
||||||
|
|
||||||
// Assign from parameter.
|
// Assign from parameter.
|
||||||
|
|
|
@ -23,7 +23,7 @@ fn ret_struct_arr() -> S {
|
||||||
fn foo(src_param : ArrayType) {
|
fn foo(src_param : ArrayType) {
|
||||||
var src_function : ArrayType;
|
var src_function : ArrayType;
|
||||||
|
|
||||||
// Assign from type constructor.
|
// Assign from value constructor.
|
||||||
dst = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
|
dst = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
|
||||||
|
|
||||||
// Assign from parameter.
|
// Assign from parameter.
|
||||||
|
|
|
@ -27,7 +27,7 @@ fn ret_struct_arr() -> S {
|
||||||
fn foo(src_param : ArrayType) {
|
fn foo(src_param : ArrayType) {
|
||||||
var src_function : ArrayType;
|
var src_function : ArrayType;
|
||||||
|
|
||||||
// Assign from type constructor.
|
// Assign from value constructor.
|
||||||
dst.arr = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
|
dst.arr = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
|
||||||
|
|
||||||
// Assign from parameter.
|
// Assign from parameter.
|
||||||
|
|
|
@ -23,7 +23,7 @@ fn ret_struct_arr() -> S {
|
||||||
fn foo(src_param : ArrayType) {
|
fn foo(src_param : ArrayType) {
|
||||||
var src_function : ArrayType;
|
var src_function : ArrayType;
|
||||||
|
|
||||||
// Assign from type constructor.
|
// Assign from value constructor.
|
||||||
dst = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
|
dst = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
|
||||||
|
|
||||||
// Assign from parameter.
|
// Assign from parameter.
|
||||||
|
|
|
@ -29,7 +29,7 @@ type AST struct {
|
||||||
Types []TypeDecl
|
Types []TypeDecl
|
||||||
Matchers []MatcherDecl
|
Matchers []MatcherDecl
|
||||||
Builtins []IntrinsicDecl
|
Builtins []IntrinsicDecl
|
||||||
Initializers []IntrinsicDecl
|
Constructors []IntrinsicDecl
|
||||||
Converters []IntrinsicDecl
|
Converters []IntrinsicDecl
|
||||||
Operators []IntrinsicDecl
|
Operators []IntrinsicDecl
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ func (a AST) String() string {
|
||||||
fmt.Fprintf(&sb, "%v", b)
|
fmt.Fprintf(&sb, "%v", b)
|
||||||
fmt.Fprintln(&sb)
|
fmt.Fprintln(&sb)
|
||||||
}
|
}
|
||||||
for _, o := range a.Initializers {
|
for _, o := range a.Constructors {
|
||||||
fmt.Fprintf(&sb, "%v", o)
|
fmt.Fprintf(&sb, "%v", o)
|
||||||
fmt.Fprintln(&sb)
|
fmt.Fprintln(&sb)
|
||||||
}
|
}
|
||||||
|
@ -123,10 +123,10 @@ const (
|
||||||
// Operator is a unary or binary operator.
|
// Operator is a unary or binary operator.
|
||||||
// Declared with 'op'.
|
// Declared with 'op'.
|
||||||
Operator IntrinsicKind = "operator"
|
Operator IntrinsicKind = "operator"
|
||||||
// Initializer is a type initializer function.
|
// Constructor is a value constructor function.
|
||||||
// Declared with 'init'.
|
// Declared with 'init'.
|
||||||
Initializer IntrinsicKind = "initializer"
|
Constructor IntrinsicKind = "constructor"
|
||||||
// Converter is a type conversion function.
|
// Converter is a value conversion function.
|
||||||
// Declared with 'conv'.
|
// Declared with 'conv'.
|
||||||
Converter IntrinsicKind = "converter"
|
Converter IntrinsicKind = "converter"
|
||||||
)
|
)
|
||||||
|
@ -149,8 +149,8 @@ func (i IntrinsicDecl) Format(w fmt.State, verb rune) {
|
||||||
fmt.Fprintf(w, "fn ")
|
fmt.Fprintf(w, "fn ")
|
||||||
case Operator:
|
case Operator:
|
||||||
fmt.Fprintf(w, "op ")
|
fmt.Fprintf(w, "op ")
|
||||||
case Initializer:
|
case Constructor:
|
||||||
fmt.Fprintf(w, "init ")
|
fmt.Fprintf(w, "ctor ")
|
||||||
case Converter:
|
case Converter:
|
||||||
fmt.Fprintf(w, "conv ")
|
fmt.Fprintf(w, "conv ")
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ type IntrinsicTable struct {
|
||||||
Builtins []Intrinsic // kBuiltins table content
|
Builtins []Intrinsic // kBuiltins table content
|
||||||
UnaryOperators []Intrinsic // kUnaryOperators table content
|
UnaryOperators []Intrinsic // kUnaryOperators table content
|
||||||
BinaryOperators []Intrinsic // kBinaryOperators table content
|
BinaryOperators []Intrinsic // kBinaryOperators table content
|
||||||
InitializersAndConverters []Intrinsic // kInitializersAndConverters table content
|
ConstructorsAndConverters []Intrinsic // kInitializersAndConverters table content
|
||||||
}
|
}
|
||||||
|
|
||||||
// TemplateType is used to create the C++ TemplateTypeInfo structure
|
// TemplateType is used to create the C++ TemplateTypeInfo structure
|
||||||
|
@ -387,7 +387,7 @@ func BuildIntrinsicTable(s *sem.Sem) (*IntrinsicTable, error) {
|
||||||
{s.Builtins, &b.Builtins},
|
{s.Builtins, &b.Builtins},
|
||||||
{s.UnaryOperators, &b.UnaryOperators},
|
{s.UnaryOperators, &b.UnaryOperators},
|
||||||
{s.BinaryOperators, &b.BinaryOperators},
|
{s.BinaryOperators, &b.BinaryOperators},
|
||||||
{s.InitializersAndConverters, &b.InitializersAndConverters},
|
{s.ConstructorsAndConverters, &b.ConstructorsAndConverters},
|
||||||
} {
|
} {
|
||||||
out := make([]Intrinsic, len(intrinsics.in))
|
out := make([]Intrinsic, len(intrinsics.in))
|
||||||
for i, f := range intrinsics.in {
|
for i, f := range intrinsics.in {
|
||||||
|
|
|
@ -104,8 +104,8 @@ func (l *lexer) lex() error {
|
||||||
l.tok(n, tok.Enum)
|
l.tok(n, tok.Enum)
|
||||||
case "type":
|
case "type":
|
||||||
l.tok(n, tok.Type)
|
l.tok(n, tok.Type)
|
||||||
case "init":
|
case "ctor":
|
||||||
l.tok(n, tok.Initializer)
|
l.tok(n, tok.Constructor)
|
||||||
case "conv":
|
case "conv":
|
||||||
l.tok(n, tok.Converter)
|
l.tok(n, tok.Converter)
|
||||||
case "match":
|
case "match":
|
||||||
|
|
|
@ -90,7 +90,7 @@ func TestLexTokens(t *testing.T) {
|
||||||
{"type", []tok.Token{{Kind: tok.Type, Runes: []rune("type"), Source: tok.Source{
|
{"type", []tok.Token{{Kind: tok.Type, Runes: []rune("type"), Source: tok.Source{
|
||||||
S: loc(1, 1, 0), E: loc(1, 5, 4),
|
S: loc(1, 1, 0), E: loc(1, 5, 4),
|
||||||
}}}},
|
}}}},
|
||||||
{"init", []tok.Token{{Kind: tok.Initializer, Runes: []rune("init"), Source: tok.Source{
|
{"ctor", []tok.Token{{Kind: tok.Constructor, Runes: []rune("ctor"), Source: tok.Source{
|
||||||
S: loc(1, 1, 0), E: loc(1, 5, 4),
|
S: loc(1, 1, 0), E: loc(1, 5, 4),
|
||||||
}}}},
|
}}}},
|
||||||
{"conv", []tok.Token{{Kind: tok.Converter, Runes: []rune("conv"), Source: tok.Source{
|
{"conv", []tok.Token{{Kind: tok.Converter, Runes: []rune("conv"), Source: tok.Source{
|
||||||
|
|
|
@ -72,8 +72,8 @@ func (p *parser) parse() (*ast.AST, error) {
|
||||||
case tok.Operator:
|
case tok.Operator:
|
||||||
out.Operators = append(out.Operators, p.operatorDecl(attributes))
|
out.Operators = append(out.Operators, p.operatorDecl(attributes))
|
||||||
attributes = nil
|
attributes = nil
|
||||||
case tok.Initializer:
|
case tok.Constructor:
|
||||||
out.Initializers = append(out.Initializers, p.initializerDecl(attributes))
|
out.Constructors = append(out.Constructors, p.constructorDecl(attributes))
|
||||||
attributes = nil
|
attributes = nil
|
||||||
case tok.Converter:
|
case tok.Converter:
|
||||||
out.Converters = append(out.Converters, p.converterDecl(attributes))
|
out.Converters = append(out.Converters, p.converterDecl(attributes))
|
||||||
|
@ -221,12 +221,12 @@ func (p *parser) operatorDecl(decos ast.Attributes) ast.IntrinsicDecl {
|
||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *parser) initializerDecl(decos ast.Attributes) ast.IntrinsicDecl {
|
func (p *parser) constructorDecl(decos ast.Attributes) ast.IntrinsicDecl {
|
||||||
p.expect(tok.Initializer, "initializer declaration")
|
p.expect(tok.Constructor, "constructor declaration")
|
||||||
name := p.next()
|
name := p.next()
|
||||||
f := ast.IntrinsicDecl{
|
f := ast.IntrinsicDecl{
|
||||||
Source: name.Source,
|
Source: name.Source,
|
||||||
Kind: ast.Initializer,
|
Kind: ast.Constructor,
|
||||||
Attributes: decos,
|
Attributes: decos,
|
||||||
Name: string(name.Runes),
|
Name: string(name.Runes),
|
||||||
}
|
}
|
||||||
|
|
|
@ -440,20 +440,20 @@ func TestParser(t *testing.T) {
|
||||||
},
|
},
|
||||||
}, { ///////////////////////////////////////////////////////////////////
|
}, { ///////////////////////////////////////////////////////////////////
|
||||||
fileutils.ThisLine(),
|
fileutils.ThisLine(),
|
||||||
"init F()",
|
"ctor F()",
|
||||||
ast.AST{
|
ast.AST{
|
||||||
Initializers: []ast.IntrinsicDecl{{
|
Constructors: []ast.IntrinsicDecl{{
|
||||||
Kind: ast.Initializer,
|
Kind: ast.Constructor,
|
||||||
Name: "F",
|
Name: "F",
|
||||||
Parameters: ast.Parameters{},
|
Parameters: ast.Parameters{},
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
}, { ///////////////////////////////////////////////////////////////////
|
}, { ///////////////////////////////////////////////////////////////////
|
||||||
fileutils.ThisLine(),
|
fileutils.ThisLine(),
|
||||||
"@attr init F()",
|
"@attr ctor F()",
|
||||||
ast.AST{
|
ast.AST{
|
||||||
Initializers: []ast.IntrinsicDecl{{
|
Constructors: []ast.IntrinsicDecl{{
|
||||||
Kind: ast.Initializer,
|
Kind: ast.Constructor,
|
||||||
Name: "F",
|
Name: "F",
|
||||||
Attributes: ast.Attributes{
|
Attributes: ast.Attributes{
|
||||||
{Name: "attr", Values: nil},
|
{Name: "attr", Values: nil},
|
||||||
|
@ -463,10 +463,10 @@ func TestParser(t *testing.T) {
|
||||||
},
|
},
|
||||||
}, { ///////////////////////////////////////////////////////////////////
|
}, { ///////////////////////////////////////////////////////////////////
|
||||||
fileutils.ThisLine(),
|
fileutils.ThisLine(),
|
||||||
"init F(a)",
|
"ctor F(a)",
|
||||||
ast.AST{
|
ast.AST{
|
||||||
Initializers: []ast.IntrinsicDecl{{
|
Constructors: []ast.IntrinsicDecl{{
|
||||||
Kind: ast.Initializer,
|
Kind: ast.Constructor,
|
||||||
Name: "F",
|
Name: "F",
|
||||||
Parameters: ast.Parameters{
|
Parameters: ast.Parameters{
|
||||||
{Type: ast.TemplatedName{Name: "a"}},
|
{Type: ast.TemplatedName{Name: "a"}},
|
||||||
|
@ -475,10 +475,10 @@ func TestParser(t *testing.T) {
|
||||||
},
|
},
|
||||||
}, { ///////////////////////////////////////////////////////////////////
|
}, { ///////////////////////////////////////////////////////////////////
|
||||||
fileutils.ThisLine(),
|
fileutils.ThisLine(),
|
||||||
"init F(a: T)",
|
"ctor F(a: T)",
|
||||||
ast.AST{
|
ast.AST{
|
||||||
Initializers: []ast.IntrinsicDecl{{
|
Constructors: []ast.IntrinsicDecl{{
|
||||||
Kind: ast.Initializer,
|
Kind: ast.Constructor,
|
||||||
Name: "F",
|
Name: "F",
|
||||||
Parameters: ast.Parameters{
|
Parameters: ast.Parameters{
|
||||||
{Name: "a", Type: ast.TemplatedName{Name: "T"}},
|
{Name: "a", Type: ast.TemplatedName{Name: "T"}},
|
||||||
|
@ -487,10 +487,10 @@ func TestParser(t *testing.T) {
|
||||||
},
|
},
|
||||||
}, { ///////////////////////////////////////////////////////////////////
|
}, { ///////////////////////////////////////////////////////////////////
|
||||||
fileutils.ThisLine(),
|
fileutils.ThisLine(),
|
||||||
"init F(a, b)",
|
"ctor F(a, b)",
|
||||||
ast.AST{
|
ast.AST{
|
||||||
Initializers: []ast.IntrinsicDecl{{
|
Constructors: []ast.IntrinsicDecl{{
|
||||||
Kind: ast.Initializer,
|
Kind: ast.Constructor,
|
||||||
Name: "F",
|
Name: "F",
|
||||||
Parameters: ast.Parameters{
|
Parameters: ast.Parameters{
|
||||||
{Type: ast.TemplatedName{Name: "a"}},
|
{Type: ast.TemplatedName{Name: "a"}},
|
||||||
|
@ -500,10 +500,10 @@ func TestParser(t *testing.T) {
|
||||||
},
|
},
|
||||||
}, { ///////////////////////////////////////////////////////////////////
|
}, { ///////////////////////////////////////////////////////////////////
|
||||||
fileutils.ThisLine(),
|
fileutils.ThisLine(),
|
||||||
"init F<A : B<C> >()",
|
"ctor F<A : B<C> >()",
|
||||||
ast.AST{
|
ast.AST{
|
||||||
Initializers: []ast.IntrinsicDecl{{
|
Constructors: []ast.IntrinsicDecl{{
|
||||||
Kind: ast.Initializer,
|
Kind: ast.Constructor,
|
||||||
Name: "F",
|
Name: "F",
|
||||||
TemplateParams: ast.TemplateParams{
|
TemplateParams: ast.TemplateParams{
|
||||||
{
|
{
|
||||||
|
@ -520,10 +520,10 @@ func TestParser(t *testing.T) {
|
||||||
},
|
},
|
||||||
}, { ///////////////////////////////////////////////////////////////////
|
}, { ///////////////////////////////////////////////////////////////////
|
||||||
fileutils.ThisLine(),
|
fileutils.ThisLine(),
|
||||||
"init F<T>(a: X, b: Y<T>)",
|
"ctor F<T>(a: X, b: Y<T>)",
|
||||||
ast.AST{
|
ast.AST{
|
||||||
Initializers: []ast.IntrinsicDecl{{
|
Constructors: []ast.IntrinsicDecl{{
|
||||||
Kind: ast.Initializer,
|
Kind: ast.Constructor,
|
||||||
Name: "F",
|
Name: "F",
|
||||||
TemplateParams: ast.TemplateParams{
|
TemplateParams: ast.TemplateParams{
|
||||||
{Name: "T"},
|
{Name: "T"},
|
||||||
|
@ -539,10 +539,10 @@ func TestParser(t *testing.T) {
|
||||||
},
|
},
|
||||||
}, { ///////////////////////////////////////////////////////////////////
|
}, { ///////////////////////////////////////////////////////////////////
|
||||||
fileutils.ThisLine(),
|
fileutils.ThisLine(),
|
||||||
"init F() -> X",
|
"ctor F() -> X",
|
||||||
ast.AST{
|
ast.AST{
|
||||||
Initializers: []ast.IntrinsicDecl{{
|
Constructors: []ast.IntrinsicDecl{{
|
||||||
Kind: ast.Initializer,
|
Kind: ast.Constructor,
|
||||||
Name: "F",
|
Name: "F",
|
||||||
ReturnType: &ast.TemplatedName{Name: "X"},
|
ReturnType: &ast.TemplatedName{Name: "X"},
|
||||||
Parameters: ast.Parameters{},
|
Parameters: ast.Parameters{},
|
||||||
|
@ -550,10 +550,10 @@ func TestParser(t *testing.T) {
|
||||||
},
|
},
|
||||||
}, { ///////////////////////////////////////////////////////////////////
|
}, { ///////////////////////////////////////////////////////////////////
|
||||||
fileutils.ThisLine(),
|
fileutils.ThisLine(),
|
||||||
"init F() -> X<T>",
|
"ctor F() -> X<T>",
|
||||||
ast.AST{
|
ast.AST{
|
||||||
Initializers: []ast.IntrinsicDecl{{
|
Constructors: []ast.IntrinsicDecl{{
|
||||||
Kind: ast.Initializer,
|
Kind: ast.Constructor,
|
||||||
Name: "F",
|
Name: "F",
|
||||||
ReturnType: &ast.TemplatedName{
|
ReturnType: &ast.TemplatedName{
|
||||||
Name: "X",
|
Name: "X",
|
||||||
|
|
|
@ -32,7 +32,7 @@ type resolver struct {
|
||||||
builtins map[string]*sem.Intrinsic
|
builtins map[string]*sem.Intrinsic
|
||||||
unaryOperators map[string]*sem.Intrinsic
|
unaryOperators map[string]*sem.Intrinsic
|
||||||
binaryOperators map[string]*sem.Intrinsic
|
binaryOperators map[string]*sem.Intrinsic
|
||||||
initializersAndConverters map[string]*sem.Intrinsic
|
constructorsAndConverters map[string]*sem.Intrinsic
|
||||||
enumEntryMatchers map[*sem.EnumEntry]*sem.EnumMatcher
|
enumEntryMatchers map[*sem.EnumEntry]*sem.EnumMatcher
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ func Resolve(a *ast.AST) (*sem.Sem, error) {
|
||||||
builtins: map[string]*sem.Intrinsic{},
|
builtins: map[string]*sem.Intrinsic{},
|
||||||
unaryOperators: map[string]*sem.Intrinsic{},
|
unaryOperators: map[string]*sem.Intrinsic{},
|
||||||
binaryOperators: map[string]*sem.Intrinsic{},
|
binaryOperators: map[string]*sem.Intrinsic{},
|
||||||
initializersAndConverters: map[string]*sem.Intrinsic{},
|
constructorsAndConverters: map[string]*sem.Intrinsic{},
|
||||||
enumEntryMatchers: map[*sem.EnumEntry]*sem.EnumMatcher{},
|
enumEntryMatchers: map[*sem.EnumEntry]*sem.EnumMatcher{},
|
||||||
}
|
}
|
||||||
// Declare and resolve all the enumerators
|
// Declare and resolve all the enumerators
|
||||||
|
@ -88,9 +88,9 @@ func Resolve(a *ast.AST) (*sem.Sem, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Declare and resolve type initializers and converters
|
// Declare and resolve value constructors and converters
|
||||||
for _, c := range a.Initializers {
|
for _, c := range a.Constructors {
|
||||||
if err := r.intrinsic(c, r.initializersAndConverters, &r.s.InitializersAndConverters); err != nil {
|
if err := r.intrinsic(c, r.constructorsAndConverters, &r.s.ConstructorsAndConverters); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ func Resolve(a *ast.AST) (*sem.Sem, error) {
|
||||||
if len(c.Parameters) != 1 {
|
if len(c.Parameters) != 1 {
|
||||||
return nil, fmt.Errorf("%v conversions must have a single parameter", c.Source)
|
return nil, fmt.Errorf("%v conversions must have a single parameter", c.Source)
|
||||||
}
|
}
|
||||||
if err := r.intrinsic(c, r.initializersAndConverters, &r.s.InitializersAndConverters); err != nil {
|
if err := r.intrinsic(c, r.constructorsAndConverters, &r.s.ConstructorsAndConverters); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -360,8 +360,8 @@ func (r *resolver) intrinsic(
|
||||||
switch overload.Decl.Kind {
|
switch overload.Decl.Kind {
|
||||||
case ast.Builtin, ast.Operator:
|
case ast.Builtin, ast.Operator:
|
||||||
overload.ConstEvalFunction = overload.Decl.Name
|
overload.ConstEvalFunction = overload.Decl.Name
|
||||||
case ast.Initializer:
|
case ast.Constructor:
|
||||||
overload.ConstEvalFunction = "Init"
|
overload.ConstEvalFunction = "Ctor"
|
||||||
case ast.Converter:
|
case ast.Converter:
|
||||||
overload.ConstEvalFunction = "Conv"
|
overload.ConstEvalFunction = "Conv"
|
||||||
}
|
}
|
||||||
|
@ -601,7 +601,7 @@ func (r *resolver) calculateUniqueParameterNames() []string {
|
||||||
r.s.Builtins,
|
r.s.Builtins,
|
||||||
r.s.UnaryOperators,
|
r.s.UnaryOperators,
|
||||||
r.s.BinaryOperators,
|
r.s.BinaryOperators,
|
||||||
r.s.InitializersAndConverters,
|
r.s.ConstructorsAndConverters,
|
||||||
} {
|
} {
|
||||||
for _, i := range intrinsics {
|
for _, i := range intrinsics {
|
||||||
for _, o := range i.Overloads {
|
for _, o := range i.Overloads {
|
||||||
|
|
|
@ -157,13 +157,13 @@ op +(T<f32>, T<f32>)`,
|
||||||
}, {
|
}, {
|
||||||
`
|
`
|
||||||
type f32
|
type f32
|
||||||
init f32(f32)`,
|
ctor f32(f32)`,
|
||||||
success,
|
success,
|
||||||
}, {
|
}, {
|
||||||
`
|
`
|
||||||
type f32
|
type f32
|
||||||
type T<x>
|
type T<x>
|
||||||
init f32(T<f32>)`,
|
ctor f32(T<f32>)`,
|
||||||
success,
|
success,
|
||||||
}, {
|
}, {
|
||||||
`
|
`
|
||||||
|
@ -392,57 +392,57 @@ op << <M: m>(P<M>)`,
|
||||||
`
|
`
|
||||||
type i
|
type i
|
||||||
enum e { a }
|
enum e { a }
|
||||||
init F(i) -> e`,
|
ctor F(i) -> e`,
|
||||||
`file.txt:3:14 cannot use 'e' as return type. Must be a type or template type`,
|
`file.txt:3:14 cannot use 'e' as return type. Must be a type or template type`,
|
||||||
}, {
|
}, {
|
||||||
`
|
`
|
||||||
type T<x>
|
type T<x>
|
||||||
init F(T<u>)`,
|
ctor F(T<u>)`,
|
||||||
`file.txt:2:10 cannot resolve 'u'`,
|
`file.txt:2:10 cannot resolve 'u'`,
|
||||||
}, {
|
}, {
|
||||||
`
|
`
|
||||||
type x
|
type x
|
||||||
init F<T>(T<x>)`,
|
ctor F<T>(T<x>)`,
|
||||||
`file.txt:2:11 'T' template parameters do not accept template arguments`,
|
`file.txt:2:11 'T' template parameters do not accept template arguments`,
|
||||||
}, {
|
}, {
|
||||||
`
|
`
|
||||||
type A<N: num>
|
type A<N: num>
|
||||||
type B
|
type B
|
||||||
init F(A<B>)`,
|
ctor F(A<B>)`,
|
||||||
`file.txt:3:10 cannot use type 'B' as template number`,
|
`file.txt:3:10 cannot use type 'B' as template number`,
|
||||||
}, {
|
}, {
|
||||||
`
|
`
|
||||||
type A<N>
|
type A<N>
|
||||||
enum E { b }
|
enum E { b }
|
||||||
match M: E.b
|
match M: E.b
|
||||||
init F(A<M>)`,
|
ctor F(A<M>)`,
|
||||||
`file.txt:4:10 cannot use enum matcher 'M' as template type`,
|
`file.txt:4:10 cannot use enum matcher 'M' as template type`,
|
||||||
}, {
|
}, {
|
||||||
`
|
`
|
||||||
type T
|
type T
|
||||||
type P<N: num>
|
type P<N: num>
|
||||||
match m: T
|
match m: T
|
||||||
init F(P<m>)`,
|
ctor F(P<m>)`,
|
||||||
`file.txt:4:10 cannot use type matcher 'm' as template number`,
|
`file.txt:4:10 cannot use type matcher 'm' as template number`,
|
||||||
}, {
|
}, {
|
||||||
`
|
`
|
||||||
type P<N: num>
|
type P<N: num>
|
||||||
enum E { b }
|
enum E { b }
|
||||||
init F(P<E>)`,
|
ctor F(P<E>)`,
|
||||||
`file.txt:3:10 cannot use enum 'E' as template number`,
|
`file.txt:3:10 cannot use enum 'E' as template number`,
|
||||||
}, {
|
}, {
|
||||||
`
|
`
|
||||||
type P<N: num>
|
type P<N: num>
|
||||||
enum E { a b }
|
enum E { a b }
|
||||||
match m: E.a | E.b
|
match m: E.a | E.b
|
||||||
init F(P<m>)`,
|
ctor F(P<m>)`,
|
||||||
`file.txt:4:10 cannot use enum matcher 'm' as template number`,
|
`file.txt:4:10 cannot use enum matcher 'm' as template number`,
|
||||||
}, {
|
}, {
|
||||||
`
|
`
|
||||||
type P<N: num>
|
type P<N: num>
|
||||||
enum E { a b }
|
enum E { a b }
|
||||||
match m: E.a | E.b
|
match m: E.a | E.b
|
||||||
init F<M: m>(P<M>)`,
|
ctor F<M: m>(P<M>)`,
|
||||||
`file.txt:4:16 cannot use template enum 'E' as template number`,
|
`file.txt:4:16 cannot use template enum 'E' as template number`,
|
||||||
}, {
|
}, {
|
||||||
`
|
`
|
||||||
|
|
|
@ -31,7 +31,7 @@ type Sem struct {
|
||||||
Builtins []*Intrinsic
|
Builtins []*Intrinsic
|
||||||
UnaryOperators []*Intrinsic
|
UnaryOperators []*Intrinsic
|
||||||
BinaryOperators []*Intrinsic
|
BinaryOperators []*Intrinsic
|
||||||
InitializersAndConverters []*Intrinsic
|
ConstructorsAndConverters []*Intrinsic
|
||||||
// Maximum number of template types used across all builtins
|
// Maximum number of template types used across all builtins
|
||||||
MaxTemplateTypes int
|
MaxTemplateTypes int
|
||||||
// Maximum number of template numbers used across all builtins
|
// Maximum number of template numbers used across all builtins
|
||||||
|
|
|
@ -31,7 +31,7 @@ const (
|
||||||
Match Kind = "match"
|
Match Kind = "match"
|
||||||
Function Kind = "fn"
|
Function Kind = "fn"
|
||||||
Operator Kind = "op"
|
Operator Kind = "op"
|
||||||
Initializer Kind = "init"
|
Constructor Kind = "ctor"
|
||||||
Converter Kind = "conv"
|
Converter Kind = "conv"
|
||||||
Type Kind = "type"
|
Type Kind = "type"
|
||||||
Enum Kind = "enum"
|
Enum Kind = "enum"
|
||||||
|
|
Loading…
Reference in New Issue