| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 class WebLayer; | 70 class WebLayer; |
| 71 | 71 |
| 72 // Manages a rendering target (framebuffer + attachment) for a canvas. Can | 72 // Manages a rendering target (framebuffer + attachment) for a canvas. Can |
| 73 // publish its rendering results to a WebLayer for compositing. | 73 // publish its rendering results to a WebLayer for compositing. |
| 74 class PLATFORM_EXPORT DrawingBuffer | 74 class PLATFORM_EXPORT DrawingBuffer |
| 75 : public NON_EXPORTED_BASE(cc::TextureLayerClient), | 75 : public NON_EXPORTED_BASE(cc::TextureLayerClient), |
| 76 public RefCounted<DrawingBuffer> { | 76 public RefCounted<DrawingBuffer> { |
| 77 WTF_MAKE_NONCOPYABLE(DrawingBuffer); | 77 WTF_MAKE_NONCOPYABLE(DrawingBuffer); |
| 78 | 78 |
| 79 public: | 79 public: |
| 80 class Client { |
| 81 public: |
| 82 // Returns true if the DrawingBuffer is currently bound for draw. |
| 83 virtual bool DrawingBufferClientIsBoundForDraw() = 0; |
| 84 virtual void DrawingBufferClientRestoreScissorTest() = 0; |
| 85 // Restores the mask and clear value for color, depth, and stencil buffers. |
| 86 virtual void DrawingBufferClientRestoreMaskAndClearValues() = 0; |
| 87 virtual void DrawingBufferClientRestorePixelPackAlignment() = 0; |
| 88 // Restores the GL_TEXTURE_2D binding for the active texture unit only. |
| 89 virtual void DrawingBufferClientRestoreTexture2DBinding() = 0; |
| 90 virtual void DrawingBufferClientRestoreRenderbufferBinding() = 0; |
| 91 virtual void DrawingBufferClientRestoreFramebufferBinding() = 0; |
| 92 virtual void DrawingBufferClientRestorePixelUnpackBufferBinding() = 0; |
| 93 }; |
| 94 |
| 80 enum PreserveDrawingBuffer { | 95 enum PreserveDrawingBuffer { |
| 81 Preserve, | 96 Preserve, |
| 82 Discard, | 97 Discard, |
| 83 }; | 98 }; |
| 84 enum WebGLVersion { | 99 enum WebGLVersion { |
| 85 WebGL1, | 100 WebGL1, |
| 86 WebGL2, | 101 WebGL2, |
| 87 }; | 102 }; |
| 88 | 103 |
| 89 enum ChromiumImageUsage { | 104 enum ChromiumImageUsage { |
| 90 AllowChromiumImage, | 105 AllowChromiumImage, |
| 91 DisallowChromiumImage, | 106 DisallowChromiumImage, |
| 92 }; | 107 }; |
| 93 | 108 |
| 94 static PassRefPtr<DrawingBuffer> create( | 109 static PassRefPtr<DrawingBuffer> create( |
| 95 std::unique_ptr<WebGraphicsContext3DProvider>, | 110 std::unique_ptr<WebGraphicsContext3DProvider>, |
| 111 Client*, |
| 96 const IntSize&, | 112 const IntSize&, |
| 97 bool premultipliedAlpha, | 113 bool premultipliedAlpha, |
| 98 bool wantAlphaChannel, | 114 bool wantAlphaChannel, |
| 99 bool wantDepthBuffer, | 115 bool wantDepthBuffer, |
| 100 bool wantStencilBuffer, | 116 bool wantStencilBuffer, |
| 101 bool wantAntialiasing, | 117 bool wantAntialiasing, |
| 102 PreserveDrawingBuffer, | 118 PreserveDrawingBuffer, |
| 103 WebGLVersion, | 119 WebGLVersion, |
| 104 ChromiumImageUsage); | 120 ChromiumImageUsage); |
| 105 static void forceNextDrawingBufferCreationToFail(); | 121 static void forceNextDrawingBufferCreationToFail(); |
| 106 | 122 |
| 107 ~DrawingBuffer() override; | 123 ~DrawingBuffer() override; |
| 108 | 124 |
| 109 // Destruction will be completed after all mailboxes are released. | 125 // Destruction will be completed after all mailboxes are released. |
| 110 void beginDestruction(); | 126 void beginDestruction(); |
| 111 | 127 |
| 112 // Issues a glClear() on all framebuffers associated with this DrawingBuffer. | 128 // Issues a glClear() on all framebuffers associated with this DrawingBuffer. |
| 113 // The caller is responsible for making the context current and setting the | |
| 114 // clear values and masks. Modifies the framebuffer binding. | |
| 115 void clearFramebuffers(GLbitfield clearMask); | 129 void clearFramebuffers(GLbitfield clearMask); |
| 116 | 130 |
| 117 // Indicates whether the DrawingBuffer internally allocated a packed | 131 // Indicates whether the DrawingBuffer internally allocated a packed |
| 118 // depth-stencil renderbuffer in the situation where the end user only asked | 132 // depth-stencil renderbuffer in the situation where the end user only asked |
| 119 // for a depth buffer. In this case, we need to upgrade clears of the depth | 133 // for a depth buffer. In this case, we need to upgrade clears of the depth |
| 120 // buffer to clears of the depth and stencil buffers in order to avoid | 134 // buffer to clears of the depth and stencil buffers in order to avoid |
| 121 // performance problems on some GPUs. | 135 // performance problems on some GPUs. |
| 122 bool hasImplicitStencilBuffer() const { return m_hasImplicitStencilBuffer; } | 136 bool hasImplicitStencilBuffer() const { return m_hasImplicitStencilBuffer; } |
| 123 bool hasDepthBuffer() const { return !!m_depthStencilBuffer; } | 137 bool hasDepthBuffer() const { return !!m_depthStencilBuffer; } |
| 124 bool hasStencilBuffer() const { return !!m_depthStencilBuffer; } | 138 bool hasStencilBuffer() const { return !!m_depthStencilBuffer; } |
| 125 | 139 |
| 126 // Given the desired buffer size, provides the largest dimensions that will | 140 // Given the desired buffer size, provides the largest dimensions that will |
| 127 // fit in the pixel budget. | 141 // fit in the pixel budget. |
| 128 static IntSize adjustSize(const IntSize& desiredSize, | 142 static IntSize adjustSize(const IntSize& desiredSize, |
| 129 const IntSize& curSize, | 143 const IntSize& curSize, |
| 130 int maxTextureSize); | 144 int maxTextureSize); |
| 131 | 145 |
| 132 // Resizes (or allocates if necessary) all buffers attached to the default | 146 // Resizes (or allocates if necessary) all buffers attached to the default |
| 133 // framebuffer. Returns whether the operation was successful. Leaves GL | 147 // framebuffer. Returns whether the operation was successful. |
| 134 // bindings dirtied. | 148 bool resize(const IntSize&); |
| 135 bool reset(const IntSize&); | |
| 136 | 149 |
| 137 // Bind the default framebuffer to |target|. |target| must be | 150 // Bind the default framebuffer to |target|. |target| must be |
| 138 // GL_FRAMEBUFFER, GL_READ_FRAMEBUFFER, or GL_DRAW_FRAMEBUFFER. | 151 // GL_FRAMEBUFFER, GL_READ_FRAMEBUFFER, or GL_DRAW_FRAMEBUFFER. |
| 139 void bind(GLenum target); | 152 void bind(GLenum target); |
| 140 IntSize size() const { return m_size; } | 153 IntSize size() const { return m_size; } |
| 141 | 154 |
| 142 // Copies the multisample color buffer to the normal color buffer and leaves | 155 // Resolves the multisample color buffer to the normal color buffer and leaves |
| 143 // m_fbo bound. | 156 // the resolved color buffer bound to GL_READ_FRAMEBUFFER and |
| 144 void commit(); | 157 // GL_DRAW_FRAMEBUFFER. |
| 145 | 158 void resolveAndBindForReadAndDraw(); |
| 146 // commit should copy the full multisample buffer, and not respect the | |
| 147 // current scissor bounds. Track the state of the scissor test so that it | |
| 148 // can be disabled during calls to commit. | |
| 149 void setScissorEnabled(bool scissorEnabled) { | |
| 150 m_scissorEnabled = scissorEnabled; | |
| 151 } | |
| 152 | |
| 153 // The DrawingBuffer needs to track the texture bound to texture unit 0. | |
| 154 // The bound texture is tracked to avoid costly queries during rendering. | |
| 155 void setTexture2DBinding(GLuint texture) { m_texture2DBinding = texture; } | |
| 156 | |
| 157 void setPixelUnpackBufferBinding(GLuint buffer) { | |
| 158 DCHECK(m_webGLVersion > WebGL1); | |
| 159 m_pixelUnpackBufferBinding = buffer; | |
| 160 } | |
| 161 | |
| 162 void notifyBufferDeleted(GLuint buffer) { | |
| 163 if (m_webGLVersion > WebGL1 && buffer == m_pixelUnpackBufferBinding) { | |
| 164 setPixelUnpackBufferBinding(0); | |
| 165 } | |
| 166 } | |
| 167 | |
| 168 // The DrawingBuffer needs to track the currently bound framebuffer so it | |
| 169 // restore the binding when needed. | |
| 170 void setFramebufferBinding(GLenum target, GLuint fbo) { | |
| 171 switch (target) { | |
| 172 case GL_FRAMEBUFFER: | |
| 173 m_drawFramebufferBinding = fbo; | |
| 174 m_readFramebufferBinding = fbo; | |
| 175 break; | |
| 176 case GL_DRAW_FRAMEBUFFER: | |
| 177 m_drawFramebufferBinding = fbo; | |
| 178 break; | |
| 179 case GL_READ_FRAMEBUFFER: | |
| 180 m_readFramebufferBinding = fbo; | |
| 181 break; | |
| 182 default: | |
| 183 ASSERT(0); | |
| 184 } | |
| 185 } | |
| 186 | |
| 187 // The DrawingBuffer needs to track the color mask and clear color so that | |
| 188 // it can restore it when needed. | |
| 189 void setClearColor(GLfloat* clearColor) { | |
| 190 memcpy(m_clearColor, clearColor, 4 * sizeof(GLfloat)); | |
| 191 } | |
| 192 | |
| 193 void setColorMask(GLboolean* colorMask) { | |
| 194 memcpy(m_colorMask, colorMask, 4 * sizeof(GLboolean)); | |
| 195 } | |
| 196 | |
| 197 // The DrawingBuffer needs to track the currently bound renderbuffer so it | |
| 198 // restore the binding when needed. | |
| 199 void setRenderbufferBinding(GLuint renderbuffer) { | |
| 200 m_renderbufferBinding = renderbuffer; | |
| 201 } | |
| 202 | |
| 203 // Track the currently active texture unit. Texture unit 0 is used as host for | |
| 204 // a scratch texture. | |
| 205 void setActiveTextureUnit(GLint textureUnit) { | |
| 206 m_activeTextureUnit = textureUnit; | |
| 207 } | |
| 208 | 159 |
| 209 bool multisample() const; | 160 bool multisample() const; |
| 210 | 161 |
| 211 GLuint framebuffer() const; | |
| 212 | |
| 213 bool discardFramebufferSupported() const { | 162 bool discardFramebufferSupported() const { |
| 214 return m_discardFramebufferSupported; | 163 return m_discardFramebufferSupported; |
| 215 } | 164 } |
| 216 | 165 |
| 217 void markContentsChanged(); | 166 void markContentsChanged(); |
| 218 void setBufferClearNeeded(bool); | 167 void setBufferClearNeeded(bool); |
| 219 bool bufferClearNeeded() const; | 168 bool bufferClearNeeded() const; |
| 220 void setIsHidden(bool); | 169 void setIsHidden(bool); |
| 221 void setFilterQuality(SkFilterQuality); | 170 void setFilterQuality(SkFilterQuality); |
| 222 | 171 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 239 bool PrepareTextureMailbox( | 188 bool PrepareTextureMailbox( |
| 240 cc::TextureMailbox* outMailbox, | 189 cc::TextureMailbox* outMailbox, |
| 241 std::unique_ptr<cc::SingleReleaseCallback>* outReleaseCallback) override; | 190 std::unique_ptr<cc::SingleReleaseCallback>* outReleaseCallback) override; |
| 242 | 191 |
| 243 // Returns a StaticBitmapImage backed by a texture containing the current | 192 // Returns a StaticBitmapImage backed by a texture containing the current |
| 244 // contents of the front buffer. This is done without any pixel copies. The | 193 // contents of the front buffer. This is done without any pixel copies. The |
| 245 // texture in the ImageBitmap is from the active ContextProvider on the | 194 // texture in the ImageBitmap is from the active ContextProvider on the |
| 246 // DrawingBuffer. | 195 // DrawingBuffer. |
| 247 PassRefPtr<StaticBitmapImage> transferToStaticBitmapImage(); | 196 PassRefPtr<StaticBitmapImage> transferToStaticBitmapImage(); |
| 248 | 197 |
| 249 // Destroys the TEXTURE_2D binding for the owned context | |
| 250 bool copyToPlatformTexture(gpu::gles2::GLES2Interface*, | 198 bool copyToPlatformTexture(gpu::gles2::GLES2Interface*, |
| 251 GLuint texture, | 199 GLuint texture, |
| 252 GLenum internalFormat, | 200 GLenum internalFormat, |
| 253 GLenum destType, | 201 GLenum destType, |
| 254 GLint level, | 202 GLint level, |
| 255 bool premultiplyAlpha, | 203 bool premultiplyAlpha, |
| 256 bool flipY, | 204 bool flipY, |
| 257 SourceDrawingBuffer); | 205 SourceDrawingBuffer); |
| 258 | 206 |
| 259 void setPackAlignment(GLint param); | |
| 260 | |
| 261 bool paintRenderingResultsToImageData(int&, | 207 bool paintRenderingResultsToImageData(int&, |
| 262 int&, | 208 int&, |
| 263 SourceDrawingBuffer, | 209 SourceDrawingBuffer, |
| 264 WTF::ArrayBufferContents&); | 210 WTF::ArrayBufferContents&); |
| 265 | 211 |
| 266 int sampleCount() const { return m_sampleCount; } | 212 int sampleCount() const { return m_sampleCount; } |
| 267 bool explicitResolveOfMultisampleData() const { | 213 bool explicitResolveOfMultisampleData() const { |
| 268 return m_antiAliasingMode == MSAAExplicitResolve; | 214 return m_antiAliasingMode == MSAAExplicitResolve; |
| 269 } | 215 } |
| 270 | 216 |
| 271 void restorePixelUnpackBufferBindings(); | 217 // Rebind the read and draw framebuffers that WebGL is expecting. |
| 272 | |
| 273 // Bind to m_drawFramebufferBinding or m_readFramebufferBinding if it's not 0. | |
| 274 // Otherwise, bind to the default FBO. | |
| 275 void restoreFramebufferBindings(); | 218 void restoreFramebufferBindings(); |
| 276 | 219 |
| 277 void restoreTextureBindings(); | |
| 278 | |
| 279 void addNewMailboxCallback(std::unique_ptr<WTF::Closure> closure) { | 220 void addNewMailboxCallback(std::unique_ptr<WTF::Closure> closure) { |
| 280 m_newMailboxCallback = std::move(closure); | 221 m_newMailboxCallback = std::move(closure); |
| 281 } | 222 } |
| 282 | 223 |
| 283 protected: // For unittests | 224 protected: // For unittests |
| 284 DrawingBuffer(std::unique_ptr<WebGraphicsContext3DProvider>, | 225 DrawingBuffer(std::unique_ptr<WebGraphicsContext3DProvider>, |
| 285 std::unique_ptr<Extensions3DUtil>, | 226 std::unique_ptr<Extensions3DUtil>, |
| 227 Client*, |
| 286 bool discardFramebufferSupported, | 228 bool discardFramebufferSupported, |
| 287 bool wantAlphaChannel, | 229 bool wantAlphaChannel, |
| 288 bool premultipliedAlpha, | 230 bool premultipliedAlpha, |
| 289 PreserveDrawingBuffer, | 231 PreserveDrawingBuffer, |
| 290 WebGLVersion, | 232 WebGLVersion, |
| 291 bool wantsDepth, | 233 bool wantsDepth, |
| 292 bool wantsStencil, | 234 bool wantsStencil, |
| 293 ChromiumImageUsage); | 235 ChromiumImageUsage); |
| 294 | 236 |
| 295 bool initialize(const IntSize&, bool useMultisampling); | 237 bool initialize(const IntSize&, bool useMultisampling); |
| 296 | 238 |
| 297 // Shared memory bitmaps that were released by the compositor and can be used | 239 // Shared memory bitmaps that were released by the compositor and can be used |
| 298 // again by this DrawingBuffer. | 240 // again by this DrawingBuffer. |
| 299 struct RecycledBitmap { | 241 struct RecycledBitmap { |
| 300 std::unique_ptr<cc::SharedBitmap> bitmap; | 242 std::unique_ptr<cc::SharedBitmap> bitmap; |
| 301 IntSize size; | 243 IntSize size; |
| 302 }; | 244 }; |
| 303 Vector<RecycledBitmap> m_recycledBitmaps; | 245 Vector<RecycledBitmap> m_recycledBitmaps; |
| 304 | 246 |
| 305 private: | 247 private: |
| 248 friend class ScopedStateRestorer; |
| 249 friend class ColorBuffer; |
| 250 |
| 251 // This structure should wrap all public entrypoints that may modify GL state. |
| 252 // It will restore all state when it drops out of scope. |
| 253 class ScopedStateRestorer { |
| 254 public: |
| 255 ScopedStateRestorer(DrawingBuffer*); |
| 256 ~ScopedStateRestorer(); |
| 257 |
| 258 // Mark parts of the state that are dirty and need to be restored. |
| 259 void setClearStateDirty() { m_clearStateDirty = true; } |
| 260 void setPixelPackAlignmentDirty() { m_pixelPackAlignmentDirty = true; } |
| 261 void setTextureBindingDirty() { m_textureBindingDirty = true; } |
| 262 void setRenderbufferBindingDirty() { m_renderbufferBindingDirty = true; } |
| 263 void setFramebufferBindingDirty() { m_framebufferBindingDirty = true; } |
| 264 void setPixelUnpackBufferBindingDirty() { |
| 265 m_pixelUnpackBufferBindingDirty = true; |
| 266 } |
| 267 |
| 268 private: |
| 269 RefPtr<DrawingBuffer> m_drawingBuffer; |
| 270 bool m_clearStateDirty = false; |
| 271 bool m_pixelPackAlignmentDirty = false; |
| 272 bool m_textureBindingDirty = false; |
| 273 bool m_renderbufferBindingDirty = false; |
| 274 bool m_framebufferBindingDirty = false; |
| 275 bool m_pixelUnpackBufferBindingDirty = false; |
| 276 }; |
| 277 |
| 306 // All parameters necessary to generate the texture for the ColorBuffer. | 278 // All parameters necessary to generate the texture for the ColorBuffer. |
| 307 struct ColorBufferParameters { | 279 struct ColorBufferParameters { |
| 308 DISALLOW_NEW(); | 280 DISALLOW_NEW(); |
| 309 GLenum target = 0; | 281 GLenum target = 0; |
| 310 GLenum internalColorFormat = 0; | 282 GLenum internalColorFormat = 0; |
| 311 | 283 |
| 312 // The internal color format used when allocating storage for the | 284 // The internal color format used when allocating storage for the |
| 313 // texture. This may be different from internalColorFormat if RGB | 285 // texture. This may be different from internalColorFormat if RGB |
| 314 // emulation is required. | 286 // emulation is required. |
| 315 GLenum creationInternalColorFormat = 0; | 287 GLenum creationInternalColorFormat = 0; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 342 gpu::SyncToken produceSyncToken; | 314 gpu::SyncToken produceSyncToken; |
| 343 | 315 |
| 344 // The sync token for when this buffer was received back from the | 316 // The sync token for when this buffer was received back from the |
| 345 // compositor. | 317 // compositor. |
| 346 gpu::SyncToken receiveSyncToken; | 318 gpu::SyncToken receiveSyncToken; |
| 347 | 319 |
| 348 private: | 320 private: |
| 349 WTF_MAKE_NONCOPYABLE(ColorBuffer); | 321 WTF_MAKE_NONCOPYABLE(ColorBuffer); |
| 350 }; | 322 }; |
| 351 | 323 |
| 324 // The same as clearFramebuffers(), but leaves GL state dirty. |
| 325 void clearFramebuffersInternal(GLbitfield clearMask); |
| 326 |
| 327 // The same as reset(), but leaves GL state dirty. |
| 328 bool resizeFramebufferInternal(const IntSize&); |
| 329 |
| 330 // The same as commit(), but leaves GL state dirty. |
| 331 void resolveMultisampleFramebufferInternal(); |
| 332 |
| 352 bool prepareTextureMailboxInternal( | 333 bool prepareTextureMailboxInternal( |
| 353 cc::TextureMailbox* outMailbox, | 334 cc::TextureMailbox* outMailbox, |
| 354 std::unique_ptr<cc::SingleReleaseCallback>* outReleaseCallback, | 335 std::unique_ptr<cc::SingleReleaseCallback>* outReleaseCallback, |
| 355 bool forceGpuResult); | 336 bool forceGpuResult); |
| 356 | 337 |
| 357 // Helper functions to be called only by prepareTextureMailboxInternal. | 338 // Helper functions to be called only by prepareTextureMailboxInternal. |
| 358 bool finishPrepareTextureMailboxGpu( | 339 bool finishPrepareTextureMailboxGpu( |
| 359 cc::TextureMailbox* outMailbox, | 340 cc::TextureMailbox* outMailbox, |
| 360 std::unique_ptr<cc::SingleReleaseCallback>* outReleaseCallback); | 341 std::unique_ptr<cc::SingleReleaseCallback>* outReleaseCallback); |
| 361 bool finishPrepareTextureMailboxSoftware( | 342 bool finishPrepareTextureMailboxSoftware( |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 // implemented by forwarding all draw operations to a multisample | 408 // implemented by forwarding all draw operations to a multisample |
| 428 // renderbuffer, which is resolved before any read operations or swaps. | 409 // renderbuffer, which is resolved before any read operations or swaps. |
| 429 bool wantExplicitResolve(); | 410 bool wantExplicitResolve(); |
| 430 | 411 |
| 431 // Whether the WebGL client wants a depth or stencil buffer. | 412 // Whether the WebGL client wants a depth or stencil buffer. |
| 432 bool wantDepthOrStencil(); | 413 bool wantDepthOrStencil(); |
| 433 | 414 |
| 434 // The format to use when creating a multisampled renderbuffer. | 415 // The format to use when creating a multisampled renderbuffer. |
| 435 GLenum getMultisampledRenderbufferFormat(); | 416 GLenum getMultisampledRenderbufferFormat(); |
| 436 | 417 |
| 418 // Weak, reset by beginDestruction. |
| 419 Client* m_client = nullptr; |
| 420 |
| 437 const PreserveDrawingBuffer m_preserveDrawingBuffer; | 421 const PreserveDrawingBuffer m_preserveDrawingBuffer; |
| 438 const WebGLVersion m_webGLVersion; | 422 const WebGLVersion m_webGLVersion; |
| 439 bool m_scissorEnabled = false; | |
| 440 GLuint m_texture2DBinding = 0; | |
| 441 GLuint m_pixelUnpackBufferBinding = 0; | |
| 442 GLuint m_drawFramebufferBinding = 0; | |
| 443 GLuint m_readFramebufferBinding = 0; | |
| 444 GLuint m_renderbufferBinding = 0; | |
| 445 GLenum m_activeTextureUnit = GL_TEXTURE0; | |
| 446 GLfloat m_clearColor[4]; | |
| 447 GLboolean m_colorMask[4]; | |
| 448 | 423 |
| 449 std::unique_ptr<WebGraphicsContext3DProvider> m_contextProvider; | 424 std::unique_ptr<WebGraphicsContext3DProvider> m_contextProvider; |
| 450 // Lifetime is tied to the m_contextProvider. | 425 // Lifetime is tied to the m_contextProvider. |
| 451 gpu::gles2::GLES2Interface* m_gl; | 426 gpu::gles2::GLES2Interface* m_gl; |
| 452 std::unique_ptr<Extensions3DUtil> m_extensionsUtil; | 427 std::unique_ptr<Extensions3DUtil> m_extensionsUtil; |
| 453 IntSize m_size = {-1, -1}; | 428 IntSize m_size = {-1, -1}; |
| 454 const bool m_discardFramebufferSupported; | 429 const bool m_discardFramebufferSupported; |
| 455 const bool m_wantAlphaChannel; | 430 const bool m_wantAlphaChannel; |
| 456 const bool m_premultipliedAlpha; | 431 const bool m_premultipliedAlpha; |
| 457 const bool m_softwareRendering; | 432 const bool m_softwareRendering; |
| 458 bool m_hasImplicitStencilBuffer = false; | 433 bool m_hasImplicitStencilBuffer = false; |
| 459 bool m_storageTextureSupported = false; | 434 bool m_storageTextureSupported = false; |
| 460 | 435 |
| 461 std::unique_ptr<WTF::Closure> m_newMailboxCallback; | 436 std::unique_ptr<WTF::Closure> m_newMailboxCallback; |
| 462 | 437 |
| 438 // The current state restorer, which is used to track state dirtying. It is in |
| 439 // error to dirty state shared with WebGL while there is no existing state |
| 440 // restorer. It is also in error to instantiate two state restorers at once. |
| 441 ScopedStateRestorer* m_stateRestorer = nullptr; |
| 442 |
| 463 // This is used when the user requests either a depth or stencil buffer. | 443 // This is used when the user requests either a depth or stencil buffer. |
| 464 GLuint m_depthStencilBuffer = 0; | 444 GLuint m_depthStencilBuffer = 0; |
| 465 | 445 |
| 466 // When wantExplicitResolve() returns true, the target of all draw | 446 // When wantExplicitResolve() returns true, the target of all draw |
| 467 // operations. | 447 // operations. |
| 468 GLuint m_multisampleFBO = 0; | 448 GLuint m_multisampleFBO = 0; |
| 469 | 449 |
| 470 // The id of the renderbuffer storage for |m_multisampleFBO|. | 450 // The id of the renderbuffer storage for |m_multisampleFBO|. |
| 471 GLuint m_multisampleRenderbuffer = 0; | 451 GLuint m_multisampleRenderbuffer = 0; |
| 472 | 452 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 499 None, | 479 None, |
| 500 MSAAImplicitResolve, | 480 MSAAImplicitResolve, |
| 501 MSAAExplicitResolve, | 481 MSAAExplicitResolve, |
| 502 ScreenSpaceAntialiasing, | 482 ScreenSpaceAntialiasing, |
| 503 }; | 483 }; |
| 504 | 484 |
| 505 AntialiasingMode m_antiAliasingMode = None; | 485 AntialiasingMode m_antiAliasingMode = None; |
| 506 | 486 |
| 507 int m_maxTextureSize = 0; | 487 int m_maxTextureSize = 0; |
| 508 int m_sampleCount = 0; | 488 int m_sampleCount = 0; |
| 509 int m_packAlignment = 4; | |
| 510 bool m_destructionInProgress = false; | 489 bool m_destructionInProgress = false; |
| 511 bool m_isHidden = false; | 490 bool m_isHidden = false; |
| 512 SkFilterQuality m_filterQuality = kLow_SkFilterQuality; | 491 SkFilterQuality m_filterQuality = kLow_SkFilterQuality; |
| 513 | 492 |
| 514 std::unique_ptr<WebExternalTextureLayer> m_layer; | 493 std::unique_ptr<WebExternalTextureLayer> m_layer; |
| 515 | 494 |
| 516 // Mailboxes that were released by the compositor can be used again by this | 495 // Mailboxes that were released by the compositor can be used again by this |
| 517 // DrawingBuffer. | 496 // DrawingBuffer. |
| 518 Deque<RefPtr<ColorBuffer>> m_recycledColorBufferQueue; | 497 Deque<RefPtr<ColorBuffer>> m_recycledColorBufferQueue; |
| 519 | 498 |
| 520 // If the width and height of the Canvas's backing store don't | 499 // If the width and height of the Canvas's backing store don't |
| 521 // match those that we were given in the most recent call to | 500 // match those that we were given in the most recent call to |
| 522 // reshape(), then we need an intermediate bitmap to read back the | 501 // reshape(), then we need an intermediate bitmap to read back the |
| 523 // frame buffer into. This seems to happen when CSS styles are | 502 // frame buffer into. This seems to happen when CSS styles are |
| 524 // used to resize the Canvas. | 503 // used to resize the Canvas. |
| 525 SkBitmap m_resizingBitmap; | 504 SkBitmap m_resizingBitmap; |
| 526 | 505 |
| 527 // In the case of OffscreenCanvas, we do not want to enable the | 506 // In the case of OffscreenCanvas, we do not want to enable the |
| 528 // WebGLImageChromium flag, so we replace all the | 507 // WebGLImageChromium flag, so we replace all the |
| 529 // RuntimeEnabledFeatures::webGLImageChromiumEnabled() call with | 508 // RuntimeEnabledFeatures::webGLImageChromiumEnabled() call with |
| 530 // shouldUseChromiumImage() calls, and set m_chromiumImageUsage to | 509 // shouldUseChromiumImage() calls, and set m_chromiumImageUsage to |
| 531 // DisallowChromiumImage in the case of OffscreenCanvas. | 510 // DisallowChromiumImage in the case of OffscreenCanvas. |
| 532 ChromiumImageUsage m_chromiumImageUsage; | 511 ChromiumImageUsage m_chromiumImageUsage; |
| 533 bool shouldUseChromiumImage(); | 512 bool shouldUseChromiumImage(); |
| 534 }; | 513 }; |
| 535 | 514 |
| 536 } // namespace blink | 515 } // namespace blink |
| 537 | 516 |
| 538 #endif // DrawingBuffer_h | 517 #endif // DrawingBuffer_h |
| OLD | NEW |