tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

SupportedLimits.h (3106B)


      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 <memory>
     10 
     11 #include "ObjectModel.h"
     12 #include "nsWrapperCache.h"
     13 
     14 namespace mozilla::webgpu {
     15 namespace ffi {
     16 struct WGPULimits;
     17 }
     18 class Adapter;
     19 
     20 enum class Limit : uint8_t {
     21  MaxTextureDimension1D,
     22  MaxTextureDimension2D,
     23  MaxTextureDimension3D,
     24  MaxTextureArrayLayers,
     25  MaxBindGroups,
     26  MaxBindGroupsPlusVertexBuffers,
     27  MaxBindingsPerBindGroup,
     28  MaxDynamicUniformBuffersPerPipelineLayout,
     29  MaxDynamicStorageBuffersPerPipelineLayout,
     30  MaxSampledTexturesPerShaderStage,
     31  MaxSamplersPerShaderStage,
     32  MaxStorageBuffersPerShaderStage,
     33  MaxStorageTexturesPerShaderStage,
     34  MaxUniformBuffersPerShaderStage,
     35  MaxUniformBufferBindingSize,
     36  MaxStorageBufferBindingSize,
     37  MinUniformBufferOffsetAlignment,
     38  MinStorageBufferOffsetAlignment,
     39  MaxVertexBuffers,
     40  MaxBufferSize,
     41  MaxVertexAttributes,
     42  MaxVertexBufferArrayStride,
     43  MaxInterStageShaderVariables,
     44  MaxColorAttachments,
     45  MaxColorAttachmentBytesPerSample,
     46  MaxComputeWorkgroupStorageSize,
     47  MaxComputeInvocationsPerWorkgroup,
     48  MaxComputeWorkgroupSizeX,
     49  MaxComputeWorkgroupSizeY,
     50  MaxComputeWorkgroupSizeZ,
     51  MaxComputeWorkgroupsPerDimension,
     52  _LAST = MaxComputeWorkgroupsPerDimension,
     53 };
     54 
     55 uint64_t GetLimit(const ffi::WGPULimits&, Limit);
     56 void SetLimit(ffi::WGPULimits*, Limit, double);
     57 
     58 class SupportedLimits final : public nsWrapperCache, public ChildOf<Adapter> {
     59 public:
     60  const std::unique_ptr<ffi::WGPULimits> mFfi;
     61 
     62  GPU_DECL_CYCLE_COLLECTION(SupportedLimits)
     63  GPU_DECL_JS_WRAP(SupportedLimits)
     64 
     65 #define _(X) \
     66  auto X() const { return GetLimit(*mFfi, Limit::X); }
     67 
     68  _(MaxTextureDimension1D)
     69  _(MaxTextureDimension2D)
     70  _(MaxTextureDimension3D)
     71  _(MaxTextureArrayLayers)
     72  _(MaxBindGroups)
     73  _(MaxBindGroupsPlusVertexBuffers)
     74  _(MaxBindingsPerBindGroup)
     75  _(MaxDynamicUniformBuffersPerPipelineLayout)
     76  _(MaxDynamicStorageBuffersPerPipelineLayout)
     77  _(MaxSampledTexturesPerShaderStage)
     78  _(MaxSamplersPerShaderStage)
     79  _(MaxStorageBuffersPerShaderStage)
     80  _(MaxStorageTexturesPerShaderStage)
     81  _(MaxUniformBuffersPerShaderStage)
     82  _(MaxUniformBufferBindingSize)
     83  _(MaxStorageBufferBindingSize)
     84  _(MinUniformBufferOffsetAlignment)
     85  _(MinStorageBufferOffsetAlignment)
     86  _(MaxVertexBuffers)
     87  _(MaxBufferSize)
     88  _(MaxVertexAttributes)
     89  _(MaxVertexBufferArrayStride)
     90  _(MaxInterStageShaderVariables)
     91  _(MaxColorAttachments)
     92  _(MaxColorAttachmentBytesPerSample)
     93  _(MaxComputeWorkgroupStorageSize)
     94  _(MaxComputeInvocationsPerWorkgroup)
     95  _(MaxComputeWorkgroupSizeX)
     96  _(MaxComputeWorkgroupSizeY)
     97  _(MaxComputeWorkgroupSizeZ)
     98  _(MaxComputeWorkgroupsPerDimension)
     99 
    100 #undef _
    101 
    102  SupportedLimits(Adapter* const aParent, const ffi::WGPULimits&);
    103 
    104 private:
    105  virtual ~SupportedLimits();
    106 };
    107 
    108 }  // namespace mozilla::webgpu
    109 
    110 #endif  // GPU_SupportedLimits_H_