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 
26 #if AMBER_ENGINE_DAWN
27 #include "src/dawn/engine_dawn.h"
28 #endif  // AMBER_ENGINE_DAWN
29 
30 namespace amber {
31 
32 // static
Create(EngineType type)33 std::unique_ptr<Engine> Engine::Create(EngineType type) {
34   std::unique_ptr<Engine> engine;
35   switch (type) {
36     case kEngineTypeVulkan:
37 #if AMBER_ENGINE_VULKAN
38       engine = MakeUnique<vulkan::EngineVulkan>();
39 #endif  // AMBER_ENGINE_VULKAN
40       break;
41     case kEngineTypeDawn:
42 #if AMBER_ENGINE_DAWN
43       engine = MakeUnique<dawn::EngineDawn>();
44 #endif  // AMBER_ENGINE_DAWN
45       break;
46   }
47   return engine;
48 }
49 
50 Engine::Engine() = default;
51 
52 Engine::~Engine() = default;
53 
54 Engine::Debugger::~Debugger() = default;
55 
56 }  // namespace amber
57