gallium: rename 'state tracker' to 'frontend'
[mesa.git] / src / gallium / frontends / clover / spirv / invocation.hpp
1 //
2 // Copyright 2018 Pierre Moreau
3 //
4 // Permission is hereby granted, free of charge, to any person obtaining a
5 // copy of this software and associated documentation files (the "Software"),
6 // to deal in the Software without restriction, including without limitation
7 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 // and/or sell copies of the Software, and to permit persons to whom the
9 // Software is furnished to do so, subject to the following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included in
12 // all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 // OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 // OTHER DEALINGS IN THE SOFTWARE.
21 //
22
23 #ifndef CLOVER_SPIRV_INVOCATION_HPP
24 #define CLOVER_SPIRV_INVOCATION_HPP
25
26 #include "core/context.hpp"
27 #include "core/module.hpp"
28 #include "core/program.hpp"
29
30 namespace clover {
31 namespace spirv {
32 // Returns whether the given binary is considered valid for the given
33 // OpenCL version.
34 //
35 // It uses SPIRV-Tools validator to do the validation, and potential
36 // warnings and errors are appended to |r_log|.
37 bool is_valid_spirv(const std::vector<char> &binary,
38 const std::string &opencl_version,
39 std::string &r_log);
40
41 // Creates a clover module out of the given SPIR-V binary.
42 module compile_program(const std::vector<char> &binary,
43 const device &dev, std::string &r_log);
44
45 // Combines multiple clover modules into a single one, resolving
46 // link dependencies between them.
47 module link_program(const std::vector<module> &modules, const device &dev,
48 const std::string &opts, std::string &r_log);
49
50 // Returns a textual representation of the given binary.
51 std::string print_module(const std::vector<char> &binary,
52 const std::string &opencl_version);
53 }
54 }
55
56 #endif