Condense namespaces in tint/writer/spirv.

This PR condenses the namespaces in the tint/writer/spirv folder.

Change-Id: Ibe1d241b4a3da3c031b431d4ed2a95f197678def
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86022
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
dan sinclair 2022-04-07 14:16:34 +00:00 committed by Dawn LUCI CQ
parent 9fe8260dbb
commit 411d065e2e
45 changed files with 99 additions and 279 deletions

View File

@ -16,9 +16,7 @@
#include <cstring>
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
const uint32_t kGeneratorId = 23u << 16;
@ -72,6 +70,4 @@ void BinaryWriter::process_op(const Operand& op) {
}
}
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -19,9 +19,7 @@
#include "src/tint/writer/spirv/builder.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
/// Writer to convert from builder to SPIR-V binary
class BinaryWriter {
@ -54,8 +52,6 @@ class BinaryWriter {
std::vector<uint32_t> out_;
};
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv
#endif // SRC_TINT_WRITER_SPIRV_BINARY_WRITER_H_

View File

@ -14,9 +14,7 @@
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using BinaryWriterTest = TestHelper;
@ -125,6 +123,4 @@ TEST_F(BinaryWriterTest, TestInstructionWriter) {
}
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -62,9 +62,7 @@
#include "src/tint/writer/append_vector.h"
#include "src/tint/writer/generate_external_texture_bindings.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using BuiltinType = sem::BuiltinType;
@ -4380,6 +4378,4 @@ Builder::Backedge& Builder::Backedge::operator=(
const Builder::Backedge& other) = default;
Builder::Backedge::~Backedge() = default;
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -40,18 +40,16 @@
#include "src/tint/writer/spirv/function.h"
#include "src/tint/writer/spirv/scalar_constant.h"
namespace tint {
// Forward declarations
namespace sem {
namespace tint::sem {
class Call;
class Reference;
class TypeConstructor;
class TypeConversion;
} // namespace sem
} // namespace tint::sem
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
/// The result of sanitizing a program for generation.
struct SanitizedResult {
@ -658,8 +656,6 @@ class Builder {
std::vector<Backedge> backedge_stack_;
};
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv
#endif // SRC_TINT_WRITER_SPIRV_BUILDER_H_

View File

@ -15,9 +15,7 @@
#include "src/tint/writer/spirv/spv_dump.h"
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using BuilderTest = TestHelper;
@ -1042,6 +1040,4 @@ OpReturn
}
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -15,9 +15,7 @@
#include "src/tint/writer/spirv/spv_dump.h"
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using BuilderTest = TestHelper;
@ -315,6 +313,4 @@ OpStore %9 %10
}
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -15,9 +15,7 @@
#include "src/tint/writer/spirv/spv_dump.h"
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using BuilderTest = TestHelper;
@ -1244,6 +1242,4 @@ INSTANTIATE_TEST_SUITE_P( //
} // namespace BinaryArithMatrixMatrix
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -15,9 +15,7 @@
#include "src/tint/writer/spirv/spv_dump.h"
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using BuilderTest = TestHelper;
@ -60,6 +58,4 @@ TEST_F(BuilderTest, Bitcast_DuplicateType) {
}
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -15,9 +15,7 @@
#include "src/tint/writer/spirv/spv_dump.h"
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using BuilderTest = TestHelper;
@ -61,6 +59,4 @@ OpStore %1 %8
}
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -19,9 +19,7 @@
#include "src/tint/writer/spirv/spv_dump.h"
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using BuiltinBuilderTest = TestHelper;
@ -2642,6 +2640,4 @@ OpFunctionEnd
}
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -19,9 +19,7 @@
#include "src/tint/writer/spirv/spv_dump.h"
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
struct expected_texture_overload_spirv {
@ -3750,6 +3748,4 @@ TEST_P(BuiltinTextureTest, OutsideFunction_IsError) {
}
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -17,9 +17,7 @@
#include "src/tint/writer/spirv/spv_dump.h"
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using BuilderTest = TestHelper;
@ -102,6 +100,4 @@ OpFunctionEnd
}
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -15,9 +15,7 @@
#include "src/tint/writer/spirv/spv_dump.h"
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using SpvBuilderConstructorTest = TestHelper;
@ -1853,6 +1851,4 @@ TEST_F(SpvBuilderConstructorTest,
}
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -15,9 +15,7 @@
#include "src/tint/writer/spirv/spv_dump.h"
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using BuilderTest = TestHelper;
@ -35,6 +33,4 @@ TEST_F(BuilderTest, Discard) {
}
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -29,9 +29,7 @@
#include "src/tint/writer/spirv/spv_dump.h"
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using BuilderTest = TestHelper;
@ -317,6 +315,4 @@ TEST_F(BuilderTest, SampleIndex_SampleRateShadingCapability) {
}
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -15,9 +15,7 @@
#include "src/tint/writer/spirv/spv_dump.h"
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
struct TestData {
@ -90,6 +88,4 @@ INSTANTIATE_TEST_SUITE_P(
TestData{ast::TexelFormat::kRgba32Float, SpvImageFormatRgba32f}));
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -17,9 +17,7 @@
#include "src/tint/writer/spirv/spv_dump.h"
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using BuilderTest = TestHelper;
@ -267,6 +265,4 @@ OpExecutionMode %11 DepthReplacing
}
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -16,9 +16,7 @@
#include "src/tint/writer/spirv/spv_dump.h"
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using BuilderTest = TestHelper;
@ -285,6 +283,4 @@ OpFunctionEnd
}
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -15,9 +15,7 @@
#include "src/tint/writer/spirv/spv_dump.h"
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using BuilderTest = TestHelper;
@ -194,6 +192,4 @@ TEST_F(BuilderTest, FunctionVar_Const) {
}
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -17,9 +17,7 @@
#include "src/tint/writer/spirv/spv_dump.h"
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using BuilderTest = TestHelper;
@ -660,6 +658,4 @@ TEST_F(BuilderTest, GlobalVar_WorkgroupWithZeroInit) {
}
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -15,9 +15,7 @@
#include "src/tint/writer/spirv/spv_dump.h"
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using BuilderTest = TestHelper;
@ -160,6 +158,4 @@ TEST_F(BuilderTest, IdentifierExpression_NoLoadConst) {
}
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -15,9 +15,7 @@
#include "src/tint/writer/spirv/spv_dump.h"
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using BuilderTest = TestHelper;
@ -668,6 +666,4 @@ OpReturn
}
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -15,9 +15,7 @@
#include "src/tint/writer/spirv/spv_dump.h"
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
using BuilderTest = TestHelper;
@ -163,6 +161,4 @@ TEST_F(BuilderTest, Literal_F32_Dedup) {
)");
}
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -15,9 +15,7 @@
#include "src/tint/writer/spirv/spv_dump.h"
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using BuilderTest = TestHelper;
@ -490,6 +488,4 @@ OpBranchConditional %10 %1 %2
}
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -15,9 +15,7 @@
#include "src/tint/writer/spirv/spv_dump.h"
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using BuilderTest = TestHelper;
@ -86,6 +84,4 @@ OpReturnValue %5
}
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -16,9 +16,7 @@
#include "src/tint/writer/spirv/spv_dump.h"
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using BuilderTest = TestHelper;
@ -447,6 +445,4 @@ OpFunctionEnd
}
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -15,9 +15,7 @@
#include "src/tint/writer/spirv/spv_dump.h"
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using BuilderTest = TestHelper;
@ -43,6 +41,4 @@ TEST_F(BuilderTest, Capabilities_Dedup) {
}
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -18,9 +18,7 @@
#include "src/tint/writer/spirv/spv_dump.h"
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using BuilderTest_Type = TestHelper;
@ -961,6 +959,4 @@ TEST_F(BuilderTest_Type, Dedup_Sampler_And_ComparisonSampler) {
}
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -15,9 +15,7 @@
#include "src/tint/writer/spirv/spv_dump.h"
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using BuilderTest = TestHelper;
@ -117,6 +115,4 @@ TEST_F(BuilderTest, UnaryOp_LoadRequired) {
}
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -14,9 +14,7 @@
#include "src/tint/writer/spirv/function.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
Function::Function()
: declaration_(Instruction{spv::Op::OpNop, {}}),
@ -50,6 +48,4 @@ void Function::iterate(std::function<void(const Instruction&)> cb) const {
cb(Instruction{spv::Op::OpFunctionEnd, {}});
}
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -19,9 +19,7 @@
#include "src/tint/writer/spirv/instruction.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
/// A SPIR-V function
class Function {
@ -94,8 +92,6 @@ class Function {
InstructionList instructions_;
};
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv
#endif // SRC_TINT_WRITER_SPIRV_FUNCTION_H_

View File

@ -16,9 +16,7 @@
#include "src/tint/writer/spirv/binary_writer.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
Result::Result() = default;
Result::~Result() = default;
@ -62,6 +60,4 @@ Result Generate(const Program* program, const Options& options) {
return result;
}
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -21,17 +21,16 @@
#include "src/tint/writer/writer.h"
namespace tint {
// Forward declarations
namespace tint {
class Program;
namespace writer {
namespace spirv {
/// Forward declarations
namespace writer::spirv {
class Builder;
class BinaryWriter;
} // namespace writer::spirv
} // namespace tint
namespace tint::writer::spirv {
/// Configuration options used for generating SPIR-V.
struct Options {
@ -79,8 +78,6 @@ struct Result {
/// @returns the resulting SPIR-V and supplementary information
Result Generate(const Program* program, const Options& options);
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv
#endif // SRC_TINT_WRITER_SPIRV_GENERATOR_H_

View File

@ -16,9 +16,7 @@
#include <utility>
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
Instruction::Instruction(spv::Op op, OperandList operands)
: op_(op), operands_(std::move(operands)) {}
@ -35,6 +33,4 @@ uint32_t Instruction::word_length() const {
return size;
}
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -20,9 +20,7 @@
#include "spirv/unified1/spirv.hpp11"
#include "src/tint/writer/spirv/operand.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
/// A single SPIR-V instruction
class Instruction {
@ -52,8 +50,6 @@ class Instruction {
/// A list of instructions
using InstructionList = std::vector<Instruction>;
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv
#endif // SRC_TINT_WRITER_SPIRV_INSTRUCTION_H_

View File

@ -16,9 +16,7 @@
#include "gtest/gtest.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using InstructionTest = testing::Test;
@ -47,6 +45,4 @@ TEST_F(InstructionTest, Length) {
}
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -14,9 +14,7 @@
#include "src/tint/writer/spirv/operand.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
// static
Operand Operand::Float(float val) {
@ -60,6 +58,4 @@ uint32_t Operand::length() const {
return val;
}
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -18,9 +18,7 @@
#include <string>
#include <vector>
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
/// A single SPIR-V instruction operand
class Operand {
@ -92,8 +90,6 @@ class Operand {
/// A list of operands
using OperandList = std::vector<Operand>;
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv
#endif // SRC_TINT_WRITER_SPIRV_OPERAND_H_

View File

@ -16,9 +16,7 @@
#include "gtest/gtest.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using OperandTest = testing::Test;
@ -62,6 +60,4 @@ TEST_F(OperandTest, Length_String_Empty) {
}
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -22,15 +22,12 @@
#include "src/tint/utils/hash.h"
namespace tint {
// Forward declarations
namespace sem {
namespace tint::sem {
class Call;
} // namespace sem
} // namespace tint::sem
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
/// ScalarConstant represents a scalar constant value
struct ScalarConstant {
@ -127,9 +124,7 @@ struct ScalarConstant {
uint32_t constant_id = 0;
};
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv
namespace std {

View File

@ -15,9 +15,7 @@
#include "src/tint/writer/spirv/scalar_constant.h"
#include "src/tint/writer/spirv/test_helper.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
using SpirvScalarConstantTest = TestHelper;
@ -55,6 +53,4 @@ TEST_F(SpirvScalarConstantTest, U32) {
}
} // namespace
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -17,9 +17,7 @@
#include "spirv-tools/libspirv.hpp"
#include "src/tint/writer/spirv/binary_writer.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
namespace {
std::string Disassemble(const std::vector<uint32_t>& data) {
@ -84,6 +82,4 @@ std::string DumpInstructions(const InstructionList& insts) {
return Disassemble(writer.result());
}
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv

View File

@ -20,9 +20,7 @@
#include "src/tint/writer/spirv/builder.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
/// Dumps the given builder to a SPIR-V disassembly string
/// @param builder the builder to convert
@ -39,8 +37,6 @@ std::string DumpInstruction(const Instruction& inst);
/// @returns the instruction as a SPIR-V disassembly string
std::string DumpInstructions(const InstructionList& insts);
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv
#endif // SRC_TINT_WRITER_SPIRV_SPV_DUMP_H_

View File

@ -23,9 +23,7 @@
#include "spirv-tools/libspirv.hpp"
#include "src/tint/writer/spirv/binary_writer.h"
namespace tint {
namespace writer {
namespace spirv {
namespace tint::writer::spirv {
/// Helper class for testing
template <typename BASE>
@ -132,8 +130,6 @@ using TestHelper = TestHelperBase<testing::Test>;
template <typename T>
using TestParamHelper = TestHelperBase<testing::TestWithParam<T>>;
} // namespace spirv
} // namespace writer
} // namespace tint
} // namespace tint::writer::spirv
#endif // SRC_TINT_WRITER_SPIRV_TEST_HELPER_H_