1 // Copyright 2018 The Amber 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_EXECUTOR_H_ 16 #define SRC_EXECUTOR_H_ 17 18 #include "amber/amber.h" 19 #include "amber/result.h" 20 #include "src/engine.h" 21 #include "src/script.h" 22 #include "src/verifier.h" 23 24 namespace amber { 25 26 /// The executor is responsible for running the given script against an engine. 27 class Executor { 28 public: 29 /// Create a new executor. 30 Executor(); 31 ~Executor(); 32 33 /// Executes |script| against |engine|. For each shader described in |script| 34 /// if the shader name exists in |map| the value for that map'd key will be 35 /// used as the shader binary. 36 Result Execute(Engine* engine, 37 const Script* script, 38 const ShaderMap& map, 39 Options* options, 40 Delegate* delegate); 41 42 private: 43 Result CompileShaders(const Script* script, 44 const ShaderMap& shader_map, 45 Options* options); 46 Result ExecuteCommand(Engine* engine, Command* cmd); 47 48 Verifier verifier_; 49 }; 50 51 } // namespace amber 52 53 #endif // SRC_EXECUTOR_H_ 54