tor-browser

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

WebGLRenderbuffer.h (1755B)


      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 WEBGL_RENDERBUFFER_H_
      7 #define WEBGL_RENDERBUFFER_H_
      8 
      9 #include "CacheInvalidator.h"
     10 #include "WebGLObjectModel.h"
     11 #include "WebGLStrongTypes.h"
     12 #include "WebGLTexture.h"
     13 
     14 namespace mozilla {
     15 namespace webgl {
     16 struct FormatUsageInfo;
     17 }
     18 
     19 class WebGLRenderbuffer final : public WebGLContextBoundObject,
     20                                public WebGLRectangleObject,
     21                                public CacheInvalidator {
     22  friend class WebGLFramebuffer;
     23  friend class WebGLFBAttachPoint;
     24 
     25  MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(WebGLRenderbuffer, override)
     26 
     27 public:
     28  const GLuint mPrimaryRB;
     29 
     30 protected:
     31  const bool mEmulatePackedDepthStencil;
     32  GLuint mSecondaryRB;
     33  webgl::ImageInfo mImageInfo;
     34 
     35 public:
     36  explicit WebGLRenderbuffer(WebGLContext* webgl);
     37 
     38  const auto& ImageInfo() const { return mImageInfo; }
     39 
     40  void RenderbufferStorage(uint32_t samples, GLenum internalFormat,
     41                           uint32_t width, uint32_t height);
     42  // Only handles a subset of `pname`s.
     43  GLint GetRenderbufferParameter(RBParam pname) const;
     44 
     45  auto MemoryUsage() const { return mImageInfo.MemoryUsage(); }
     46 
     47 protected:
     48  ~WebGLRenderbuffer() override;
     49 
     50  void DoFramebufferRenderbuffer(GLenum attachment) const;
     51  GLenum DoRenderbufferStorage(uint32_t samples,
     52                               const webgl::FormatUsageInfo* format,
     53                               uint32_t width, uint32_t height);
     54 };
     55 
     56 }  // namespace mozilla
     57 
     58 #endif  // WEBGL_RENDERBUFFER_H_