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 #include "src/writer/wgsl/generator.h" 16 #include "src/writer/wgsl/generator_impl.h" 17 18 namespace tint { 19 namespace writer { 20 namespace wgsl { 21 22 Result::Result() = default; 23 Result::~Result() = default; 24 Result::Result(const Result&) = default; 25 Generate(const Program * program,const Options &)26Result Generate(const Program* program, const Options&) { 27 Result result; 28 29 // Generate the WGSL code. 30 auto impl = std::make_unique<GeneratorImpl>(program); 31 result.success = impl->Generate(); 32 result.error = impl->error(); 33 result.wgsl = impl->result(); 34 35 return result; 36 } 37 38 } // namespace wgsl 39 } // namespace writer 40 } // namespace tint 41