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 19 matching lines...) Expand all Loading... |
30 #include "core/html/canvas/WebGLContextObject.h" | 30 #include "core/html/canvas/WebGLContextObject.h" |
31 #include "core/html/canvas/WebGLSharedObject.h" | 31 #include "core/html/canvas/WebGLSharedObject.h" |
32 #include "wtf/PassRefPtr.h" | 32 #include "wtf/PassRefPtr.h" |
33 #include "wtf/RefCounted.h" | 33 #include "wtf/RefCounted.h" |
34 | 34 |
35 namespace blink { | 35 namespace blink { |
36 | 36 |
37 class WebGLRenderbuffer; | 37 class WebGLRenderbuffer; |
38 class WebGLTexture; | 38 class WebGLTexture; |
39 | 39 |
40 class WebGLFramebuffer FINAL : public WebGLContextObject, public ScriptWrappable
{ | 40 class WebGLFramebuffer final : public WebGLContextObject, public ScriptWrappable
{ |
41 DEFINE_WRAPPERTYPEINFO(); | 41 DEFINE_WRAPPERTYPEINFO(); |
42 public: | 42 public: |
43 class WebGLAttachment : public RefCountedWillBeGarbageCollectedFinalized<Web
GLAttachment> { | 43 class WebGLAttachment : public RefCountedWillBeGarbageCollectedFinalized<Web
GLAttachment> { |
44 public: | 44 public: |
45 virtual ~WebGLAttachment(); | 45 virtual ~WebGLAttachment(); |
46 | 46 |
47 virtual GLsizei width() const = 0; | 47 virtual GLsizei width() const = 0; |
48 virtual GLsizei height() const = 0; | 48 virtual GLsizei height() const = 0; |
49 virtual GLenum format() const = 0; | 49 virtual GLenum format() const = 0; |
50 // For texture attachment, type() returns the type of the attached textu
re. | 50 // For texture attachment, type() returns the type of the attached textu
re. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 void setHasEverBeenBound() { m_hasEverBeenBound = true; } | 96 void setHasEverBeenBound() { m_hasEverBeenBound = true; } |
97 | 97 |
98 bool hasStencilBuffer() const; | 98 bool hasStencilBuffer() const; |
99 | 99 |
100 // Wrapper for drawBuffersEXT/drawBuffersARB to work around a driver bug. | 100 // Wrapper for drawBuffersEXT/drawBuffersARB to work around a driver bug. |
101 void drawBuffers(const Vector<GLenum>& bufs); | 101 void drawBuffers(const Vector<GLenum>& bufs); |
102 | 102 |
103 GLenum getDrawBuffer(GLenum); | 103 GLenum getDrawBuffer(GLenum); |
104 | 104 |
105 virtual void trace(Visitor*) OVERRIDE; | 105 virtual void trace(Visitor*) override; |
106 | 106 |
107 protected: | 107 protected: |
108 explicit WebGLFramebuffer(WebGLRenderingContextBase*); | 108 explicit WebGLFramebuffer(WebGLRenderingContextBase*); |
109 | 109 |
110 virtual void deleteObjectImpl(blink::WebGraphicsContext3D*, Platform3DObject
) OVERRIDE; | 110 virtual void deleteObjectImpl(blink::WebGraphicsContext3D*, Platform3DObject
) override; |
111 | 111 |
112 private: | 112 private: |
113 WebGLAttachment* getAttachment(GLenum) const; | 113 WebGLAttachment* getAttachment(GLenum) const; |
114 bool isAttachmentComplete(WebGLAttachment* attachedObject, GLenum attachment
, const char** reason) const; | 114 bool isAttachmentComplete(WebGLAttachment* attachedObject, GLenum attachment
, const char** reason) const; |
115 | 115 |
116 // Check if the framebuffer is currently bound. | 116 // Check if the framebuffer is currently bound. |
117 bool isBound() const; | 117 bool isBound() const; |
118 | 118 |
119 // attach 'attachment' at 'attachmentPoint'. | 119 // attach 'attachment' at 'attachmentPoint'. |
120 void attach(GLenum attachment, GLenum attachmentPoint); | 120 void attach(GLenum attachment, GLenum attachmentPoint); |
121 | 121 |
122 // Check if a new drawBuffers call should be issued. This is called when we
add or remove an attachment. | 122 // Check if a new drawBuffers call should be issued. This is called when we
add or remove an attachment. |
123 void drawBuffersIfNecessary(bool force); | 123 void drawBuffersIfNecessary(bool force); |
124 | 124 |
125 typedef WillBeHeapHashMap<GLenum, RefPtrWillBeMember<WebGLAttachment> > Atta
chmentMap; | 125 typedef WillBeHeapHashMap<GLenum, RefPtrWillBeMember<WebGLAttachment> > Atta
chmentMap; |
126 | 126 |
127 AttachmentMap m_attachments; | 127 AttachmentMap m_attachments; |
128 | 128 |
129 bool m_hasEverBeenBound; | 129 bool m_hasEverBeenBound; |
130 | 130 |
131 Vector<GLenum> m_drawBuffers; | 131 Vector<GLenum> m_drawBuffers; |
132 Vector<GLenum> m_filteredDrawBuffers; | 132 Vector<GLenum> m_filteredDrawBuffers; |
133 }; | 133 }; |
134 | 134 |
135 } // namespace blink | 135 } // namespace blink |
136 | 136 |
137 #endif // WebGLFramebuffer_h | 137 #endif // WebGLFramebuffer_h |
OLD | NEW |