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_SupportedLimits_H_
7 #define GPU_SupportedLimits_H_
8 
9 #include "nsWrapperCache.h"
10 #include "ObjectModel.h"
11 
12 namespace mozilla {
13 namespace webgpu {
14 namespace ffi {
15 struct WGPULimits;
16 }
17 class Adapter;
18 
19 class SupportedLimits final : public nsWrapperCache, public ChildOf<Adapter> {
20   const UniquePtr<ffi::WGPULimits> mLimits;
21 
22  public:
23   GPU_DECL_CYCLE_COLLECTION(SupportedLimits)
24   GPU_DECL_JS_WRAP(SupportedLimits)
25 
26   uint32_t MaxTextureDimension1D() const;
27   uint32_t MaxTextureDimension2D() const;
28   uint32_t MaxTextureDimension3D() const;
29   uint32_t MaxTextureArrayLayers() const;
30   uint32_t MaxBindGroups() const;
31   uint32_t MaxDynamicUniformBuffersPerPipelineLayout() const;
32   uint32_t MaxDynamicStorageBuffersPerPipelineLayout() const;
33   uint32_t MaxSampledTexturesPerShaderStage() const;
34   uint32_t MaxSamplersPerShaderStage() const;
35   uint32_t MaxStorageBuffersPerShaderStage() const;
36   uint32_t MaxStorageTexturesPerShaderStage() const;
37   uint32_t MaxUniformBuffersPerShaderStage() const;
38   uint32_t MaxUniformBufferBindingSize() const;
39   uint32_t MaxStorageBufferBindingSize() const;
40   uint32_t MaxVertexBuffers() const;
41   uint32_t MaxVertexAttributes() const;
42   uint32_t MaxVertexBufferArrayStride() const;
43 
44   SupportedLimits(Adapter* const aParent, UniquePtr<ffi::WGPULimits>&& aLimits);
45 
46  private:
47   ~SupportedLimits();
Cleanup()48   void Cleanup() {}
49 };
50 
51 }  // namespace webgpu
52 }  // namespace mozilla
53 
54 #endif  // GPU_SupportedLimits_H_
55