chromium/third_party/dawn/src/tint/lang/msl/writer/ast_printer/ast_type_test.cc

// Copyright 2020 The Dawn & Tint Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
//    list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
//    this list of conditions and the following disclaimer in the documentation
//    and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
//    contributors may be used to endorse or promote products derived from
//    this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include <array>

#include "gmock/gmock.h"

#include "src/tint/lang/core/type/depth_multisampled_texture.h"
#include "src/tint/lang/core/type/depth_texture.h"
#include "src/tint/lang/core/type/multisampled_texture.h"
#include "src/tint/lang/core/type/sampled_texture.h"
#include "src/tint/lang/core/type/sampler.h"
#include "src/tint/lang/core/type/storage_texture.h"
#include "src/tint/lang/core/type/texture_dimension.h"
#include "src/tint/lang/msl/writer/ast_printer/helper_test.h"
#include "src/tint/utils/text/string_stream.h"

// Done except for two questions on:
// TEST_F(MslASTPrinterTest, EmitType_Struct_WithAttribute) {
// TEST_F(MslASTPrinterTest, EmitType_Pointer) {

namespace tint::msl::writer {
namespace {

HasSubstr;
usingnamespacetint::core::fluent_types;     // NOLINT
usingnamespacetint::core::number_suffixes;  // NOLINT

void FormatMSLField(StringStream& out,
                    const char* addr,
                    const char* type,
                    size_t array_count,
                    const char* name) {}

#define CHECK_TYPE_SIZE_AND_ALIGN(TYPE, SIZE, ALIGN)

// Declare C++ types that match the size and alignment of the types of the same
// name in MSL.
#define DECLARE_TYPE(NAME, SIZE, ALIGN)

// Size and alignments taken from the MSL spec:
// https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf
DECLARE_TYPE();
DECLARE_TYPE();
DECLARE_TYPE();
DECLARE_TYPE();
DECLARE_TYPE();
DECLARE_TYPE();
DECLARE_TYPE();
DECLARE_TYPE();
DECLARE_TYPE();
DECLARE_TYPE();
DECLARE_TYPE();
DECLARE_TYPE();
DECLARE_TYPE();
DECLARE_TYPE();
DECLARE_TYPE();
DECLARE_TYPE();
DECLARE_TYPE();
DECLARE_TYPE();
DECLARE_TYPE();
DECLARE_TYPE();
DECLARE_TYPE();
DECLARE_TYPE();
DECLARE_TYPE();
DECLARE_TYPE();
uint;

MslASTPrinterTest;

// MslPrinterTest.EmitType_Array
TEST_F(MslASTPrinterTest, EmitType_Array) {}

// MslPrinterTest.EmitType_ArrayOfArray
TEST_F(MslASTPrinterTest, EmitType_ArrayOfArray) {}

// MslPrinterTest.EmitType_ArrayOfArrayOfArray
TEST_F(MslASTPrinterTest, EmitType_ArrayOfArrayOfArray) {}

// TODO(dsinclair): Port? Not sure if this is relevant ...
TEST_F(MslASTPrinterTest, EmitType_Array_WithoutName) {}

// MslPrinterTest.EmitType_RuntimeArray
TEST_F(MslASTPrinterTest, EmitType_RuntimeArray) {}

// MSLPrinterTest.EmitType_Bool
TEST_F(MslASTPrinterTest, EmitType_Bool) {}

// MSLPrintertest.EmitType_F32
TEST_F(MslASTPrinterTest, EmitType_F32) {}

// MSLPrinterTest.EmitType_F16
TEST_F(MslASTPrinterTest, EmitType_F16) {}

// MSLPrinterTest.EmitType_I32
TEST_F(MslASTPrinterTest, EmitType_I32) {}

// MSLPrinterTest.EmitType_Matrix_F32
TEST_F(MslASTPrinterTest, EmitType_Matrix_F32) {}

// MSLPrinterTest.EmitType_Matrix_F16
TEST_F(MslASTPrinterTest, EmitType_Matrix_F16) {}

// TODO(dsinclair): Not sure if this is relevant? MslPrinterTest.EmitType_Pointer_Workgroup
TEST_F(MslASTPrinterTest, EmitType_Pointer) {}

TEST_F(MslASTPrinterTest, EmitType_Struct) {}

// MSLPrinterTest.EmitType_Struct
TEST_F(MslASTPrinterTest, EmitType_StructDecl) {}

// MSLPrinterTest.EmitType_Struct_Layout_NonComposites
TEST_F(MslASTPrinterTest, EmitType_Struct_Layout_NonComposites) {}

// MSLPrinterTest.EmitType_Struct_Layout_Structures
TEST_F(MslASTPrinterTest, EmitType_Struct_Layout_Structures) {}

// MSLPrinterTest.EmitType_Struct_Layout_ArrayDefaultStride
TEST_F(MslASTPrinterTest, EmitType_Struct_Layout_ArrayDefaultStride) {}

// MslPrinterTest.EmitType_Struct_Layout_ArrayVec3DefaultStride
TEST_F(MslASTPrinterTest, EmitType_Struct_Layout_ArrayVec3DefaultStride) {}

// MslPrinterTest.AttemptTintPadSymbolCollision
TEST_F(MslASTPrinterTest, AttemptTintPadSymbolCollision) {}

// TODO(dsinclair): Missing from IR tests, but test also doesn't look right.
TEST_F(MslASTPrinterTest, EmitType_Struct_WithAttribute) {}

// MSLPrinterTest.EmitType_U32
TEST_F(MslASTPrinterTest, EmitType_U32) {}

// MSLPrinterTest.EmitType_Vector
TEST_F(MslASTPrinterTest, EmitType_Vector) {}

// MSLPrinterTest.EmitType_Void
TEST_F(MslASTPrinterTest, EmitType_Void) {}

// MSLPrinterTest.EmitType_Sampler
TEST_F(MslASTPrinterTest, EmitType_Sampler) {}

// MSLPrinterTest.EmitType_SamplerComparison
TEST_F(MslASTPrinterTest, EmitType_SamplerComparison) {}

struct MslDepthTextureData {};
inline std::ostream& operator<<(std::ostream& out, MslDepthTextureData data) {}
MslDepthTexturesTest;
// MslPrinterDepthTexturesTest.Emit
TEST_P(MslDepthTexturesTest, Emit) {}
INSTANTIATE_TEST_SUITE_P();

MslDepthMultisampledTexturesTest;
// MSLPrinterTest.EmitType_DepthMultisampledTexture
TEST_F(MslDepthMultisampledTexturesTest, Emit) {}

struct MslTextureData {};
inline std::ostream& operator<<(std::ostream& out, MslTextureData data) {}
MslSampledtexturesTest;
// MslPrinterSampledTexturesTest.Emit
TEST_P(MslSampledtexturesTest, Emit) {}
INSTANTIATE_TEST_SUITE_P();

// MslPrinterTest.Emit_TypeMultisampledTexture
TEST_F(MslASTPrinterTest, Emit_TypeMultisampledTexture) {}

struct MslStorageTextureData {};
inline std::ostream& operator<<(std::ostream& out, MslStorageTextureData data) {}
MslStorageTexturesTest;
// MslPrinterStorageTexturesTest.Emit
TEST_P(MslStorageTexturesTest, Emit) {}
INSTANTIATE_TEST_SUITE_P();

}  // namespace
}  // namespace tint::msl::writer