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 15 matching lines...) Expand all Loading... |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
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/gpu/GPUBlackList.h" |
36 #include "platform/graphics/GraphicsTypes3D.h" | 37 #include "platform/graphics/GraphicsTypes3D.h" |
37 #include "platform/graphics/gpu/WebGLImageConversion.h" | 38 #include "platform/graphics/gpu/WebGLImageConversion.h" |
38 #include "public/platform/WebExternalTextureLayerClient.h" | 39 #include "public/platform/WebExternalTextureLayerClient.h" |
39 #include "public/platform/WebExternalTextureMailbox.h" | 40 #include "public/platform/WebExternalTextureMailbox.h" |
40 #include "public/platform/WebGraphicsContext3D.h" | 41 #include "public/platform/WebGraphicsContext3D.h" |
41 #include "third_party/khronos/GLES2/gl2.h" | 42 #include "third_party/khronos/GLES2/gl2.h" |
42 #include "third_party/khronos/GLES2/gl2ext.h" | 43 #include "third_party/khronos/GLES2/gl2ext.h" |
43 #include "third_party/skia/include/core/SkBitmap.h" | 44 #include "third_party/skia/include/core/SkBitmap.h" |
44 #include "wtf/Deque.h" | 45 #include "wtf/Deque.h" |
45 #include "wtf/Noncopyable.h" | 46 #include "wtf/Noncopyable.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 bool copyToPlatformTexture(WebGraphicsContext3D*, Platform3DObject texture,
GLenum internalFormat, | 158 bool copyToPlatformTexture(WebGraphicsContext3D*, Platform3DObject texture,
GLenum internalFormat, |
158 GLenum destType, GLint level, bool premultiplyAlpha, bool flipY, SourceD
rawingBuffer); | 159 GLenum destType, GLint level, bool premultiplyAlpha, bool flipY, SourceD
rawingBuffer); |
159 | 160 |
160 void setPackAlignment(GLint param); | 161 void setPackAlignment(GLint param); |
161 | 162 |
162 void paintRenderingResultsToCanvas(ImageBuffer*); | 163 void paintRenderingResultsToCanvas(ImageBuffer*); |
163 bool paintRenderingResultsToImageData(int&, int&, SourceDrawingBuffer, WTF::
ArrayBufferContents&); | 164 bool paintRenderingResultsToImageData(int&, int&, SourceDrawingBuffer, WTF::
ArrayBufferContents&); |
164 | 165 |
165 int sampleCount() const { return m_sampleCount; } | 166 int sampleCount() const { return m_sampleCount; } |
166 bool explicitResolveOfMultisampleData() const { return m_multisampleMode ==
ExplicitResolve; }; | 167 bool explicitResolveOfMultisampleData() const { return m_multisampleMode ==
ExplicitResolve; }; |
| 168 bool isRGBTextureSupported() const { return m_RGBTextureSupported; } |
167 | 169 |
168 protected: // For unittests | 170 protected: // For unittests |
169 DrawingBuffer( | 171 DrawingBuffer( |
170 PassOwnPtr<WebGraphicsContext3D>, | 172 PassOwnPtr<WebGraphicsContext3D>, |
171 PassOwnPtr<Extensions3DUtil>, | 173 PassOwnPtr<Extensions3DUtil>, |
172 bool multisampleExtensionSupported, | 174 bool multisampleExtensionSupported, |
173 bool packedDepthStencilExtensionSupported, | 175 bool packedDepthStencilExtensionSupported, |
174 bool discardFramebufferSupported, | 176 bool discardFramebufferSupported, |
175 PreserveDrawingBuffer, | 177 PreserveDrawingBuffer, |
176 WebGraphicsContext3D::Attributes requestedAttributes); | 178 WebGraphicsContext3D::Attributes requestedAttributes); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 // Helper function to flip a bitmap vertically. | 217 // Helper function to flip a bitmap vertically. |
216 void flipVertically(uint8_t* data, int width, int height); | 218 void flipVertically(uint8_t* data, int width, int height); |
217 | 219 |
218 // Helper to texImage2D with pixel==0 case: pixels are initialized to 0. | 220 // Helper to texImage2D with pixel==0 case: pixels are initialized to 0. |
219 // By default, alignment is 4, the OpenGL default setting. | 221 // By default, alignment is 4, the OpenGL default setting. |
220 void texImage2DResourceSafe(GLenum target, GLint level, GLenum internalforma
t, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLin
t alignment = 4); | 222 void texImage2DResourceSafe(GLenum target, GLint level, GLenum internalforma
t, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLin
t alignment = 4); |
221 // Allocate buffer storage to be sent to compositor using either texImage2D
or CHROMIUM_image based on available support. | 223 // Allocate buffer storage to be sent to compositor using either texImage2D
or CHROMIUM_image based on available support. |
222 void allocateTextureMemory(TextureInfo*, const IntSize&); | 224 void allocateTextureMemory(TextureInfo*, const IntSize&); |
223 void deleteChromiumImageForTexture(TextureInfo*); | 225 void deleteChromiumImageForTexture(TextureInfo*); |
224 | 226 |
| 227 GPUBlackList gpuBlackList() { return m_gpuBlackList; } |
| 228 void determineRGBTextureSupport(); |
| 229 |
225 PreserveDrawingBuffer m_preserveDrawingBuffer; | 230 PreserveDrawingBuffer m_preserveDrawingBuffer; |
226 bool m_scissorEnabled; | 231 bool m_scissorEnabled; |
227 Platform3DObject m_texture2DBinding; | 232 Platform3DObject m_texture2DBinding; |
228 Platform3DObject m_framebufferBinding; | 233 Platform3DObject m_framebufferBinding; |
229 GLenum m_activeTextureUnit; | 234 GLenum m_activeTextureUnit; |
230 | 235 |
231 OwnPtr<WebGraphicsContext3D> m_context; | 236 OwnPtr<WebGraphicsContext3D> m_context; |
232 OwnPtr<Extensions3DUtil> m_extensionsUtil; | 237 OwnPtr<Extensions3DUtil> m_extensionsUtil; |
233 IntSize m_size; | 238 IntSize m_size; |
234 WebGraphicsContext3D::Attributes m_requestedAttributes; | 239 WebGraphicsContext3D::Attributes m_requestedAttributes; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 WebGraphicsContext3D::Attributes m_actualAttributes; | 278 WebGraphicsContext3D::Attributes m_actualAttributes; |
274 unsigned m_internalColorFormat; | 279 unsigned m_internalColorFormat; |
275 unsigned m_colorFormat; | 280 unsigned m_colorFormat; |
276 unsigned m_internalRenderbufferFormat; | 281 unsigned m_internalRenderbufferFormat; |
277 int m_maxTextureSize; | 282 int m_maxTextureSize; |
278 int m_sampleCount; | 283 int m_sampleCount; |
279 int m_packAlignment; | 284 int m_packAlignment; |
280 bool m_destructionInProgress; | 285 bool m_destructionInProgress; |
281 bool m_isHidden; | 286 bool m_isHidden; |
282 SkFilterQuality m_filterQuality; | 287 SkFilterQuality m_filterQuality; |
| 288 bool m_RGBTextureSupported; |
283 | 289 |
284 OwnPtr<WebExternalTextureLayer> m_layer; | 290 OwnPtr<WebExternalTextureLayer> m_layer; |
285 | 291 |
286 // All of the mailboxes that this DrawingBuffer has ever created. | 292 // All of the mailboxes that this DrawingBuffer has ever created. |
287 Vector<RefPtr<MailboxInfo>> m_textureMailboxes; | 293 Vector<RefPtr<MailboxInfo>> m_textureMailboxes; |
288 // Mailboxes that were released by the compositor can be used again by this
DrawingBuffer. | 294 // Mailboxes that were released by the compositor can be used again by this
DrawingBuffer. |
289 Deque<WebExternalTextureMailbox> m_recycledMailboxQueue; | 295 Deque<WebExternalTextureMailbox> m_recycledMailboxQueue; |
290 | 296 |
291 // If the width and height of the Canvas's backing store don't | 297 // If the width and height of the Canvas's backing store don't |
292 // match those that we were given in the most recent call to | 298 // match those that we were given in the most recent call to |
293 // reshape(), then we need an intermediate bitmap to read back the | 299 // reshape(), then we need an intermediate bitmap to read back the |
294 // frame buffer into. This seems to happen when CSS styles are | 300 // frame buffer into. This seems to happen when CSS styles are |
295 // used to resize the Canvas. | 301 // used to resize the Canvas. |
296 SkBitmap m_resizingBitmap; | 302 SkBitmap m_resizingBitmap; |
297 | 303 |
298 // Used to flip a bitmap vertically. | 304 // Used to flip a bitmap vertically. |
299 Vector<uint8_t> m_scanline; | 305 Vector<uint8_t> m_scanline; |
| 306 |
| 307 GPUBlackList m_gpuBlackList; |
300 }; | 308 }; |
301 | 309 |
302 } // namespace blink | 310 } // namespace blink |
303 | 311 |
304 #endif // DrawingBuffer_h | 312 #endif // DrawingBuffer_h |
OLD | NEW |