| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 int sampleCount() const { return m_sampleCount; } | 160 int sampleCount() const { return m_sampleCount; } |
| 161 bool explicitResolveOfMultisampleData() const { return m_antiAliasingMode ==
MSAAExplicitResolve; } | 161 bool explicitResolveOfMultisampleData() const { return m_antiAliasingMode ==
MSAAExplicitResolve; } |
| 162 | 162 |
| 163 // Bind to m_drawFramebufferBinding or m_readFramebufferBinding if it's not
0. | 163 // Bind to m_drawFramebufferBinding or m_readFramebufferBinding if it's not
0. |
| 164 // Otherwise, bind to the default FBO. | 164 // Otherwise, bind to the default FBO. |
| 165 void restoreFramebufferBindings(); | 165 void restoreFramebufferBindings(); |
| 166 | 166 |
| 167 void addNewMailboxCallback(PassOwnPtr<Closure> closure) { m_newMailboxCallba
ck = std::move(closure); } | 167 void addNewMailboxCallback(PassOwnPtr<Closure> closure) { m_newMailboxCallba
ck = std::move(closure); } |
| 168 | 168 |
| 169 protected: // For unittests | 169 protected: // For unittests |
| 170 struct PLATFORM_EXPORT SupportedExtensions { | |
| 171 SupportedExtensions(); | |
| 172 | |
| 173 bool multisample; | |
| 174 bool depth24; | |
| 175 bool discardFramebuffer; | |
| 176 }; | |
| 177 | |
| 178 DrawingBuffer( | 170 DrawingBuffer( |
| 179 PassOwnPtr<WebGraphicsContext3D>, | 171 PassOwnPtr<WebGraphicsContext3D>, |
| 180 PassOwnPtr<Extensions3DUtil>, | 172 PassOwnPtr<Extensions3DUtil>, |
| 181 const SupportedExtensions&, | 173 bool multisampleExtensionSupported, |
| 174 bool packedDepthStencilExtensionSupported, |
| 175 bool discardFramebufferSupported, |
| 182 PreserveDrawingBuffer, | 176 PreserveDrawingBuffer, |
| 183 WebGraphicsContext3D::Attributes requestedAttributes); | 177 WebGraphicsContext3D::Attributes requestedAttributes); |
| 184 | 178 |
| 185 bool initialize(const IntSize&); | 179 bool initialize(const IntSize&); |
| 186 | 180 |
| 187 private: | 181 private: |
| 188 struct TextureParameters { | 182 struct TextureParameters { |
| 189 DISALLOW_NEW(); | 183 DISALLOW_NEW(); |
| 190 WGC3Denum target; | 184 WGC3Denum target; |
| 191 WGC3Denum internalColorFormat; | 185 WGC3Denum internalColorFormat; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 Platform3DObject m_texture2DBinding; | 291 Platform3DObject m_texture2DBinding; |
| 298 Platform3DObject m_drawFramebufferBinding; | 292 Platform3DObject m_drawFramebufferBinding; |
| 299 Platform3DObject m_readFramebufferBinding; | 293 Platform3DObject m_readFramebufferBinding; |
| 300 GLenum m_activeTextureUnit; | 294 GLenum m_activeTextureUnit; |
| 301 | 295 |
| 302 OwnPtr<WebGraphicsContext3D> m_context; | 296 OwnPtr<WebGraphicsContext3D> m_context; |
| 303 OwnPtr<Extensions3DUtil> m_extensionsUtil; | 297 OwnPtr<Extensions3DUtil> m_extensionsUtil; |
| 304 IntSize m_size; | 298 IntSize m_size; |
| 305 WebGraphicsContext3D::Attributes m_requestedAttributes; | 299 WebGraphicsContext3D::Attributes m_requestedAttributes; |
| 306 bool m_multisampleExtensionSupported; | 300 bool m_multisampleExtensionSupported; |
| 307 bool m_depth24ExtensionSupported; | 301 bool m_packedDepthStencilExtensionSupported; |
| 308 bool m_discardFramebufferSupported; | 302 bool m_discardFramebufferSupported; |
| 309 Platform3DObject m_fbo; | 303 Platform3DObject m_fbo; |
| 310 // DrawingBuffer's output is double-buffered. m_colorBuffer is the back buff
er. | 304 // DrawingBuffer's output is double-buffered. m_colorBuffer is the back buff
er. |
| 311 TextureInfo m_colorBuffer; | 305 TextureInfo m_colorBuffer; |
| 312 struct FrontBufferInfo { | 306 struct FrontBufferInfo { |
| 313 TextureInfo texInfo; | 307 TextureInfo texInfo; |
| 314 WebExternalTextureMailbox mailbox; | 308 WebExternalTextureMailbox mailbox; |
| 315 }; | 309 }; |
| 316 FrontBufferInfo m_frontColorBuffer; | 310 FrontBufferInfo m_frontColorBuffer; |
| 317 | 311 |
| 318 OwnPtr<Closure> m_newMailboxCallback; | 312 OwnPtr<Closure> m_newMailboxCallback; |
| 319 | 313 |
| 314 // This is used when we have OES_packed_depth_stencil. |
| 320 Platform3DObject m_depthStencilBuffer; | 315 Platform3DObject m_depthStencilBuffer; |
| 321 | 316 |
| 322 // This is used when we only request depth and the OES_depth24 extension is
available. | 317 // These are used when we don't. |
| 323 Platform3DObject m_depthBuffer; | 318 Platform3DObject m_depthBuffer; |
| 319 Platform3DObject m_stencilBuffer; |
| 324 | 320 |
| 325 // For multisampling. | 321 // For multisampling. |
| 326 Platform3DObject m_multisampleFBO; | 322 Platform3DObject m_multisampleFBO; |
| 327 Platform3DObject m_multisampleColorBuffer; | 323 Platform3DObject m_multisampleColorBuffer; |
| 328 | 324 |
| 329 // True if our contents have been modified since the last presentation of th
is buffer. | 325 // True if our contents have been modified since the last presentation of th
is buffer. |
| 330 bool m_contentsChanged; | 326 bool m_contentsChanged; |
| 331 | 327 |
| 332 // True if commit() has been called since the last time markContentsChanged(
) had been called. | 328 // True if commit() has been called since the last time markContentsChanged(
) had been called. |
| 333 bool m_contentsChangeCommitted; | 329 bool m_contentsChangeCommitted; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 364 // used to resize the Canvas. | 360 // used to resize the Canvas. |
| 365 SkBitmap m_resizingBitmap; | 361 SkBitmap m_resizingBitmap; |
| 366 | 362 |
| 367 // Used to flip a bitmap vertically. | 363 // Used to flip a bitmap vertically. |
| 368 Vector<uint8_t> m_scanline; | 364 Vector<uint8_t> m_scanline; |
| 369 }; | 365 }; |
| 370 | 366 |
| 371 } // namespace blink | 367 } // namespace blink |
| 372 | 368 |
| 373 #endif // DrawingBuffer_h | 369 #endif // DrawingBuffer_h |
| OLD | NEW |