OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 20 matching lines...) Expand all Loading... | |
31 #ifndef DrawingBuffer_h | 31 #ifndef DrawingBuffer_h |
32 #define DrawingBuffer_h | 32 #define DrawingBuffer_h |
33 | 33 |
34 #include "platform/PlatformExport.h" | 34 #include "platform/PlatformExport.h" |
35 #include "platform/geometry/IntSize.h" | 35 #include "platform/geometry/IntSize.h" |
36 #include "platform/graphics/GraphicsContext3D.h" | 36 #include "platform/graphics/GraphicsContext3D.h" |
37 #include "platform/graphics/GraphicsTypes3D.h" | 37 #include "platform/graphics/GraphicsTypes3D.h" |
38 | 38 |
39 #include "public/platform/WebExternalTextureLayerClient.h" | 39 #include "public/platform/WebExternalTextureLayerClient.h" |
40 #include "public/platform/WebExternalTextureMailbox.h" | 40 #include "public/platform/WebExternalTextureMailbox.h" |
41 #include "public/platform/WebGraphicsContext3D.h" | |
41 #include "wtf/Noncopyable.h" | 42 #include "wtf/Noncopyable.h" |
42 #include "wtf/OwnPtr.h" | 43 #include "wtf/OwnPtr.h" |
43 #include "wtf/PassOwnPtr.h" | 44 #include "wtf/PassOwnPtr.h" |
44 | 45 |
45 namespace blink { | 46 namespace blink { |
46 class WebExternalBitmap; | 47 class WebExternalBitmap; |
47 class WebExternalTextureLayer; | 48 class WebExternalTextureLayer; |
48 class WebGraphicsContext3D; | 49 class WebGraphicsContext3D; |
49 class WebLayer; | 50 class WebLayer; |
50 } | 51 } |
(...skipping 18 matching lines...) Expand all Loading... | |
69 blink::WebExternalTextureMailbox mailbox; | 70 blink::WebExternalTextureMailbox mailbox; |
70 unsigned textureId; | 71 unsigned textureId; |
71 IntSize size; | 72 IntSize size; |
72 }; | 73 }; |
73 public: | 74 public: |
74 enum PreserveDrawingBuffer { | 75 enum PreserveDrawingBuffer { |
75 Preserve, | 76 Preserve, |
76 Discard | 77 Discard |
77 }; | 78 }; |
78 | 79 |
79 static PassRefPtr<DrawingBuffer> create(GraphicsContext3D*, const IntSize&, PreserveDrawingBuffer, PassRefPtr<ContextEvictionManager>); | 80 static PassRefPtr<DrawingBuffer> create(blink::WebGraphicsContext3D*, const IntSize&, PreserveDrawingBuffer, PassRefPtr<ContextEvictionManager>); |
80 | 81 |
81 ~DrawingBuffer(); | 82 ~DrawingBuffer(); |
82 | 83 |
83 // Clear all resources from this object, as well as context. Called when con text is destroyed | 84 // Clear all resources from this object, as well as context. Called when con text is destroyed |
84 // to prevent invalid accesses to the resources. | 85 // to prevent invalid accesses to the resources. |
85 void releaseResources(); | 86 void releaseResources(); |
86 | 87 |
87 // Issues a glClear() on all framebuffers associated with this DrawingBuffer . The caller is responsible for | 88 // Issues a glClear() on all framebuffers associated with this DrawingBuffer . The caller is responsible for |
88 // making the context current and setting the clear values and masks. Modifi es the framebuffer binding. | 89 // making the context current and setting the clear values and masks. Modifi es the framebuffer binding. |
89 void clearFramebuffers(GLbitfield clearMask); | 90 void clearFramebuffers(GLbitfield clearMask); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 | 127 |
127 // WebExternalTextureLayerClient implementation. | 128 // WebExternalTextureLayerClient implementation. |
128 virtual blink::WebGraphicsContext3D* context() OVERRIDE; | 129 virtual blink::WebGraphicsContext3D* context() OVERRIDE; |
129 virtual bool prepareMailbox(blink::WebExternalTextureMailbox*, blink::WebExt ernalBitmap*) OVERRIDE; | 130 virtual bool prepareMailbox(blink::WebExternalTextureMailbox*, blink::WebExt ernalBitmap*) OVERRIDE; |
130 virtual void mailboxReleased(const blink::WebExternalTextureMailbox&) OVERRI DE; | 131 virtual void mailboxReleased(const blink::WebExternalTextureMailbox&) OVERRI DE; |
131 | 132 |
132 bool copyToPlatformTexture(GraphicsContext3D&, Platform3DObject texture, GLe num internalFormat, | 133 bool copyToPlatformTexture(GraphicsContext3D&, Platform3DObject texture, GLe num internalFormat, |
133 GLenum destType, GLint level, bool premultiplyAlpha, bool flipY); | 134 GLenum destType, GLint level, bool premultiplyAlpha, bool flipY); |
134 | 135 |
135 private: | 136 private: |
136 DrawingBuffer(GraphicsContext3D*, const IntSize&, bool multisampleExtensionS upported, | 137 DrawingBuffer(blink::WebGraphicsContext3D*, GraphicsContext3D*, const IntSiz e&, bool multisampleExtensionSupported, |
137 bool packedDepthStencilExtensionSupported, PreserveDrawingBuff er, PassRefPtr<ContextEvictionManager>); | 138 bool packedDepthStencilExtensionSupported, PreserveDrawingBuff er, PassRefPtr<ContextEvictionManager>); |
138 | 139 |
139 void initialize(const IntSize&); | 140 void initialize(const IntSize&); |
140 | 141 |
141 Platform3DObject frontColorBuffer() const; | 142 Platform3DObject frontColorBuffer() const; |
142 Platform3DObject colorBuffer() const { return m_colorBuffer; } | 143 Platform3DObject colorBuffer() const { return m_colorBuffer; } |
143 | 144 |
144 unsigned createColorTexture(const IntSize& size = IntSize()); | 145 unsigned createColorTexture(const IntSize& size = IntSize()); |
145 // Create the depth/stencil and multisample buffers, if needed. | 146 // Create the depth/stencil and multisample buffers, if needed. |
146 void createSecondaryBuffers(); | 147 void createSecondaryBuffers(); |
(...skipping 18 matching lines...) Expand all Loading... | |
165 // Given the desired buffer size, provides the largest dimensions that will fit in the pixel budget | 166 // Given the desired buffer size, provides the largest dimensions that will fit in the pixel budget |
166 // Returns true if the buffer will only fit if the oldest WebGL context is f orcibly lost | 167 // Returns true if the buffer will only fit if the oldest WebGL context is f orcibly lost |
167 IntSize adjustSizeWithContextEviction(const IntSize&, bool& evictContext); | 168 IntSize adjustSizeWithContextEviction(const IntSize&, bool& evictContext); |
168 | 169 |
169 PreserveDrawingBuffer m_preserveDrawingBuffer; | 170 PreserveDrawingBuffer m_preserveDrawingBuffer; |
170 bool m_scissorEnabled; | 171 bool m_scissorEnabled; |
171 Platform3DObject m_texture2DBinding; | 172 Platform3DObject m_texture2DBinding; |
172 Platform3DObject m_framebufferBinding; | 173 Platform3DObject m_framebufferBinding; |
173 GLenum m_activeTextureUnit; | 174 GLenum m_activeTextureUnit; |
174 | 175 |
175 RefPtr<GraphicsContext3D> m_context; | 176 blink::WebGraphicsContext3D* m_context; |
bajones
2014/01/08 03:13:08
General design/style question: When using Graphics
| |
177 RefPtr<GraphicsContext3D> m_contextSupport; | |
176 IntSize m_size; | 178 IntSize m_size; |
177 bool m_multisampleExtensionSupported; | 179 bool m_multisampleExtensionSupported; |
178 bool m_packedDepthStencilExtensionSupported; | 180 bool m_packedDepthStencilExtensionSupported; |
179 Platform3DObject m_fbo; | 181 Platform3DObject m_fbo; |
180 Platform3DObject m_colorBuffer; | 182 Platform3DObject m_colorBuffer; |
181 Platform3DObject m_frontColorBuffer; | 183 Platform3DObject m_frontColorBuffer; |
182 | 184 |
183 // This is used when we have OES_packed_depth_stencil. | 185 // This is used when we have OES_packed_depth_stencil. |
184 Platform3DObject m_depthStencilBuffer; | 186 Platform3DObject m_depthStencilBuffer; |
185 | 187 |
186 // These are used when we don't. | 188 // These are used when we don't. |
187 Platform3DObject m_depthBuffer; | 189 Platform3DObject m_depthBuffer; |
188 Platform3DObject m_stencilBuffer; | 190 Platform3DObject m_stencilBuffer; |
189 | 191 |
190 // For multisampling. | 192 // For multisampling. |
191 Platform3DObject m_multisampleFBO; | 193 Platform3DObject m_multisampleFBO; |
192 Platform3DObject m_multisampleColorBuffer; | 194 Platform3DObject m_multisampleColorBuffer; |
193 | 195 |
194 // True if our contents have been modified since the last presentation of th is buffer. | 196 // True if our contents have been modified since the last presentation of th is buffer. |
195 bool m_contentsChanged; | 197 bool m_contentsChanged; |
196 | 198 |
197 // True if commit() has been called since the last time markContentsChanged( ) had been called. | 199 // True if commit() has been called since the last time markContentsChanged( ) had been called. |
198 bool m_contentsChangeCommitted; | 200 bool m_contentsChangeCommitted; |
199 | 201 |
200 GraphicsContext3D::Attributes m_attributes; | 202 blink::WebGraphicsContext3D::Attributes m_attributes; |
201 unsigned m_internalColorFormat; | 203 unsigned m_internalColorFormat; |
202 unsigned m_colorFormat; | 204 unsigned m_colorFormat; |
203 unsigned m_internalRenderbufferFormat; | 205 unsigned m_internalRenderbufferFormat; |
204 int m_maxTextureSize; | 206 int m_maxTextureSize; |
205 int m_sampleCount; | 207 int m_sampleCount; |
206 | 208 |
207 OwnPtr<blink::WebExternalTextureLayer> m_layer; | 209 OwnPtr<blink::WebExternalTextureLayer> m_layer; |
208 | 210 |
209 // All of the mailboxes that this DrawingBuffer has ever created. | 211 // All of the mailboxes that this DrawingBuffer has ever created. |
210 Vector<RefPtr<MailboxInfo> > m_textureMailboxes; | 212 Vector<RefPtr<MailboxInfo> > m_textureMailboxes; |
211 // Mailboxes that were released by the compositor and can be used again by t his DrawingBuffer. | 213 // Mailboxes that were released by the compositor and can be used again by t his DrawingBuffer. |
212 Vector<RefPtr<MailboxInfo> > m_recycledMailboxes; | 214 Vector<RefPtr<MailboxInfo> > m_recycledMailboxes; |
213 RefPtr<MailboxInfo> m_lastColorBuffer; | 215 RefPtr<MailboxInfo> m_lastColorBuffer; |
214 | 216 |
215 RefPtr<ContextEvictionManager> m_contextEvictionManager; | 217 RefPtr<ContextEvictionManager> m_contextEvictionManager; |
216 }; | 218 }; |
217 | 219 |
218 } // namespace WebCore | 220 } // namespace WebCore |
219 | 221 |
220 #endif // DrawingBuffer_h | 222 #endif // DrawingBuffer_h |
OLD | NEW |