| 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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 GLenum creationInternalColorFormat = 0; | 316 GLenum creationInternalColorFormat = 0; |
| 317 GLenum colorFormat = 0; | 317 GLenum colorFormat = 0; |
| 318 }; | 318 }; |
| 319 | 319 |
| 320 // If we used CHROMIUM_image as the backing storage for our buffers, | 320 // If we used CHROMIUM_image as the backing storage for our buffers, |
| 321 // we need to know the mapping from texture id to image. | 321 // we need to know the mapping from texture id to image. |
| 322 struct TextureInfo { | 322 struct TextureInfo { |
| 323 DISALLOW_NEW(); | 323 DISALLOW_NEW(); |
| 324 GLuint textureId = 0; | 324 GLuint textureId = 0; |
| 325 GLuint imageId = 0; | 325 GLuint imageId = 0; |
| 326 bool immutable = false; | |
| 327 TextureParameters parameters; | 326 TextureParameters parameters; |
| 328 }; | 327 }; |
| 329 | 328 |
| 330 struct MailboxInfo : public RefCounted<MailboxInfo> { | 329 struct MailboxInfo : public RefCounted<MailboxInfo> { |
| 331 MailboxInfo() = default; | 330 MailboxInfo() = default; |
| 332 gpu::Mailbox mailbox; | 331 gpu::Mailbox mailbox; |
| 333 TextureInfo textureInfo; | 332 TextureInfo textureInfo; |
| 334 IntSize size; | 333 IntSize size; |
| 335 | 334 |
| 336 private: | 335 private: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 356 TextureParameters chromiumImageTextureParameters(); | 355 TextureParameters chromiumImageTextureParameters(); |
| 357 | 356 |
| 358 // The texture parameters to use for a default texture. | 357 // The texture parameters to use for a default texture. |
| 359 TextureParameters defaultTextureParameters(); | 358 TextureParameters defaultTextureParameters(); |
| 360 | 359 |
| 361 // Creates and binds a texture with the given parameters. Returns 0 on | 360 // Creates and binds a texture with the given parameters. Returns 0 on |
| 362 // failure, or the newly created texture id on success. The caller takes | 361 // failure, or the newly created texture id on success. The caller takes |
| 363 // ownership of the newly created texture. | 362 // ownership of the newly created texture. |
| 364 GLuint createColorTexture(const TextureParameters&); | 363 GLuint createColorTexture(const TextureParameters&); |
| 365 | 364 |
| 366 // Create the depth/stencil and multisample buffers, if needed. | |
| 367 bool resizeMultisampleFramebuffer(const IntSize&); | |
| 368 void resizeDepthStencil(const IntSize&); | |
| 369 | |
| 370 // Attempts to allocator storage for, or resize all buffers. Returns whether | 365 // Attempts to allocator storage for, or resize all buffers. Returns whether |
| 371 // the operation was successful. | 366 // the operation was successful. |
| 372 bool resizeDefaultFramebuffer(const IntSize&); | 367 bool resizeDefaultFramebuffer(const IntSize&); |
| 373 | 368 |
| 374 void clearPlatformLayer(); | 369 void clearPlatformLayer(); |
| 375 | 370 |
| 376 PassRefPtr<MailboxInfo> takeRecycledMailbox(); | 371 PassRefPtr<MailboxInfo> takeRecycledMailbox(); |
| 377 PassRefPtr<MailboxInfo> createNewMailbox(const TextureInfo&); | 372 PassRefPtr<MailboxInfo> createNewMailbox(const TextureInfo&); |
| 378 void deleteMailbox(const gpu::Mailbox&, const gpu::SyncToken&); | 373 void deleteMailbox(const gpu::Mailbox&, const gpu::SyncToken&); |
| 379 void freeRecycledMailboxes(); | 374 void freeRecycledMailboxes(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 void clearChromiumImageAlpha(const TextureInfo&); | 412 void clearChromiumImageAlpha(const TextureInfo&); |
| 418 | 413 |
| 419 // Tries to create a CHROMIUM_image backed texture if | 414 // Tries to create a CHROMIUM_image backed texture if |
| 420 // RuntimeEnabledFeatures::webGLImageChromiumEnabled() is true. On failure, | 415 // RuntimeEnabledFeatures::webGLImageChromiumEnabled() is true. On failure, |
| 421 // or if the flag is false, creates a default texture. | 416 // or if the flag is false, creates a default texture. |
| 422 TextureInfo createTextureAndAllocateMemory(const IntSize&); | 417 TextureInfo createTextureAndAllocateMemory(const IntSize&); |
| 423 | 418 |
| 424 // Creates and allocates space for a default texture. | 419 // Creates and allocates space for a default texture. |
| 425 TextureInfo createDefaultTextureAndAllocateMemory(const IntSize&); | 420 TextureInfo createDefaultTextureAndAllocateMemory(const IntSize&); |
| 426 | 421 |
| 427 void resizeTextureMemory(TextureInfo*, const IntSize&); | |
| 428 | |
| 429 // Attaches |m_colorBuffer| to |m_fbo|, which is always the source for read | 422 // Attaches |m_colorBuffer| to |m_fbo|, which is always the source for read |
| 430 // operations. | 423 // operations. |
| 431 void attachColorBufferToReadFramebuffer(); | 424 void attachColorBufferToReadFramebuffer(); |
| 432 | 425 |
| 433 // Whether the WebGL client desires an explicit resolve. This is | 426 // Whether the WebGL client desires an explicit resolve. This is |
| 434 // implemented by forwarding all draw operations to a multisample | 427 // implemented by forwarding all draw operations to a multisample |
| 435 // renderbuffer, which is resolved before any read operations or swaps. | 428 // renderbuffer, which is resolved before any read operations or swaps. |
| 436 bool wantExplicitResolve(); | 429 bool wantExplicitResolve(); |
| 437 | 430 |
| 438 // Whether the WebGL client wants a depth or stencil buffer. | 431 // Whether the WebGL client wants a depth or stencil buffer. |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 // RuntimeEnabledFeatures::webGLImageChromiumEnabled() call with | 548 // RuntimeEnabledFeatures::webGLImageChromiumEnabled() call with |
| 556 // shouldUseChromiumImage() calls, and set m_chromiumImageUsage to | 549 // shouldUseChromiumImage() calls, and set m_chromiumImageUsage to |
| 557 // DisallowChromiumImage in the case of OffscreenCanvas. | 550 // DisallowChromiumImage in the case of OffscreenCanvas. |
| 558 ChromiumImageUsage m_chromiumImageUsage; | 551 ChromiumImageUsage m_chromiumImageUsage; |
| 559 bool shouldUseChromiumImage(); | 552 bool shouldUseChromiumImage(); |
| 560 }; | 553 }; |
| 561 | 554 |
| 562 } // namespace blink | 555 } // namespace blink |
| 563 | 556 |
| 564 #endif // DrawingBuffer_h | 557 #endif // DrawingBuffer_h |
| OLD | NEW |