1e5c31af7Sopenharmony_ci// Copyright 2019 The Amber Authors.
2e5c31af7Sopenharmony_ci//
3e5c31af7Sopenharmony_ci// Licensed under the Apache License, Version 2.0 (the "License");
4e5c31af7Sopenharmony_ci// you may not use this file except in compliance with the License.
5e5c31af7Sopenharmony_ci// You may obtain a copy of the License at
6e5c31af7Sopenharmony_ci//
7e5c31af7Sopenharmony_ci//     http://www.apache.org/licenses/LICENSE-2.0
8e5c31af7Sopenharmony_ci//
9e5c31af7Sopenharmony_ci// Unless required by applicable law or agreed to in writing, software
10e5c31af7Sopenharmony_ci// distributed under the License is distributed on an "AS IS" BASIS,
11e5c31af7Sopenharmony_ci// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12e5c31af7Sopenharmony_ci// See the License for the specific language governing permissions and
13e5c31af7Sopenharmony_ci// limitations under the License.
14e5c31af7Sopenharmony_ci
15e5c31af7Sopenharmony_ci#ifndef SAMPLES_CONFIG_HELPER_DAWN_H_
16e5c31af7Sopenharmony_ci#define SAMPLES_CONFIG_HELPER_DAWN_H_
17e5c31af7Sopenharmony_ci
18e5c31af7Sopenharmony_ci#include <limits>
19e5c31af7Sopenharmony_ci#include <memory>
20e5c31af7Sopenharmony_ci#include <string>
21e5c31af7Sopenharmony_ci#include <vector>
22e5c31af7Sopenharmony_ci
23e5c31af7Sopenharmony_ci#include "amber/amber.h"
24e5c31af7Sopenharmony_ci#include "amber/amber_dawn.h"
25e5c31af7Sopenharmony_ci#include "dawn_native/DawnNative.h"
26e5c31af7Sopenharmony_ci#include "samples/config_helper.h"
27e5c31af7Sopenharmony_ci
28e5c31af7Sopenharmony_cinamespace sample {
29e5c31af7Sopenharmony_ci
30e5c31af7Sopenharmony_ci/// Child class of ConfigHelperImpl for Dawn.
31e5c31af7Sopenharmony_ciclass ConfigHelperDawn : public ConfigHelperImpl {
32e5c31af7Sopenharmony_ci public:
33e5c31af7Sopenharmony_ci  ConfigHelperDawn();
34e5c31af7Sopenharmony_ci  ~ConfigHelperDawn() override;
35e5c31af7Sopenharmony_ci
36e5c31af7Sopenharmony_ci  /// Create a Dawn instance and device and return them as
37e5c31af7Sopenharmony_ci  /// amber::DawnEngineConfig.  Engine version number and features
38e5c31af7Sopenharmony_ci  /// and extension lists are ignored.
39e5c31af7Sopenharmony_ci  amber::Result CreateConfig(
40e5c31af7Sopenharmony_ci      uint32_t engine_major,
41e5c31af7Sopenharmony_ci      uint32_t engine_minor,
42e5c31af7Sopenharmony_ci      int32_t selected_device,
43e5c31af7Sopenharmony_ci      const std::vector<std::string>& required_features,
44e5c31af7Sopenharmony_ci      const std::vector<std::string>& required_instance_extensions,
45e5c31af7Sopenharmony_ci      const std::vector<std::string>& required_device_extensions,
46e5c31af7Sopenharmony_ci      bool disable_validation_layer,
47e5c31af7Sopenharmony_ci      bool show_version_info,
48e5c31af7Sopenharmony_ci      std::unique_ptr<amber::EngineConfig>* config) override;
49e5c31af7Sopenharmony_ci
50e5c31af7Sopenharmony_ci private:
51e5c31af7Sopenharmony_ci  ::dawn_native::Instance dawn_instance_;
52e5c31af7Sopenharmony_ci  ::dawn::Device dawn_device_;
53e5c31af7Sopenharmony_ci};
54e5c31af7Sopenharmony_ci
55e5c31af7Sopenharmony_ci}  // namespace sample
56e5c31af7Sopenharmony_ci
57e5c31af7Sopenharmony_ci#endif  // SAMPLES_CONFIG_HELPER_DAWN_H_
58