OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 10 matching lines...) Expand all Loading... | |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef WebGLFramebuffer_h | 26 #ifndef WebGLFramebuffer_h |
27 #define WebGLFramebuffer_h | 27 #define WebGLFramebuffer_h |
28 | 28 |
29 #include "modules/webgl/WebGLContextObject.h" | 29 #include "modules/webgl/WebGLContextObject.h" |
30 #include "modules/webgl/WebGLSharedObject.h" | 30 #include "modules/webgl/WebGLSharedObject.h" |
31 #include "wtf/PassRefPtr.h" | 31 #include "wtf/PassRefPtr.h" |
sof
2015/08/01 18:49:14
The wtf/ includes can now be retired.
peria
2015/08/03 09:00:36
Done.
| |
32 #include "wtf/RefCounted.h" | 32 #include "wtf/RefCounted.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
36 class WebGLRenderbuffer; | 36 class WebGLRenderbuffer; |
37 class WebGLTexture; | 37 class WebGLTexture; |
38 | 38 |
39 class WebGLFramebuffer final : public WebGLContextObject { | 39 class WebGLFramebuffer final : public WebGLContextObject { |
40 DEFINE_WRAPPERTYPEINFO(); | 40 DEFINE_WRAPPERTYPEINFO(); |
41 public: | 41 public: |
42 class WebGLAttachment : public RefCountedWillBeGarbageCollectedFinalized<Web GLAttachment> { | 42 class WebGLAttachment : public GarbageCollectedFinalized<WebGLAttachment> { |
43 public: | 43 public: |
44 virtual ~WebGLAttachment(); | 44 virtual ~WebGLAttachment(); |
45 | 45 |
46 virtual GLsizei width() const = 0; | 46 virtual GLsizei width() const = 0; |
47 virtual GLsizei height() const = 0; | 47 virtual GLsizei height() const = 0; |
48 virtual GLenum format() const = 0; | 48 virtual GLenum format() const = 0; |
49 // For texture attachment, type() returns the type of the attached textu re. | 49 // For texture attachment, type() returns the type of the attached textu re. |
50 // For renderbuffer attachment, the type of the renderbuffer may vary wi th GL implementation. | 50 // For renderbuffer attachment, the type of the renderbuffer may vary wi th GL implementation. |
51 // To avoid confusion, it would be better to not implement type() for re nderbuffer attachment and | 51 // To avoid confusion, it would be better to not implement type() for re nderbuffer attachment and |
52 // we should always use the internalformat of the renderbuffer and avoid using type() API. | 52 // we should always use the internalformat of the renderbuffer and avoid using type() API. |
53 virtual GLenum type() const = 0; | 53 virtual GLenum type() const = 0; |
54 virtual WebGLSharedObject* object() const = 0; | 54 virtual WebGLSharedObject* object() const = 0; |
55 virtual bool isSharedObject(WebGLSharedObject*) const = 0; | 55 virtual bool isSharedObject(WebGLSharedObject*) const = 0; |
56 virtual bool valid() const = 0; | 56 virtual bool valid() const = 0; |
57 virtual void onDetached(WebGraphicsContext3D*) = 0; | 57 virtual void onDetached(WebGraphicsContext3D*) = 0; |
58 virtual void attach(WebGraphicsContext3D*, GLenum target, GLenum attachm ent) = 0; | 58 virtual void attach(WebGraphicsContext3D*, GLenum target, GLenum attachm ent) = 0; |
59 virtual void unattach(WebGraphicsContext3D*, GLenum target, GLenum attac hment) = 0; | 59 virtual void unattach(WebGraphicsContext3D*, GLenum target, GLenum attac hment) = 0; |
60 | 60 |
61 DEFINE_INLINE_VIRTUAL_TRACE() { } | 61 DEFINE_INLINE_VIRTUAL_TRACE() { } |
62 | 62 |
63 protected: | 63 protected: |
64 WebGLAttachment(); | 64 WebGLAttachment(); |
65 }; | 65 }; |
66 | 66 |
67 ~WebGLFramebuffer() override; | 67 ~WebGLFramebuffer() override; |
68 | 68 |
69 static PassRefPtrWillBeRawPtr<WebGLFramebuffer> create(WebGLRenderingContext Base*); | 69 static WebGLFramebuffer* create(WebGLRenderingContextBase*); |
70 | 70 |
71 Platform3DObject object() const { return m_object; } | 71 Platform3DObject object() const { return m_object; } |
72 | 72 |
73 void setAttachmentForBoundFramebuffer(GLenum target, GLenum attachment, GLen um texTarget, WebGLTexture*, GLint level); | 73 void setAttachmentForBoundFramebuffer(GLenum target, GLenum attachment, GLen um texTarget, WebGLTexture*, GLint level); |
74 void setAttachmentForBoundFramebuffer(GLenum target, GLenum attachment, WebG LRenderbuffer*); | 74 void setAttachmentForBoundFramebuffer(GLenum target, GLenum attachment, WebG LRenderbuffer*); |
75 // If an object is attached to the currently bound framebuffer, remove it. | 75 // If an object is attached to the currently bound framebuffer, remove it. |
76 void removeAttachmentFromBoundFramebuffer(GLenum target, WebGLSharedObject*) ; | 76 void removeAttachmentFromBoundFramebuffer(GLenum target, WebGLSharedObject*) ; |
77 // If a given attachment point for the currently bound framebuffer is not nu ll, remove the attached object. | 77 // If a given attachment point for the currently bound framebuffer is not nu ll, remove the attached object. |
78 void removeAttachmentFromBoundFramebuffer(GLenum target, GLenum attachment); | 78 void removeAttachmentFromBoundFramebuffer(GLenum target, GLenum attachment); |
79 WebGLSharedObject* getAttachmentObject(GLenum) const; | 79 WebGLSharedObject* getAttachmentObject(GLenum) const; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 bool isBound(GLenum target) const; | 127 bool isBound(GLenum target) const; |
128 | 128 |
129 // attach 'attachment' at 'attachmentPoint'. | 129 // attach 'attachment' at 'attachmentPoint'. |
130 void attach(GLenum target, GLenum attachment, GLenum attachmentPoint); | 130 void attach(GLenum target, GLenum attachment, GLenum attachmentPoint); |
131 | 131 |
132 // Check if a new drawBuffers call should be issued. This is called when we add or remove an attachment. | 132 // Check if a new drawBuffers call should be issued. This is called when we add or remove an attachment. |
133 void drawBuffersIfNecessary(bool force); | 133 void drawBuffersIfNecessary(bool force); |
134 | 134 |
135 Platform3DObject m_object; | 135 Platform3DObject m_object; |
136 | 136 |
137 typedef WillBeHeapHashMap<GLenum, RefPtrWillBeMember<WebGLAttachment>> Attac hmentMap; | 137 typedef HeapHashMap<GLenum, Member<WebGLAttachment>> AttachmentMap; |
138 | 138 |
139 AttachmentMap m_attachments; | 139 AttachmentMap m_attachments; |
140 | 140 |
141 bool m_hasEverBeenBound; | 141 bool m_hasEverBeenBound; |
142 | 142 |
143 Vector<GLenum> m_drawBuffers; | 143 Vector<GLenum> m_drawBuffers; |
144 Vector<GLenum> m_filteredDrawBuffers; | 144 Vector<GLenum> m_filteredDrawBuffers; |
145 | 145 |
146 GLenum m_readBuffer; | 146 GLenum m_readBuffer; |
147 }; | 147 }; |
148 | 148 |
149 } // namespace blink | 149 } // namespace blink |
150 | 150 |
151 #endif // WebGLFramebuffer_h | 151 #endif // WebGLFramebuffer_h |
OLD | NEW |