diff --git a/src/tint/reader/spirv/construct.h b/src/tint/reader/spirv/construct.h index fbefc8fa84..eebb899e38 100644 --- a/src/tint/reader/spirv/construct.h +++ b/src/tint/reader/spirv/construct.h @@ -149,6 +149,7 @@ struct Construct { const uint32_t scope_end_pos = 0; }; +/// ConstructList is a list of Construct unique pointers. using ConstructList = std::vector>; /// Converts a construct kind to a string. diff --git a/src/tint/reader/spirv/function.h b/src/tint/reader/spirv/function.h index e90de21e68..1a08d089bd 100644 --- a/src/tint/reader/spirv/function.h +++ b/src/tint/reader/spirv/function.h @@ -175,6 +175,10 @@ struct BlockInfo { std::vector phis_needing_state_vars; }; +/// Writes the BlockInfo to the ostream +/// @param o the ostream +/// @param bi the BlockInfo +/// @returns the ostream so calls can be chained inline std::ostream& operator<<(std::ostream& o, const BlockInfo& bi) { o << "BlockInfo{" << " id: " << bi.id << " pos: " << bi.pos @@ -312,6 +316,10 @@ struct DefInfo { SkipReason skip = SkipReason::kDontSkip; }; +/// Writes the DefInfo to the ostream +/// @param o the ostream +/// @param di the DefInfo +/// @returns the ostream so calls can be chained inline std::ostream& operator<<(std::ostream& o, const DefInfo& di) { o << "DefInfo{" << " inst.result_id: " << di.inst.result_id() diff --git a/src/tint/reader/spirv/parser_impl.h b/src/tint/reader/spirv/parser_impl.h index d871452a7a..96fe99c60d 100644 --- a/src/tint/reader/spirv/parser_impl.h +++ b/src/tint/reader/spirv/parser_impl.h @@ -58,6 +58,8 @@ namespace tint::reader::spirv { /// Example: { SpvDecorationBlock } /// Example: { SpvDecorationArrayStride, 16 } using Decoration = std::vector; + +/// DecorationList is a list of decorations using DecorationList = std::vector; /// An AST expression with its type. diff --git a/src/tint/reader/spirv/parser_impl_test_helper.h b/src/tint/reader/spirv/parser_impl_test_helper.h index 9c270301e0..31640a53ba 100644 --- a/src/tint/reader/spirv/parser_impl_test_helper.h +++ b/src/tint/reader/spirv/parser_impl_test_helper.h @@ -307,7 +307,8 @@ class SpvParserTestBase : public T { } }; -// Use this form when you don't need to template any further. +/// SpvParserTest the the base class for SPIR-V reader unit tests. +/// Use this form when you don't need to template any further. using SpvParserTest = SpvParserTestBase<::testing::Test>; } // namespace tint::reader::spirv diff --git a/src/tint/reader/spirv/parser_type.cc b/src/tint/reader/spirv/parser_type.cc index 7a3c97f1f8..dbe4e14a5a 100644 --- a/src/tint/reader/spirv/parser_type.cc +++ b/src/tint/reader/spirv/parser_type.cc @@ -119,55 +119,47 @@ struct StorageTextureHasher { }; } // namespace +// Equality operators +//! @cond Doxygen_Suppress static bool operator==(const Pointer& a, const Pointer& b) { return a.type == b.type && a.storage_class == b.storage_class; } - static bool operator==(const Reference& a, const Reference& b) { return a.type == b.type && a.storage_class == b.storage_class; } - static bool operator==(const Vector& a, const Vector& b) { return a.type == b.type && a.size == b.size; } - static bool operator==(const Matrix& a, const Matrix& b) { return a.type == b.type && a.columns == b.columns && a.rows == b.rows; } - static bool operator==(const Array& a, const Array& b) { return a.type == b.type && a.size == b.size && a.stride == b.stride; } - static bool operator==(const Named& a, const Named& b) { return a.name == b.name; } - static bool operator==(const Sampler& a, const Sampler& b) { return a.kind == b.kind; } - static bool operator==(const DepthTexture& a, const DepthTexture& b) { return a.dims == b.dims; } - static bool operator==(const DepthMultisampledTexture& a, const DepthMultisampledTexture& b) { return a.dims == b.dims; } - static bool operator==(const MultisampledTexture& a, const MultisampledTexture& b) { return a.dims == b.dims && a.type == b.type; } - static bool operator==(const SampledTexture& a, const SampledTexture& b) { return a.dims == b.dims && a.type == b.type; } - static bool operator==(const StorageTexture& a, const StorageTexture& b) { return a.dims == b.dims && a.format == b.format; } +//! @endcond const ast::Type* Void::Build(ProgramBuilder& b) const { return b.ty.void_(); diff --git a/src/tint/reader/spirv/parser_type.h b/src/tint/reader/spirv/parser_type.h index 491b765a1e..6225a852c9 100644 --- a/src/tint/reader/spirv/parser_type.h +++ b/src/tint/reader/spirv/parser_type.h @@ -87,6 +87,7 @@ class Type : public Castable { #endif // NDEBUG }; +/// TypeList is a list of Types using TypeList = std::vector; /// `void` type diff --git a/src/tint/reader/spirv/usage.h b/src/tint/reader/spirv/usage.h index df6783f456..140a4ba3ac 100644 --- a/src/tint/reader/spirv/usage.h +++ b/src/tint/reader/spirv/usage.h @@ -124,6 +124,10 @@ class Usage { bool is_storage_write_ = false; }; +/// Writes the Usage to the ostream +/// @param out the ostream +/// @param u the Usage +/// @returns the ostream so calls can be chained inline std::ostream& operator<<(std::ostream& out, const Usage& u) { return u.operator<<(out); } diff --git a/src/tint/writer/hlsl/generator_impl.h b/src/tint/writer/hlsl/generator_impl.h index 4048430097..50bce98196 100644 --- a/src/tint/writer/hlsl/generator_impl.h +++ b/src/tint/writer/hlsl/generator_impl.h @@ -68,6 +68,7 @@ struct SanitizedResult { /// Sanitize a program in preparation for generating HLSL. /// @program The program to sanitize +/// @param program the input program /// @param options The HLSL generator options. /// @returns the sanitized program and any supplementary information SanitizedResult Sanitize(const Program* program, const Options& options); diff --git a/src/tint/writer/hlsl/test_helper.h b/src/tint/writer/hlsl/test_helper.h index a75d725523..089ddb9906 100644 --- a/src/tint/writer/hlsl/test_helper.h +++ b/src/tint/writer/hlsl/test_helper.h @@ -105,8 +105,13 @@ class TestHelperBase : public BODY, public ProgramBuilder { private: std::unique_ptr gen_; }; + +/// TestHelper the the base class for HLSL writer unit tests. +/// Use this form when you don't need to template any further. using TestHelper = TestHelperBase; +/// TestParamHelper the the base class for HLSL unit tests that take a templated +/// parameter. template using TestParamHelper = TestHelperBase>;