Bug 1521243 - Show a warning for invalid declarations and filter icon for overridden...
[gecko.git] / dom / canvas / WebGLRenderbuffer.h
blobe39fd80b44c1129e629156e94e9f43926e2679e2
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 "mozilla/LinkedList.h"
10 #include "nsWrapperCache.h"
12 #include "CacheInvalidator.h"
13 #include "WebGLObjectModel.h"
14 #include "WebGLStrongTypes.h"
15 #include "WebGLTexture.h"
17 namespace mozilla {
18 namespace webgl {
19 struct FormatUsageInfo;
22 class WebGLRenderbuffer final : public nsWrapperCache,
23 public WebGLRefCountedObject<WebGLRenderbuffer>,
24 public LinkedListElement<WebGLRenderbuffer>,
25 public WebGLRectangleObject,
26 public CacheInvalidator {
27 friend class WebGLFramebuffer;
28 friend class WebGLFBAttachPoint;
30 public:
31 const GLuint mPrimaryRB;
32 bool mHasBeenBound = false;
34 protected:
35 const bool mEmulatePackedDepthStencil;
36 GLuint mSecondaryRB;
37 webgl::ImageInfo mImageInfo;
39 public:
40 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLRenderbuffer)
41 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLRenderbuffer)
43 explicit WebGLRenderbuffer(WebGLContext* webgl);
45 void Delete();
47 const auto& ImageInfo() const { return mImageInfo; }
49 WebGLContext* GetParentObject() const { return mContext; }
51 void RenderbufferStorage(uint32_t samples, GLenum internalFormat,
52 uint32_t width, uint32_t height);
53 // Only handles a subset of `pname`s.
54 GLint GetRenderbufferParameter(RBTarget target, RBParam pname) const;
56 virtual JSObject* WrapObject(JSContext* cx,
57 JS::Handle<JSObject*> givenProto) override;
59 auto MemoryUsage() const { return mImageInfo.MemoryUsage(); }
61 protected:
62 ~WebGLRenderbuffer() { DeleteOnce(); }
64 void DoFramebufferRenderbuffer(GLenum attachment) const;
65 GLenum DoRenderbufferStorage(uint32_t samples,
66 const webgl::FormatUsageInfo* format,
67 uint32_t width, uint32_t height);
70 } // namespace mozilla
72 #endif // WEBGL_RENDERBUFFER_H_