dan sinclair | 70d430c | 2018-09-28 16:12:38 -0400 | [diff] [blame] | 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 | #include "src/engine.h" |
| 16 | |
| 17 | #include "src/make_unique.h" |
| 18 | |
| 19 | #if AMBER_ENGINE_VULKAN |
| 20 | #pragma clang diagnostic push |
| 21 | #pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" |
| 22 | #include "src/vulkan/engine_vulkan.h" |
| 23 | #pragma clang diagnostic pop |
| 24 | #endif // AMBER_ENGINE_VULKAN |
| 25 | |
David Neto | ef2bc0a | 2018-11-12 13:52:31 +0000 | [diff] [blame] | 26 | #if AMBER_ENGINE_DAWN |
| 27 | #include "src/dawn/engine_dawn.h" |
| 28 | #endif // AMBER_ENGINE_DAWN |
| 29 | |
dan sinclair | 70d430c | 2018-09-28 16:12:38 -0400 | [diff] [blame] | 30 | namespace amber { |
| 31 | |
| 32 | // static |
| 33 | std::unique_ptr<Engine> Engine::Create(EngineType type) { |
| 34 | std::unique_ptr<Engine> engine; |
| 35 | switch (type) { |
dan sinclair | 39af103 | 2019-01-15 10:42:30 -0500 | [diff] [blame] | 36 | case kEngineTypeVulkan: |
dan sinclair | 70d430c | 2018-09-28 16:12:38 -0400 | [diff] [blame] | 37 | #if AMBER_ENGINE_VULKAN |
| 38 | engine = MakeUnique<vulkan::EngineVulkan>(); |
| 39 | #endif // AMBER_ENGINE_VULKAN |
| 40 | break; |
dan sinclair | 39af103 | 2019-01-15 10:42:30 -0500 | [diff] [blame] | 41 | case kEngineTypeDawn: |
David Neto | ef2bc0a | 2018-11-12 13:52:31 +0000 | [diff] [blame] | 42 | #if AMBER_ENGINE_DAWN |
| 43 | engine = MakeUnique<dawn::EngineDawn>(); |
| 44 | #endif // AMBER_ENGINE_DAWN |
| 45 | break; |
dan sinclair | 70d430c | 2018-09-28 16:12:38 -0400 | [diff] [blame] | 46 | } |
| 47 | return engine; |
| 48 | } |
| 49 | |
| 50 | Engine::Engine() = default; |
| 51 | |
| 52 | Engine::~Engine() = default; |
| 53 | |
| 54 | } // namespace amber |