SupportedFeatures.h (1115B)
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #ifndef GPU_SupportedFeatures_H_ 7 #define GPU_SupportedFeatures_H_ 8 9 #include <unordered_set> 10 11 #include "ObjectModel.h" 12 #include "nsWrapperCache.h" 13 14 namespace mozilla { 15 class ErrorResult; 16 namespace dom { 17 enum class GPUFeatureName : uint8_t; 18 } // namespace dom 19 } // namespace mozilla 20 21 namespace mozilla::webgpu { 22 class Adapter; 23 24 class SupportedFeatures final : public nsWrapperCache, public ChildOf<Adapter> { 25 public: 26 GPU_DECL_CYCLE_COLLECTION(SupportedFeatures) 27 GPU_DECL_JS_WRAP(SupportedFeatures) 28 29 explicit SupportedFeatures(Adapter* const aParent); 30 31 void Add(dom::GPUFeatureName, ErrorResult&); 32 const auto& Features() const { return mFeatures; } 33 34 private: 35 virtual ~SupportedFeatures(); 36 37 std::unordered_set<dom::GPUFeatureName> mFeatures; 38 }; 39 40 } // namespace mozilla::webgpu 41 42 #endif // GPU_SupportedFeatures_H_