Changeset 189730 in webkit
- Timestamp:
- Sep 14, 2015 6:59:52 AM (9 years ago)
- Location:
- releases/WebKitGTK/webkit-2.10/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog
r189729 r189730 1 2015-09-01 Jinyoung Hur <hur.ims@navercorp.com> 2 3 [Cairo][WebGL] Upload the accelerated canvas as a texture by copying via GPU directly 4 https://bugs.webkit.org/show_bug.cgi?id=148631 5 6 Reviewed by Dean Jackson. 7 8 When an accelerated canvas needs to be uploaded as a gl texture, it would be better to copy it to 9 texture directly via GPU using glCopyTexImage2D. 10 Note that GPU copy can not always be enabled because, with premultiplyAlpha and flipY unpack option, 11 it seems hard to be implemented in a way of direct GPU copy. 12 13 No new tests because there is no behavior change. 14 15 * html/canvas/WebGLRenderingContextBase.cpp: 16 (WebCore::WebGLRenderingContextBase::texImage2D): 17 * platform/graphics/ImageBuffer.cpp: 18 (WebCore::ImageBuffer::copyToPlatformTexture): 19 * platform/graphics/ImageBuffer.h: 20 * platform/graphics/cairo/ImageBufferCairo.cpp: 21 (WebCore::ImageBuffer::copyToPlatformTexture): 22 1 23 2015-08-31 Chris Dumez <cdumez@apple.com> 2 24 -
releases/WebKitGTK/webkit-2.10/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
r189687 r189730 3220 3220 // FIXME: restriction of (RGB || RGBA)/UNSIGNED_BYTE should be lifted when 3221 3221 // ImageBuffer::copyToPlatformTexture implementations are fully functional. 3222 if (GraphicsContext3D::TEXTURE_2D == target && texture && type == texture->getType(target, level) 3223 && (format == GraphicsContext3D::RGB || format == GraphicsContext3D::RGBA) && type == GraphicsContext3D::UNSIGNED_BYTE) { 3222 if (texture 3223 && (format == GraphicsContext3D::RGB || format == GraphicsContext3D::RGBA) 3224 && type == GraphicsContext3D::UNSIGNED_BYTE 3225 && (texture->getType(target, level) == GraphicsContext3D::UNSIGNED_BYTE || !texture->isValid(target, level))) { 3224 3226 ImageBuffer* buffer = canvas->buffer(); 3225 if (buffer && buffer->copyToPlatformTexture(*m_context.get(), t exture->object(), internalformat, m_unpackPremultiplyAlpha, m_unpackFlipY)) {3227 if (buffer && buffer->copyToPlatformTexture(*m_context.get(), target, texture->object(), internalformat, m_unpackPremultiplyAlpha, m_unpackFlipY)) { 3226 3228 texture->setLevelInfo(target, level, internalformat, canvas->width(), canvas->height(), type); 3227 3229 return; -
releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/graphics/ImageBuffer.cpp
r183960 r189730 152 152 return 0; 153 153 } 154 #endif155 154 156 bool ImageBuffer::copyToPlatformTexture(GraphicsContext3D&, Platform3DObject, GC3Denum, bool, bool)155 bool ImageBuffer::copyToPlatformTexture(GraphicsContext3D&, GC3Denum, Platform3DObject, GC3Denum, bool, bool) 157 156 { 158 157 return false; 159 158 } 159 #endif 160 160 161 161 std::unique_ptr<ImageBuffer> ImageBuffer::createCompatibleBuffer(const FloatSize& size, float resolutionScale, ColorSpace colorSpace, const GraphicsContext* context, bool) -
releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/graphics/ImageBuffer.h
r187274 r189730 123 123 // FIXME: current implementations of this method have the restriction that they only work 124 124 // with textures that are RGB or RGBA format, and UNSIGNED_BYTE type. 125 bool copyToPlatformTexture(GraphicsContext3D&, Platform3DObject, GC3Denum, bool, bool);125 bool copyToPlatformTexture(GraphicsContext3D&, GC3Denum, Platform3DObject, GC3Denum, bool, bool); 126 126 127 127 FloatSize spaceSize() const { return m_space; } -
releases/WebKitGTK/webkit-2.10/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
r189706 r189730 432 432 } 433 433 434 bool ImageBuffer::copyToPlatformTexture(GraphicsContext3D&, GC3Denum target, Platform3DObject destinationTexture, GC3Denum internalformat, bool premultiplyAlpha, bool flipY) 435 { 436 #if ENABLE(ACCELERATED_2D_CANVAS) 437 if (premultiplyAlpha || flipY) 438 return false; 439 440 if (!m_data.m_texture) 441 return false; 442 443 GC3Denum bindTextureTarget; 444 switch (target) { 445 case GL_TEXTURE_2D: 446 bindTextureTarget = GL_TEXTURE_2D; 447 break; 448 case GL_TEXTURE_CUBE_MAP_POSITIVE_X: 449 case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: 450 case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: 451 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: 452 case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: 453 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: 454 bindTextureTarget = GL_TEXTURE_CUBE_MAP; 455 break; 456 default: 457 return false; 458 } 459 460 cairo_surface_flush(m_data.m_surface.get()); 461 462 std::unique_ptr<GLContext> context = GLContext::createContextForWindow(0, GLContext::sharingContext()); 463 context->makeContextCurrent(); 464 uint32_t fbo; 465 glGenFramebuffers(1, &fbo); 466 glBindFramebuffer(GL_FRAMEBUFFER, fbo); 467 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_data.m_texture, 0); 468 glBindTexture(bindTextureTarget, destinationTexture); 469 glCopyTexImage2D(target, 0, internalformat, 0, 0, m_size.width(), m_size.height(), 0); 470 glBindTexture(bindTextureTarget, 0); 471 glBindFramebuffer(GL_FRAMEBUFFER, 0); 472 glFlush(); 473 glDeleteFramebuffers(1, &fbo); 474 return true; 475 #else 476 UNUSED_PARAM(target); 477 UNUSED_PARAM(destinationTexture); 478 UNUSED_PARAM(internalformat); 479 UNUSED_PARAM(premultiplyAlpha); 480 UNUSED_PARAM(flipY); 481 return false; 482 #endif 483 } 484 434 485 } // namespace WebCore 435 486
Note: See TracChangeset
for help on using the changeset viewer.