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/. */
6 #ifndef WEBGL_RENDERBUFFER_H_
7 #define WEBGL_RENDERBUFFER_H_
9 #include "CacheInvalidator.h"
10 #include "WebGLObjectModel.h"
11 #include "WebGLStrongTypes.h"
12 #include "WebGLTexture.h"
16 struct FormatUsageInfo
;
19 class WebGLRenderbuffer final
: public WebGLContextBoundObject
,
20 public WebGLRectangleObject
,
21 public CacheInvalidator
{
22 friend class WebGLFramebuffer
;
23 friend class WebGLFBAttachPoint
;
25 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(WebGLRenderbuffer
, override
)
28 const GLuint mPrimaryRB
;
31 const bool mEmulatePackedDepthStencil
;
33 webgl::ImageInfo mImageInfo
;
36 explicit WebGLRenderbuffer(WebGLContext
* webgl
);
38 const auto& ImageInfo() const { return mImageInfo
; }
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;
45 auto MemoryUsage() const { return mImageInfo
.MemoryUsage(); }
48 ~WebGLRenderbuffer() override
;
50 void DoFramebufferRenderbuffer(GLenum attachment
) const;
51 GLenum
DoRenderbufferStorage(uint32_t samples
,
52 const webgl::FormatUsageInfo
* format
,
53 uint32_t width
, uint32_t height
);
56 } // namespace mozilla
58 #endif // WEBGL_RENDERBUFFER_H_