// Copyright 2022 The Dawn Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef SRC_DAWN_TESTS_ADAPTERTESTCONFIG_H_ #define SRC_DAWN_TESTS_ADAPTERTESTCONFIG_H_ #include #include #include #include #include #include "dawn/webgpu_cpp.h" struct BackendTestConfig { BackendTestConfig(wgpu::BackendType backendType, std::initializer_list forceEnabledWorkarounds = {}, std::initializer_list forceDisabledWorkarounds = {}); wgpu::BackendType backendType; std::vector forceEnabledWorkarounds; std::vector forceDisabledWorkarounds; }; struct TestAdapterProperties : wgpu::AdapterProperties { TestAdapterProperties(const wgpu::AdapterProperties& properties, bool selected); std::string adapterName; bool selected; std::string ParamName() const; std::string AdapterTypeName() const; private: // This may be temporary, so it is copied into |adapterName| and made private. using wgpu::AdapterProperties::name; }; struct AdapterTestParam { AdapterTestParam(const BackendTestConfig& config, const TestAdapterProperties& adapterProperties); TestAdapterProperties adapterProperties; std::vector forceEnabledWorkarounds; std::vector forceDisabledWorkarounds; }; std::ostream& operator<<(std::ostream& os, const AdapterTestParam& param); BackendTestConfig D3D12Backend(std::initializer_list forceEnabledWorkarounds = {}, std::initializer_list forceDisabledWorkarounds = {}); BackendTestConfig MetalBackend(std::initializer_list forceEnabledWorkarounds = {}, std::initializer_list forceDisabledWorkarounds = {}); BackendTestConfig NullBackend(std::initializer_list forceEnabledWorkarounds = {}, std::initializer_list forceDisabledWorkarounds = {}); BackendTestConfig OpenGLBackend(std::initializer_list forceEnabledWorkarounds = {}, std::initializer_list forceDisabledWorkarounds = {}); BackendTestConfig OpenGLESBackend(std::initializer_list forceEnabledWorkarounds = {}, std::initializer_list forceDisabledWorkarounds = {}); BackendTestConfig VulkanBackend(std::initializer_list forceEnabledWorkarounds = {}, std::initializer_list forceDisabledWorkarounds = {}); #endif // SRC_DAWN_TESTS_ADAPTERTESTCONFIG_H_