1 // Copyright 2019 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 SAMPLES_CONFIG_HELPER_DAWN_H_ 16 #define SAMPLES_CONFIG_HELPER_DAWN_H_ 17 18 #include <limits> 19 #include <memory> 20 #include <string> 21 #include <vector> 22 23 #include "amber/amber.h" 24 #include "amber/amber_dawn.h" 25 #include "dawn_native/DawnNative.h" 26 #include "samples/config_helper.h" 27 28 namespace sample { 29 30 /// Child class of ConfigHelperImpl for Dawn. 31 class ConfigHelperDawn : public ConfigHelperImpl { 32 public: 33 ConfigHelperDawn(); 34 ~ConfigHelperDawn() override; 35 36 /// Create a Dawn instance and device and return them as 37 /// amber::DawnEngineConfig. Engine version number and features 38 /// and extension lists are ignored. 39 amber::Result CreateConfig( 40 uint32_t engine_major, 41 uint32_t engine_minor, 42 int32_t selected_device, 43 const std::vector<std::string>& required_features, 44 const std::vector<std::string>& required_instance_extensions, 45 const std::vector<std::string>& required_device_extensions, 46 bool disable_validation_layer, 47 bool show_version_info, 48 std::unique_ptr<amber::EngineConfig>* config) override; 49 50 private: 51 ::dawn_native::Instance dawn_instance_; 52 ::dawn::Device dawn_device_; 53 }; 54 55 } // namespace sample 56 57 #endif // SAMPLES_CONFIG_HELPER_DAWN_H_ 58