tor-browser

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

BindGroup.h (1519B)


      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_BindGroup_H_
      7 #define GPU_BindGroup_H_
      8 
      9 #include "CanvasContext.h"
     10 #include "ObjectModel.h"
     11 #include "mozilla/Span.h"
     12 #include "mozilla/webgpu/WebGPUTypes.h"
     13 #include "nsTArrayForwardDeclare.h"
     14 #include "nsWrapperCache.h"
     15 
     16 namespace mozilla::webgpu {
     17 
     18 class Device;
     19 class ExternalTexture;
     20 
     21 class BindGroup final : public nsWrapperCache,
     22                        public ObjectBase,
     23                        public ChildOf<Device> {
     24 public:
     25  GPU_DECL_CYCLE_COLLECTION(BindGroup)
     26  GPU_DECL_JS_WRAP(BindGroup)
     27 
     28  BindGroup(Device* const aParent, RawId aId,
     29            CanvasContextArray&& aCanvasContexts,
     30            nsTArray<RefPtr<ExternalTexture>>&& aExternalTextures);
     31 
     32  mozilla::Span<const WeakPtr<CanvasContext>> GetCanvasContexts() const {
     33    return mUsedCanvasContexts;
     34  }
     35 
     36  mozilla::Span<const RefPtr<ExternalTexture>> GetExternalTextures() const {
     37    return mExternalTextures;
     38  }
     39 
     40 private:
     41  virtual ~BindGroup();
     42 
     43  // The canvas contexts of any canvas textures used in this bind group.
     44  CanvasContextArray mUsedCanvasContexts;
     45  // List of external textures used in this bind group.
     46  nsTArray<RefPtr<ExternalTexture>> mExternalTextures;
     47 };
     48 
     49 }  // namespace mozilla::webgpu
     50 
     51 #endif  // GPU_BindGroup_H_