text_to_binary.annotation_test.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  1. // Copyright (c) 2015-2016 The Khronos Group Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. // Assembler tests for instructions in the "Annotation" section of the
  15. // SPIR-V spec.
  16. #include <sstream>
  17. #include <string>
  18. #include <tuple>
  19. #include <vector>
  20. #include "gmock/gmock.h"
  21. #include "test/test_fixture.h"
  22. #include "test/unit_spirv.h"
  23. namespace spvtools {
  24. namespace {
  25. using spvtest::EnumCase;
  26. using spvtest::MakeInstruction;
  27. using spvtest::MakeVector;
  28. using spvtest::TextToBinaryTest;
  29. using ::testing::Combine;
  30. using ::testing::Eq;
  31. using ::testing::Values;
  32. using ::testing::ValuesIn;
  33. // Test OpDecorate
  34. using OpDecorateSimpleTest =
  35. spvtest::TextToBinaryTestBase<::testing::TestWithParam<
  36. std::tuple<spv_target_env, EnumCase<SpvDecoration>>>>;
  37. TEST_P(OpDecorateSimpleTest, AnySimpleDecoration) {
  38. // This string should assemble, but should not validate.
  39. std::stringstream input;
  40. input << "OpDecorate %1 " << std::get<1>(GetParam()).name();
  41. for (auto operand : std::get<1>(GetParam()).operands())
  42. input << " " << operand;
  43. input << std::endl;
  44. EXPECT_THAT(CompiledInstructions(input.str(), std::get<0>(GetParam())),
  45. Eq(MakeInstruction(SpvOpDecorate,
  46. {1, uint32_t(std::get<1>(GetParam()).value())},
  47. std::get<1>(GetParam()).operands())));
  48. // Also check disassembly.
  49. EXPECT_THAT(
  50. EncodeAndDecodeSuccessfully(input.str(), SPV_BINARY_TO_TEXT_OPTION_NONE,
  51. std::get<0>(GetParam())),
  52. Eq(input.str()));
  53. }
  54. #define CASE(NAME) SpvDecoration##NAME, #NAME
  55. INSTANTIATE_TEST_SUITE_P(
  56. TextToBinaryDecorateSimple, OpDecorateSimpleTest,
  57. Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1),
  58. ValuesIn(std::vector<EnumCase<SpvDecoration>>{
  59. // The operand literal values are arbitrarily chosen,
  60. // but there are the right number of them.
  61. {CASE(RelaxedPrecision), {}},
  62. {CASE(SpecId), {100}},
  63. {CASE(Block), {}},
  64. {CASE(BufferBlock), {}},
  65. {CASE(RowMajor), {}},
  66. {CASE(ColMajor), {}},
  67. {CASE(ArrayStride), {4}},
  68. {CASE(MatrixStride), {16}},
  69. {CASE(GLSLShared), {}},
  70. {CASE(GLSLPacked), {}},
  71. {CASE(CPacked), {}},
  72. // Placeholder line for enum value 12
  73. {CASE(NoPerspective), {}},
  74. {CASE(Flat), {}},
  75. {CASE(Patch), {}},
  76. {CASE(Centroid), {}},
  77. {CASE(Sample), {}},
  78. {CASE(Invariant), {}},
  79. {CASE(Restrict), {}},
  80. {CASE(Aliased), {}},
  81. {CASE(Volatile), {}},
  82. {CASE(Constant), {}},
  83. {CASE(Coherent), {}},
  84. {CASE(NonWritable), {}},
  85. {CASE(NonReadable), {}},
  86. {CASE(Uniform), {}},
  87. {CASE(SaturatedConversion), {}},
  88. {CASE(Stream), {2}},
  89. {CASE(Location), {6}},
  90. {CASE(Component), {3}},
  91. {CASE(Index), {14}},
  92. {CASE(Binding), {19}},
  93. {CASE(DescriptorSet), {7}},
  94. {CASE(Offset), {12}},
  95. {CASE(XfbBuffer), {1}},
  96. {CASE(XfbStride), {8}},
  97. {CASE(NoContraction), {}},
  98. {CASE(InputAttachmentIndex), {102}},
  99. {CASE(Alignment), {16}},
  100. })));
  101. INSTANTIATE_TEST_SUITE_P(TextToBinaryDecorateSimpleV11, OpDecorateSimpleTest,
  102. Combine(Values(SPV_ENV_UNIVERSAL_1_1),
  103. Values(EnumCase<SpvDecoration>{
  104. CASE(MaxByteOffset), {128}})));
  105. #undef CASE
  106. TEST_F(OpDecorateSimpleTest, WrongDecoration) {
  107. EXPECT_THAT(CompileFailure("OpDecorate %1 xxyyzz"),
  108. Eq("Invalid decoration 'xxyyzz'."));
  109. }
  110. TEST_F(OpDecorateSimpleTest, ExtraOperandsOnDecorationExpectingNone) {
  111. EXPECT_THAT(CompileFailure("OpDecorate %1 RelaxedPrecision 99"),
  112. Eq("Expected <opcode> or <result-id> at the beginning of an "
  113. "instruction, found '99'."));
  114. }
  115. TEST_F(OpDecorateSimpleTest, ExtraOperandsOnDecorationExpectingOne) {
  116. EXPECT_THAT(CompileFailure("OpDecorate %1 SpecId 99 100"),
  117. Eq("Expected <opcode> or <result-id> at the beginning of an "
  118. "instruction, found '100'."));
  119. }
  120. TEST_F(OpDecorateSimpleTest, ExtraOperandsOnDecorationExpectingTwo) {
  121. EXPECT_THAT(
  122. CompileFailure("OpDecorate %1 LinkageAttributes \"abc\" Import 42"),
  123. Eq("Expected <opcode> or <result-id> at the beginning of an "
  124. "instruction, found '42'."));
  125. }
  126. // A single test case for an enum decoration.
  127. struct DecorateEnumCase {
  128. // Place the enum value first, so it's easier to read the binary dumps when
  129. // the test fails.
  130. uint32_t value; // The value within the enum, e.g. Position
  131. std::string name;
  132. uint32_t enum_value; // Which enum, e.g. BuiltIn
  133. std::string enum_name;
  134. };
  135. using OpDecorateEnumTest =
  136. spvtest::TextToBinaryTestBase<::testing::TestWithParam<DecorateEnumCase>>;
  137. TEST_P(OpDecorateEnumTest, AnyEnumDecoration) {
  138. // This string should assemble, but should not validate.
  139. const std::string input =
  140. "OpDecorate %1 " + GetParam().enum_name + " " + GetParam().name;
  141. EXPECT_THAT(CompiledInstructions(input),
  142. Eq(MakeInstruction(SpvOpDecorate, {1, GetParam().enum_value,
  143. GetParam().value})));
  144. }
  145. // Test OpDecorate BuiltIn.
  146. // clang-format off
  147. #define CASE(NAME) \
  148. { SpvBuiltIn##NAME, #NAME, SpvDecorationBuiltIn, "BuiltIn" }
  149. INSTANTIATE_TEST_SUITE_P(TextToBinaryDecorateBuiltIn, OpDecorateEnumTest,
  150. ::testing::ValuesIn(std::vector<DecorateEnumCase>{
  151. CASE(Position),
  152. CASE(PointSize),
  153. CASE(ClipDistance),
  154. CASE(CullDistance),
  155. CASE(VertexId),
  156. CASE(InstanceId),
  157. CASE(PrimitiveId),
  158. CASE(InvocationId),
  159. CASE(Layer),
  160. CASE(ViewportIndex),
  161. CASE(TessLevelOuter),
  162. CASE(TessLevelInner),
  163. CASE(TessCoord),
  164. CASE(PatchVertices),
  165. CASE(FragCoord),
  166. CASE(PointCoord),
  167. CASE(FrontFacing),
  168. CASE(SampleId),
  169. CASE(SamplePosition),
  170. CASE(SampleMask),
  171. // Value 21 intentionally missing.
  172. CASE(FragDepth),
  173. CASE(HelperInvocation),
  174. CASE(NumWorkgroups),
  175. CASE(WorkgroupSize),
  176. CASE(WorkgroupId),
  177. CASE(LocalInvocationId),
  178. CASE(GlobalInvocationId),
  179. CASE(LocalInvocationIndex),
  180. CASE(WorkDim),
  181. CASE(GlobalSize),
  182. CASE(EnqueuedWorkgroupSize),
  183. CASE(GlobalOffset),
  184. CASE(GlobalLinearId),
  185. // Value 35 intentionally missing.
  186. CASE(SubgroupSize),
  187. CASE(SubgroupMaxSize),
  188. CASE(NumSubgroups),
  189. CASE(NumEnqueuedSubgroups),
  190. CASE(SubgroupId),
  191. CASE(SubgroupLocalInvocationId),
  192. CASE(VertexIndex),
  193. CASE(InstanceIndex),
  194. }));
  195. #undef CASE
  196. // clang-format on
  197. TEST_F(OpDecorateEnumTest, WrongBuiltIn) {
  198. EXPECT_THAT(CompileFailure("OpDecorate %1 BuiltIn xxyyzz"),
  199. Eq("Invalid built-in 'xxyyzz'."));
  200. }
  201. // Test OpDecorate FuncParamAttr
  202. // clang-format off
  203. #define CASE(NAME) \
  204. { SpvFunctionParameterAttribute##NAME, #NAME, SpvDecorationFuncParamAttr, "FuncParamAttr" }
  205. INSTANTIATE_TEST_SUITE_P(TextToBinaryDecorateFuncParamAttr, OpDecorateEnumTest,
  206. ::testing::ValuesIn(std::vector<DecorateEnumCase>{
  207. CASE(Zext),
  208. CASE(Sext),
  209. CASE(ByVal),
  210. CASE(Sret),
  211. CASE(NoAlias),
  212. CASE(NoCapture),
  213. CASE(NoWrite),
  214. CASE(NoReadWrite),
  215. }));
  216. #undef CASE
  217. // clang-format on
  218. TEST_F(OpDecorateEnumTest, WrongFuncParamAttr) {
  219. EXPECT_THAT(CompileFailure("OpDecorate %1 FuncParamAttr xxyyzz"),
  220. Eq("Invalid function parameter attribute 'xxyyzz'."));
  221. }
  222. // Test OpDecorate FPRoundingMode
  223. // clang-format off
  224. #define CASE(NAME) \
  225. { SpvFPRoundingMode##NAME, #NAME, SpvDecorationFPRoundingMode, "FPRoundingMode" }
  226. INSTANTIATE_TEST_SUITE_P(TextToBinaryDecorateFPRoundingMode, OpDecorateEnumTest,
  227. ::testing::ValuesIn(std::vector<DecorateEnumCase>{
  228. CASE(RTE),
  229. CASE(RTZ),
  230. CASE(RTP),
  231. CASE(RTN),
  232. }));
  233. #undef CASE
  234. // clang-format on
  235. TEST_F(OpDecorateEnumTest, WrongFPRoundingMode) {
  236. EXPECT_THAT(CompileFailure("OpDecorate %1 FPRoundingMode xxyyzz"),
  237. Eq("Invalid floating-point rounding mode 'xxyyzz'."));
  238. }
  239. // Test OpDecorate FPFastMathMode.
  240. // These can by named enums for the single-bit masks. However, we don't support
  241. // symbolic combinations of the masks. Rather, they can use !<immediate>
  242. // syntax, e.g. !0x3
  243. // clang-format off
  244. #define CASE(ENUM,NAME) \
  245. { SpvFPFastMathMode##ENUM, #NAME, SpvDecorationFPFastMathMode, "FPFastMathMode" }
  246. INSTANTIATE_TEST_SUITE_P(TextToBinaryDecorateFPFastMathMode, OpDecorateEnumTest,
  247. ::testing::ValuesIn(std::vector<DecorateEnumCase>{
  248. CASE(MaskNone, None),
  249. CASE(NotNaNMask, NotNaN),
  250. CASE(NotInfMask, NotInf),
  251. CASE(NSZMask, NSZ),
  252. CASE(AllowRecipMask, AllowRecip),
  253. CASE(FastMask, Fast),
  254. }));
  255. #undef CASE
  256. // clang-format on
  257. TEST_F(OpDecorateEnumTest, CombinedFPFastMathMask) {
  258. // Sample a single combination. This ensures we've integrated
  259. // the instruction parsing logic with spvTextParseMask.
  260. const std::string input = "OpDecorate %1 FPFastMathMode NotNaN|NotInf|NSZ";
  261. const uint32_t expected_enum = SpvDecorationFPFastMathMode;
  262. const uint32_t expected_mask = SpvFPFastMathModeNotNaNMask |
  263. SpvFPFastMathModeNotInfMask |
  264. SpvFPFastMathModeNSZMask;
  265. EXPECT_THAT(
  266. CompiledInstructions(input),
  267. Eq(MakeInstruction(SpvOpDecorate, {1, expected_enum, expected_mask})));
  268. }
  269. TEST_F(OpDecorateEnumTest, WrongFPFastMathMode) {
  270. EXPECT_THAT(
  271. CompileFailure("OpDecorate %1 FPFastMathMode NotNaN|xxyyzz"),
  272. Eq("Invalid floating-point fast math mode operand 'NotNaN|xxyyzz'."));
  273. }
  274. // Test OpDecorate Linkage
  275. // A single test case for a linkage
  276. struct DecorateLinkageCase {
  277. uint32_t linkage_type_value;
  278. std::string linkage_type_name;
  279. std::string external_name;
  280. };
  281. using OpDecorateLinkageTest = spvtest::TextToBinaryTestBase<
  282. ::testing::TestWithParam<DecorateLinkageCase>>;
  283. TEST_P(OpDecorateLinkageTest, AnyLinkageDecoration) {
  284. // This string should assemble, but should not validate.
  285. const std::string input = "OpDecorate %1 LinkageAttributes \"" +
  286. GetParam().external_name + "\" " +
  287. GetParam().linkage_type_name;
  288. std::vector<uint32_t> expected_operands{1, SpvDecorationLinkageAttributes};
  289. std::vector<uint32_t> encoded_external_name =
  290. MakeVector(GetParam().external_name);
  291. expected_operands.insert(expected_operands.end(),
  292. encoded_external_name.begin(),
  293. encoded_external_name.end());
  294. expected_operands.push_back(GetParam().linkage_type_value);
  295. EXPECT_THAT(CompiledInstructions(input),
  296. Eq(MakeInstruction(SpvOpDecorate, expected_operands)));
  297. }
  298. // clang-format off
  299. #define CASE(ENUM) SpvLinkageType##ENUM, #ENUM
  300. INSTANTIATE_TEST_SUITE_P(TextToBinaryDecorateLinkage, OpDecorateLinkageTest,
  301. ::testing::ValuesIn(std::vector<DecorateLinkageCase>{
  302. { CASE(Import), "a" },
  303. { CASE(Export), "foo" },
  304. { CASE(Import), "some kind of long name with spaces etc." },
  305. // TODO(dneto): utf-8, escaping, quoting cases.
  306. }));
  307. #undef CASE
  308. // clang-format on
  309. TEST_F(OpDecorateLinkageTest, WrongType) {
  310. EXPECT_THAT(CompileFailure("OpDecorate %1 LinkageAttributes \"foo\" xxyyzz"),
  311. Eq("Invalid linkage type 'xxyyzz'."));
  312. }
  313. // Test OpGroupMemberDecorate
  314. TEST_F(TextToBinaryTest, GroupMemberDecorateGoodOneTarget) {
  315. EXPECT_THAT(CompiledInstructions("OpGroupMemberDecorate %group %id0 42"),
  316. Eq(MakeInstruction(SpvOpGroupMemberDecorate, {1, 2, 42})));
  317. }
  318. TEST_F(TextToBinaryTest, GroupMemberDecorateGoodTwoTargets) {
  319. EXPECT_THAT(
  320. CompiledInstructions("OpGroupMemberDecorate %group %id0 96 %id1 42"),
  321. Eq(MakeInstruction(SpvOpGroupMemberDecorate, {1, 2, 96, 3, 42})));
  322. }
  323. TEST_F(TextToBinaryTest, GroupMemberDecorateMissingGroupId) {
  324. EXPECT_THAT(CompileFailure("OpGroupMemberDecorate"),
  325. Eq("Expected operand, found end of stream."));
  326. }
  327. TEST_F(TextToBinaryTest, GroupMemberDecorateInvalidGroupId) {
  328. EXPECT_THAT(CompileFailure("OpGroupMemberDecorate 16"),
  329. Eq("Expected id to start with %."));
  330. }
  331. TEST_F(TextToBinaryTest, GroupMemberDecorateInvalidTargetId) {
  332. EXPECT_THAT(CompileFailure("OpGroupMemberDecorate %group 12"),
  333. Eq("Expected id to start with %."));
  334. }
  335. TEST_F(TextToBinaryTest, GroupMemberDecorateMissingTargetMemberNumber) {
  336. EXPECT_THAT(CompileFailure("OpGroupMemberDecorate %group %id0"),
  337. Eq("Expected operand, found end of stream."));
  338. }
  339. TEST_F(TextToBinaryTest, GroupMemberDecorateInvalidTargetMemberNumber) {
  340. EXPECT_THAT(CompileFailure("OpGroupMemberDecorate %group %id0 %id1"),
  341. Eq("Invalid unsigned integer literal: %id1"));
  342. }
  343. TEST_F(TextToBinaryTest, GroupMemberDecorateInvalidSecondTargetId) {
  344. EXPECT_THAT(CompileFailure("OpGroupMemberDecorate %group %id1 42 12"),
  345. Eq("Expected id to start with %."));
  346. }
  347. TEST_F(TextToBinaryTest, GroupMemberDecorateMissingSecondTargetMemberNumber) {
  348. EXPECT_THAT(CompileFailure("OpGroupMemberDecorate %group %id0 42 %id1"),
  349. Eq("Expected operand, found end of stream."));
  350. }
  351. TEST_F(TextToBinaryTest, GroupMemberDecorateInvalidSecondTargetMemberNumber) {
  352. EXPECT_THAT(CompileFailure("OpGroupMemberDecorate %group %id0 42 %id1 %id2"),
  353. Eq("Invalid unsigned integer literal: %id2"));
  354. }
  355. // Test OpMemberDecorate
  356. using OpMemberDecorateSimpleTest =
  357. spvtest::TextToBinaryTestBase<::testing::TestWithParam<
  358. std::tuple<spv_target_env, EnumCase<SpvDecoration>>>>;
  359. TEST_P(OpMemberDecorateSimpleTest, AnySimpleDecoration) {
  360. // This string should assemble, but should not validate.
  361. std::stringstream input;
  362. input << "OpMemberDecorate %1 42 " << std::get<1>(GetParam()).name();
  363. for (auto operand : std::get<1>(GetParam()).operands())
  364. input << " " << operand;
  365. input << std::endl;
  366. EXPECT_THAT(
  367. CompiledInstructions(input.str(), std::get<0>(GetParam())),
  368. Eq(MakeInstruction(SpvOpMemberDecorate,
  369. {1, 42, uint32_t(std::get<1>(GetParam()).value())},
  370. std::get<1>(GetParam()).operands())));
  371. // Also check disassembly.
  372. EXPECT_THAT(
  373. EncodeAndDecodeSuccessfully(input.str(), SPV_BINARY_TO_TEXT_OPTION_NONE,
  374. std::get<0>(GetParam())),
  375. Eq(input.str()));
  376. }
  377. #define CASE(NAME) SpvDecoration##NAME, #NAME
  378. INSTANTIATE_TEST_SUITE_P(
  379. TextToBinaryDecorateSimple, OpMemberDecorateSimpleTest,
  380. Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1),
  381. ValuesIn(std::vector<EnumCase<SpvDecoration>>{
  382. // The operand literal values are arbitrarily chosen,
  383. // but there are the right number of them.
  384. {CASE(RelaxedPrecision), {}},
  385. {CASE(SpecId), {100}},
  386. {CASE(Block), {}},
  387. {CASE(BufferBlock), {}},
  388. {CASE(RowMajor), {}},
  389. {CASE(ColMajor), {}},
  390. {CASE(ArrayStride), {4}},
  391. {CASE(MatrixStride), {16}},
  392. {CASE(GLSLShared), {}},
  393. {CASE(GLSLPacked), {}},
  394. {CASE(CPacked), {}},
  395. // Placeholder line for enum value 12
  396. {CASE(NoPerspective), {}},
  397. {CASE(Flat), {}},
  398. {CASE(Patch), {}},
  399. {CASE(Centroid), {}},
  400. {CASE(Sample), {}},
  401. {CASE(Invariant), {}},
  402. {CASE(Restrict), {}},
  403. {CASE(Aliased), {}},
  404. {CASE(Volatile), {}},
  405. {CASE(Constant), {}},
  406. {CASE(Coherent), {}},
  407. {CASE(NonWritable), {}},
  408. {CASE(NonReadable), {}},
  409. {CASE(Uniform), {}},
  410. {CASE(SaturatedConversion), {}},
  411. {CASE(Stream), {2}},
  412. {CASE(Location), {6}},
  413. {CASE(Component), {3}},
  414. {CASE(Index), {14}},
  415. {CASE(Binding), {19}},
  416. {CASE(DescriptorSet), {7}},
  417. {CASE(Offset), {12}},
  418. {CASE(XfbBuffer), {1}},
  419. {CASE(XfbStride), {8}},
  420. {CASE(NoContraction), {}},
  421. {CASE(InputAttachmentIndex), {102}},
  422. {CASE(Alignment), {16}},
  423. })));
  424. INSTANTIATE_TEST_SUITE_P(
  425. TextToBinaryDecorateSimpleV11, OpMemberDecorateSimpleTest,
  426. Combine(Values(SPV_ENV_UNIVERSAL_1_1),
  427. Values(EnumCase<SpvDecoration>{CASE(MaxByteOffset), {128}})));
  428. #undef CASE
  429. TEST_F(OpMemberDecorateSimpleTest, WrongDecoration) {
  430. EXPECT_THAT(CompileFailure("OpMemberDecorate %1 9 xxyyzz"),
  431. Eq("Invalid decoration 'xxyyzz'."));
  432. }
  433. TEST_F(OpMemberDecorateSimpleTest, ExtraOperandsOnDecorationExpectingNone) {
  434. EXPECT_THAT(CompileFailure("OpMemberDecorate %1 12 RelaxedPrecision 99"),
  435. Eq("Expected <opcode> or <result-id> at the beginning of an "
  436. "instruction, found '99'."));
  437. }
  438. TEST_F(OpMemberDecorateSimpleTest, ExtraOperandsOnDecorationExpectingOne) {
  439. EXPECT_THAT(CompileFailure("OpMemberDecorate %1 0 SpecId 99 100"),
  440. Eq("Expected <opcode> or <result-id> at the beginning of an "
  441. "instruction, found '100'."));
  442. }
  443. TEST_F(OpMemberDecorateSimpleTest, ExtraOperandsOnDecorationExpectingTwo) {
  444. EXPECT_THAT(CompileFailure(
  445. "OpMemberDecorate %1 1 LinkageAttributes \"abc\" Import 42"),
  446. Eq("Expected <opcode> or <result-id> at the beginning of an "
  447. "instruction, found '42'."));
  448. }
  449. // TODO(dneto): OpMemberDecorate cases for decorations with parameters which
  450. // are: not just lists of literal numbers.
  451. // TODO(dneto): OpDecorationGroup
  452. // TODO(dneto): OpGroupDecorate
  453. } // namespace
  454. } // namespace spvtools