diff options
author | Steven Perron <stevenperron@google.com> | 2017-12-19 14:18:13 -0500 |
---|---|---|
committer | David Neto <dneto@google.com> | 2017-12-21 11:14:53 -0500 |
commit | 756b277fb826675f0356995f975bd7da1cacc23d (patch) | |
tree | e3d1d7f40936760dbb8bcc7e7c2cb00e79442597 /test/opt/instruction_test.cpp | |
parent | 8e0051c78188371293377b0cac482c6f366a9813 (diff) | |
download | spirv-tools-756b277fb826675f0356995f975bd7da1cacc23d.tar.gz |
Store all enabled capabilities in the feature manger.
In order to keep track of all of the implicit capabilities as well as
the explicit ones, we will add them all to the feature manager. That is
the object that needs to be queried when checking if a capability is
enabled.
The name of the "HasCapability" function in the module was changed to
make it more obvious that it does not check for implied capabilities.
Keep an spv_context and AssemblyGrammar in IRContext
Diffstat (limited to 'test/opt/instruction_test.cpp')
-rw-r--r-- | test/opt/instruction_test.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/test/opt/instruction_test.cpp b/test/opt/instruction_test.cpp index aa457ca9..a39fa1b3 100644 --- a/test/opt/instruction_test.cpp +++ b/test/opt/instruction_test.cpp @@ -46,7 +46,7 @@ TEST(InstructionTest, CreateTrivial) { } TEST(InstructionTest, CreateWithOpcodeAndNoOperands) { - IRContext context(nullptr); + IRContext context(SPV_ENV_UNIVERSAL_1_2, nullptr); Instruction inst(&context, SpvOpReturn); EXPECT_EQ(SpvOpReturn, inst.opcode()); EXPECT_EQ(0u, inst.type_id()); @@ -127,7 +127,7 @@ spv_parsed_instruction_t kSampleControlBarrierInstruction = { 3}; TEST(InstructionTest, CreateWithOpcodeAndOperands) { - IRContext context(nullptr); + IRContext context(SPV_ENV_UNIVERSAL_1_2, nullptr); Instruction inst(&context, kSampleParsedInstruction); EXPECT_EQ(SpvOpTypeInt, inst.opcode()); EXPECT_EQ(0u, inst.type_id()); @@ -138,7 +138,7 @@ TEST(InstructionTest, CreateWithOpcodeAndOperands) { } TEST(InstructionTest, GetOperand) { - IRContext context(nullptr); + IRContext context(SPV_ENV_UNIVERSAL_1_2, nullptr); Instruction inst(&context, kSampleParsedInstruction); EXPECT_THAT(inst.GetOperand(0).words, Eq(std::vector<uint32_t>{44})); EXPECT_THAT(inst.GetOperand(1).words, Eq(std::vector<uint32_t>{32})); @@ -146,14 +146,14 @@ TEST(InstructionTest, GetOperand) { } TEST(InstructionTest, GetInOperand) { - IRContext context(nullptr); + IRContext context(SPV_ENV_UNIVERSAL_1_2, nullptr); Instruction inst(&context, kSampleParsedInstruction); EXPECT_THAT(inst.GetInOperand(0).words, Eq(std::vector<uint32_t>{32})); EXPECT_THAT(inst.GetInOperand(1).words, Eq(std::vector<uint32_t>{1})); } TEST(InstructionTest, OperandConstIterators) { - IRContext context(nullptr); + IRContext context(SPV_ENV_UNIVERSAL_1_2, nullptr); Instruction inst(&context, kSampleParsedInstruction); // Spot check iteration across operands. auto cbegin = inst.cbegin(); @@ -180,7 +180,7 @@ TEST(InstructionTest, OperandConstIterators) { } TEST(InstructionTest, OperandIterators) { - IRContext context(nullptr); + IRContext context(SPV_ENV_UNIVERSAL_1_2, nullptr); Instruction inst(&context, kSampleParsedInstruction); // Spot check iteration across operands, with mutable iterators. auto begin = inst.begin(); @@ -211,7 +211,7 @@ TEST(InstructionTest, OperandIterators) { } TEST(InstructionTest, ForInIdStandardIdTypes) { - IRContext context(nullptr); + IRContext context(SPV_ENV_UNIVERSAL_1_2, nullptr); Instruction inst(&context, kSampleAccessChainInstruction); std::vector<uint32_t> ids; @@ -224,7 +224,7 @@ TEST(InstructionTest, ForInIdStandardIdTypes) { } TEST(InstructionTest, ForInIdNonstandardIdTypes) { - IRContext context(nullptr); + IRContext context(SPV_ENV_UNIVERSAL_1_2, nullptr); Instruction inst(&context, kSampleControlBarrierInstruction); std::vector<uint32_t> ids; @@ -237,14 +237,14 @@ TEST(InstructionTest, ForInIdNonstandardIdTypes) { } TEST(InstructionTest, UniqueIds) { - IRContext context(nullptr); + IRContext context(SPV_ENV_UNIVERSAL_1_2, nullptr); Instruction inst1(&context); Instruction inst2(&context); EXPECT_NE(inst1.unique_id(), inst2.unique_id()); } TEST(InstructionTest, CloneUniqueIdDifferent) { - IRContext context(nullptr); + IRContext context(SPV_ENV_UNIVERSAL_1_2, nullptr); Instruction inst(&context); std::unique_ptr<Instruction> clone(inst.Clone(&context)); EXPECT_EQ(inst.context(), clone->context()); @@ -252,8 +252,8 @@ TEST(InstructionTest, CloneUniqueIdDifferent) { } TEST(InstructionTest, CloneDifferentContext) { - IRContext c1(nullptr); - IRContext c2(nullptr); + IRContext c1(SPV_ENV_UNIVERSAL_1_2, nullptr); + IRContext c2(SPV_ENV_UNIVERSAL_1_2, nullptr); Instruction inst(&c1); std::unique_ptr<Instruction> clone(inst.Clone(&c2)); EXPECT_EQ(&c1, inst.context()); @@ -262,8 +262,8 @@ TEST(InstructionTest, CloneDifferentContext) { } TEST(InstructionTest, CloneDifferentContextDifferentUniqueId) { - IRContext c1(nullptr); - IRContext c2(nullptr); + IRContext c1(SPV_ENV_UNIVERSAL_1_2, nullptr); + IRContext c2(SPV_ENV_UNIVERSAL_1_2, nullptr); Instruction inst(&c1); Instruction other(&c2); std::unique_ptr<Instruction> clone(inst.Clone(&c2)); @@ -272,7 +272,7 @@ TEST(InstructionTest, CloneDifferentContextDifferentUniqueId) { } TEST(InstructionTest, EqualsEqualsOperator) { - IRContext context(nullptr); + IRContext context(SPV_ENV_UNIVERSAL_1_2, nullptr); Instruction i1(&context); Instruction i2(&context); std::unique_ptr<Instruction> clone(i1.Clone(&context)); @@ -283,7 +283,7 @@ TEST(InstructionTest, EqualsEqualsOperator) { } TEST(InstructionTest, LessThanOperator) { - IRContext context(nullptr); + IRContext context(SPV_ENV_UNIVERSAL_1_2, nullptr); Instruction i1(&context); Instruction i2(&context); std::unique_ptr<Instruction> clone(i1.Clone(&context)); |