Changeset 140595 in webkit
- Timestamp:
- Jan 23, 2013 2:26:38 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r140593 r140595 1 2013-01-23 Jun Jiang <jun.a.jiang@intel.com> 2 3 Avoid unnecessary format conversion for tex{Sub}Image2D() for ImageData of WebGL 4 https://bugs.webkit.org/show_bug.cgi?id=107532 5 6 Reviewed by Kenneth Russell. 7 8 This patch removes the unnecessary format conversion in tex{Sub}Image2D() for ImageData in WebGL to improve performance. 9 10 Already covered by current tests. 11 12 * html/canvas/WebGLRenderingContext.cpp: 13 (WebCore): 14 (WebCore::WebGLRenderingContext::texImage2D): 15 (WebCore::WebGLRenderingContext::texSubImage2D): 16 1 17 2013-01-23 Xianzhu Wang <wangxianzhu@chromium.org> 2 18 -
trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp
r140497 r140595 3701 3701 return; 3702 3702 Vector<uint8_t> data; 3703 if (!m_context->extractImageData(pixels, format, type, m_unpackFlipY, m_unpackPremultiplyAlpha, data)) { 3704 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "texImage2D", "bad image data"); 3705 return; 3703 if (!pixels) 3704 return; 3705 bool needConversion = true; 3706 // The data from ImageData is always of format RGBA8. 3707 // No conversion is needed if destination format is RGBA and type is USIGNED_BYTE and no Flip or Premultiply operation is required. 3708 if (!m_unpackFlipY && !m_unpackPremultiplyAlpha && format == GraphicsContext3D::RGBA && type == GraphicsContext3D::UNSIGNED_BYTE) 3709 needConversion = false; 3710 else { 3711 if (!m_context->extractImageData(pixels, format, type, m_unpackFlipY, m_unpackPremultiplyAlpha, data)) { 3712 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "texImage2D", "bad image data"); 3713 return; 3714 } 3706 3715 } 3707 3716 if (m_unpackAlignment != 1) 3708 3717 m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, 1); 3709 texImage2DBase(target, level, internalformat, pixels->width(), pixels->height(), 0, 3710 format, type, data.data(), ec); 3718 texImage2DBase(target, level, internalformat, pixels->width(), pixels->height(), 0, format, type, needConversion ? data.data() : pixels->data()->data(), ec); 3711 3719 if (m_unpackAlignment != 1) 3712 3720 m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlignment); … … 3943 3951 if (isContextLost()) 3944 3952 return; 3953 if (!pixels) 3954 return; 3945 3955 Vector<uint8_t> data; 3946 if (!m_context->extractImageData(pixels, format, type, m_unpackFlipY, m_unpackPremultiplyAlpha, data)) { 3947 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "texSubImage2D", "bad image data"); 3948 return; 3956 bool needConversion = true; 3957 // The data from ImageData is always of format RGBA8. 3958 // No conversion is needed if destination format is RGBA and type is USIGNED_BYTE and no Flip or Premultiply operation is required. 3959 if (format == GraphicsContext3D::RGBA && type == GraphicsContext3D::UNSIGNED_BYTE && !m_unpackFlipY && !m_unpackPremultiplyAlpha) 3960 needConversion = false; 3961 else { 3962 if (!m_context->extractImageData(pixels, format, type, m_unpackFlipY, m_unpackPremultiplyAlpha, data)) { 3963 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "texSubImage2D", "bad image data"); 3964 return; 3965 } 3949 3966 } 3950 3967 if (m_unpackAlignment != 1) 3951 3968 m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, 1); 3952 texSubImage2DBase(target, level, xoffset, yoffset, pixels->width(), pixels->height(), 3953 format, type, data.data(), ec); 3969 texSubImage2DBase(target, level, xoffset, yoffset, pixels->width(), pixels->height(), format, type, needConversion ? data.data() : pixels->data()->data(), ec); 3954 3970 if (m_unpackAlignment != 1) 3955 3971 m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlignment);
Note: See TracChangeset
for help on using the changeset viewer.