#include "src/tint/lang/core/ir/transform/direct_variable_access.h"
#include <utility>
#include "src/tint/lang/core/ir/transform/helper_test.h"
#include "src/tint/lang/wgsl/reader/program_to_ir/program_to_ir.h"
#include "src/tint/lang/wgsl/reader/reader.h"
#include "src/tint/lang/wgsl/writer/ir_to_program/ir_to_program.h"
#include "src/tint/lang/wgsl/writer/raise/raise.h"
#include "src/tint/lang/wgsl/writer/writer.h"
#include "src/tint/utils/text/styled_text.h"
namespace tint::core::ir::transform {
namespace {
usingnamespacetint::core::fluent_types;
usingnamespacetint::core::number_suffixes;
namespace {
static constexpr DirectVariableAccessOptions kTransformPrivate = …;
static constexpr DirectVariableAccessOptions kTransformFunction = …;
class DirectVariableAccessTest : public TransformTestBase<testing::Test> { … };
}
namespace remove_uncalled {
IR_DirectVariableAccessWgslTest_RemoveUncalled;
TEST_F(IR_DirectVariableAccessWgslTest_RemoveUncalled, PtrUniform) { … }
TEST_F(IR_DirectVariableAccessWgslTest_RemoveUncalled, PtrStorage) { … }
TEST_F(IR_DirectVariableAccessWgslTest_RemoveUncalled, PtrWorkgroup) { … }
TEST_F(IR_DirectVariableAccessWgslTest_RemoveUncalled, PtrPrivate_Disabled) { … }
TEST_F(IR_DirectVariableAccessWgslTest_RemoveUncalled, PtrPrivate_Enabled) { … }
TEST_F(IR_DirectVariableAccessWgslTest_RemoveUncalled, PtrFunction_Disabled) { … }
TEST_F(IR_DirectVariableAccessWgslTest_RemoveUncalled, PtrFunction_Enabled) { … }
}
namespace pointer_chains_tests {
IR_DirectVariableAccessWgslTest_PtrChains;
TEST_F(IR_DirectVariableAccessWgslTest_PtrChains, ConstantIndices) { … }
TEST_F(IR_DirectVariableAccessWgslTest_PtrChains, DynamicIndices) { … }
TEST_F(IR_DirectVariableAccessWgslTest_PtrChains, DynamicIndicesForLoopInit) { … }
TEST_F(IR_DirectVariableAccessWgslTest_PtrChains, DynamicIndicesForLoopCond) { … }
TEST_F(IR_DirectVariableAccessWgslTest_PtrChains, DynamicIndicesForLoopCont) { … }
TEST_F(IR_DirectVariableAccessWgslTest_PtrChains, DynamicIndicesWhileCond) { … }
}
namespace uniform_as_tests {
IR_DirectVariableAccessWgslTest_UniformAS;
TEST_F(IR_DirectVariableAccessWgslTest_UniformAS, Param_ptr_i32_read) { … }
TEST_F(IR_DirectVariableAccessWgslTest_UniformAS, Param_ptr_vec4i32_Via_array_DynamicRead) { … }
TEST_F(IR_DirectVariableAccessWgslTest_UniformAS, CallChaining) { … }
}
namespace storage_as_tests {
IR_DirectVariableAccessWgslTest_StorageAS;
TEST_F(IR_DirectVariableAccessWgslTest_StorageAS, Param_ptr_i32_Via_struct_read) { … }
TEST_F(IR_DirectVariableAccessWgslTest_StorageAS, Param_ptr_arr_i32_Via_struct_write) { … }
TEST_F(IR_DirectVariableAccessWgslTest_StorageAS, Param_ptr_vec4i32_Via_array_DynamicWrite) { … }
TEST_F(IR_DirectVariableAccessWgslTest_StorageAS, CallChaining) { … }
}
namespace workgroup_as_tests {
IR_DirectVariableAccessWgslTest_WorkgroupAS;
TEST_F(IR_DirectVariableAccessWgslTest_WorkgroupAS, Param_ptr_vec4i32_Via_array_StaticRead) { … }
TEST_F(IR_DirectVariableAccessWgslTest_WorkgroupAS, Param_ptr_vec4i32_Via_array_StaticWrite) { … }
TEST_F(IR_DirectVariableAccessWgslTest_WorkgroupAS, CallChaining) { … }
}
namespace private_as_tests {
IR_DirectVariableAccessWgslTest_PrivateAS;
TEST_F(IR_DirectVariableAccessWgslTest_PrivateAS, Enabled_Param_ptr_i32_read) { … }
TEST_F(IR_DirectVariableAccessWgslTest_PrivateAS, Enabled_Param_ptr_i32_write) { … }
TEST_F(IR_DirectVariableAccessWgslTest_PrivateAS, Enabled_Param_ptr_i32_Via_struct_read) { … }
TEST_F(IR_DirectVariableAccessWgslTest_PrivateAS, Disabled_Param_ptr_i32_Via_struct_read) { … }
TEST_F(IR_DirectVariableAccessWgslTest_PrivateAS, Enabled_Param_ptr_arr_i32_Via_struct_write) { … }
TEST_F(IR_DirectVariableAccessWgslTest_PrivateAS, Disabled_Param_ptr_arr_i32_Via_struct_write) { … }
TEST_F(IR_DirectVariableAccessWgslTest_PrivateAS, Enabled_Param_ptr_i32_mixed) { … }
TEST_F(IR_DirectVariableAccessWgslTest_PrivateAS, Disabled_Param_ptr_i32_mixed) { … }
TEST_F(IR_DirectVariableAccessWgslTest_PrivateAS, Enabled_CallChaining) { … }
TEST_F(IR_DirectVariableAccessWgslTest_PrivateAS, Disabled_CallChaining) { … }
}
namespace function_as_tests {
IR_DirectVariableAccessWgslTest_FunctionAS;
TEST_F(IR_DirectVariableAccessWgslTest_FunctionAS, Enabled_LocalPtr) { … }
TEST_F(IR_DirectVariableAccessWgslTest_FunctionAS, Enabled_Param_ptr_i32_read) { … }
TEST_F(IR_DirectVariableAccessWgslTest_FunctionAS, Enabled_Param_ptr_i32_write) { … }
TEST_F(IR_DirectVariableAccessWgslTest_FunctionAS, Enabled_Param_ptr_i32_Via_struct_read) { … }
TEST_F(IR_DirectVariableAccessWgslTest_FunctionAS, Enabled_Param_ptr_arr_i32_Via_struct_write) { … }
TEST_F(IR_DirectVariableAccessWgslTest_FunctionAS, Enabled_Param_ptr_i32_mixed) { … }
TEST_F(IR_DirectVariableAccessWgslTest_FunctionAS, Disabled_Param_ptr_i32_Via_struct_read) { … }
TEST_F(IR_DirectVariableAccessWgslTest_FunctionAS, Disabled_Param_ptr_arr_i32_Via_struct_write) { … }
}
namespace builtin_fn_calls {
IR_DirectVariableAccessWgslTest_BuiltinFn;
TEST_F(IR_DirectVariableAccessWgslTest_BuiltinFn, ArrayLength) { … }
TEST_F(IR_DirectVariableAccessWgslTest_BuiltinFn, WorkgroupUniformLoad) { … }
}
namespace complex_tests {
IR_DirectVariableAccessWgslTest_Complex;
TEST_F(IR_DirectVariableAccessWgslTest_Complex, Param_ptr_mixed_vec4i32_ViaMultiple) { … }
TEST_F(IR_DirectVariableAccessWgslTest_Complex, Indexing) { … }
TEST_F(IR_DirectVariableAccessWgslTest_Complex, IndexingInPtrCall) { … }
TEST_F(IR_DirectVariableAccessWgslTest_Complex, IndexingDualPointers) { … }
}
}
}