• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 The Tint Authors
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 
15 #ifndef SRC_READER_SPIRV_SPIRV_TOOLS_HELPERS_TEST_H_
16 #define SRC_READER_SPIRV_SPIRV_TOOLS_HELPERS_TEST_H_
17 
18 #include <string>
19 #include <vector>
20 
21 namespace tint {
22 namespace reader {
23 namespace spirv {
24 namespace test {
25 
26 /// @param spirv_assembly SPIR-V assembly text
27 /// @returns the SPIR-V module assembled from the given text.  Numeric IDs
28 /// are preserved.
29 std::vector<uint32_t> Assemble(const std::string& spirv_assembly);
30 
31 /// Attempts to assemble given SPIR-V assembly text.  Expect it to fail.
32 /// @param spirv_assembly the SPIR-V assembly
33 /// @returns the failure message.
34 std::string AssembleFailure(const std::string& spirv_assembly);
35 
36 /// @param spirv_module a SPIR-V binary module
37 /// @returns the disassembled module
38 std::string Disassemble(const std::vector<uint32_t>& spirv_module);
39 
40 }  // namespace test
41 }  // namespace spirv
42 }  // namespace reader
43 }  // namespace tint
44 
45 #endif  // SRC_READER_SPIRV_SPIRV_TOOLS_HELPERS_TEST_H_
46