Austin Eng | cc2516a | 2023-10-17 20:57:54 +0000 | [diff] [blame] | 1 | // Copyright 2020 The Dawn & Tint Authors |
James Price | 8f9ea96 | 2023-05-04 01:31:36 +0000 | [diff] [blame] | 2 | // |
Austin Eng | cc2516a | 2023-10-17 20:57:54 +0000 | [diff] [blame] | 3 | // Redistribution and use in source and binary forms, with or without |
| 4 | // modification, are permitted provided that the following conditions are met: |
James Price | 8f9ea96 | 2023-05-04 01:31:36 +0000 | [diff] [blame] | 5 | // |
Austin Eng | cc2516a | 2023-10-17 20:57:54 +0000 | [diff] [blame] | 6 | // 1. Redistributions of source code must retain the above copyright notice, this |
| 7 | // list of conditions and the following disclaimer. |
James Price | 8f9ea96 | 2023-05-04 01:31:36 +0000 | [diff] [blame] | 8 | // |
Austin Eng | cc2516a | 2023-10-17 20:57:54 +0000 | [diff] [blame] | 9 | // 2. Redistributions in binary form must reproduce the above copyright notice, |
| 10 | // this list of conditions and the following disclaimer in the documentation |
| 11 | // and/or other materials provided with the distribution. |
| 12 | // |
| 13 | // 3. Neither the name of the copyright holder nor the names of its |
| 14 | // contributors may be used to endorse or promote products derived from |
| 15 | // this software without specific prior written permission. |
| 16 | // |
| 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 20 | // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| 21 | // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 22 | // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 23 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 24 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 25 | // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
James Price | 8f9ea96 | 2023-05-04 01:31:36 +0000 | [diff] [blame] | 27 | |
James Price | 2280cc6 | 2023-07-21 03:42:48 +0000 | [diff] [blame] | 28 | #ifndef SRC_TINT_LANG_SPIRV_WRITER_WRITER_H_ |
| 29 | #define SRC_TINT_LANG_SPIRV_WRITER_WRITER_H_ |
James Price | 8f9ea96 | 2023-05-04 01:31:36 +0000 | [diff] [blame] | 30 | |
James Price | 85b138e | 2023-08-01 13:18:35 +0000 | [diff] [blame] | 31 | #include <string> |
| 32 | |
dan sinclair | 24b8109 | 2023-11-21 16:02:47 +0000 | [diff] [blame] | 33 | #include "src/tint/lang/core/ir/module.h" |
Ben Clayton | e95c77a | 2023-08-01 00:37:35 +0000 | [diff] [blame] | 34 | #include "src/tint/lang/spirv/writer/common/options.h" |
James Price | 85b138e | 2023-08-01 13:18:35 +0000 | [diff] [blame] | 35 | #include "src/tint/lang/spirv/writer/output.h" |
Ben Clayton | 16fb254 | 2023-09-25 11:43:19 +0000 | [diff] [blame] | 36 | #include "src/tint/utils/diagnostic/diagnostic.h" |
James Price | 85b138e | 2023-08-01 13:18:35 +0000 | [diff] [blame] | 37 | #include "src/tint/utils/result/result.h" |
James Price | 8f9ea96 | 2023-05-04 01:31:36 +0000 | [diff] [blame] | 38 | |
| 39 | // Forward declarations |
dan sinclair | 2dddb19 | 2023-07-26 20:31:48 +0000 | [diff] [blame] | 40 | namespace tint { |
| 41 | class Program; |
| 42 | } |
James Price | 8f9ea96 | 2023-05-04 01:31:36 +0000 | [diff] [blame] | 43 | |
dan sinclair | 2dddb19 | 2023-07-26 20:31:48 +0000 | [diff] [blame] | 44 | namespace tint::spirv::writer { |
James Price | 8f9ea96 | 2023-05-04 01:31:36 +0000 | [diff] [blame] | 45 | |
dan sinclair | 2dddb19 | 2023-07-26 20:31:48 +0000 | [diff] [blame] | 46 | /// Generate SPIR-V for a program, according to a set of configuration options. |
Ben Clayton | 16fb254 | 2023-09-25 11:43:19 +0000 | [diff] [blame] | 47 | /// The result will contain the SPIR-V or failure. |
dan sinclair | 24b8109 | 2023-11-21 16:02:47 +0000 | [diff] [blame] | 48 | /// @param ir the IR module to translate to SPIR-V |
| 49 | /// @param options the configuration options to use when generating SPIR-V |
| 50 | /// @returns the resulting SPIR-V and supplementary information, or failure. |
| 51 | Result<Output> Generate(core::ir::Module& ir, const Options& options); |
| 52 | |
| 53 | /// Generate SPIR-V for a program, according to a set of configuration options. |
| 54 | /// The result will contain the SPIR-V or failure. |
dan sinclair | 2dddb19 | 2023-07-26 20:31:48 +0000 | [diff] [blame] | 55 | /// @param program the program to translate to SPIR-V |
| 56 | /// @param options the configuration options to use when generating SPIR-V |
Ben Clayton | 16fb254 | 2023-09-25 11:43:19 +0000 | [diff] [blame] | 57 | /// @returns the resulting SPIR-V and supplementary information, or failure. |
| 58 | Result<Output> Generate(const Program& program, const Options& options); |
James Price | 8f9ea96 | 2023-05-04 01:31:36 +0000 | [diff] [blame] | 59 | |
dan sinclair | 2dddb19 | 2023-07-26 20:31:48 +0000 | [diff] [blame] | 60 | } // namespace tint::spirv::writer |
James Price | 8f9ea96 | 2023-05-04 01:31:36 +0000 | [diff] [blame] | 61 | |
James Price | 2280cc6 | 2023-07-21 03:42:48 +0000 | [diff] [blame] | 62 | #endif // SRC_TINT_LANG_SPIRV_WRITER_WRITER_H_ |