Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Unified Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 2527343002: Avoid doing and then abandoning semi-accelerated texImageHelperHTMLVideoElement path. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
index 896056569e8b63c617b29734b1aefaa53d39effb..6ea66927525c0e86e7195c54b82f34bb5923bdff 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -5146,55 +5146,52 @@ void WebGLRenderingContextBase::texImageHelperHTMLVideoElement(
sourceImageRect == sentinelEmptyRect() ||
sourceImageRect ==
IntRect(0, 0, video->videoWidth(), video->videoHeight());
- if (functionID == TexImage2D && sourceImageRectIsDefault && depth == 1) {
+ if (functionID == TexImage2D && sourceImageRectIsDefault && depth == 1 &&
+ GL_TEXTURE_2D == target && Extensions3DUtil::canUseCopyTextureCHROMIUM(
+ target, internalformat, type, level)) {
DCHECK_EQ(xoffset, 0);
DCHECK_EQ(yoffset, 0);
DCHECK_EQ(zoffset, 0);
// Go through the fast path doing a GPU-GPU textures copy without a readback
// to system memory if possible. Otherwise, it will fall back to the normal
// SW path.
- if (GL_TEXTURE_2D == target) {
- if (Extensions3DUtil::canUseCopyTextureCHROMIUM(target, internalformat,
- type, level) &&
- video->copyVideoTextureToPlatformTexture(
- contextGL(), texture->object(), internalformat, type,
- m_unpackPremultiplyAlpha, m_unpackFlipY)) {
- return;
- }
+ if (video->copyVideoTextureToPlatformTexture(
+ contextGL(), texture->object(), internalformat, type,
+ m_unpackPremultiplyAlpha, m_unpackFlipY)) {
+ return;
+ }
- // Try using an accelerated image buffer, this allows YUV conversion to be
- // done on the GPU.
- std::unique_ptr<ImageBufferSurface> surface =
- wrapUnique(new AcceleratedImageBufferSurface(
- IntSize(video->videoWidth(), video->videoHeight())));
- if (surface->isValid()) {
- std::unique_ptr<ImageBuffer> imageBuffer(
- ImageBuffer::create(std::move(surface)));
- if (imageBuffer) {
- // The video element paints an RGBA frame into our surface here. By
- // using an AcceleratedImageBufferSurface, we enable the
- // WebMediaPlayer implementation to do any necessary color space
- // conversion on the GPU (though it
- // may still do a CPU conversion and upload the results).
- video->paintCurrentFrame(
- imageBuffer->canvas(),
- IntRect(0, 0, video->videoWidth(), video->videoHeight()),
- nullptr);
-
- // This is a straight GPU-GPU copy, any necessary color space
- // conversion was handled in the paintCurrentFrameInContext() call.
-
- // Note that copyToPlatformTexture no longer allocates the
- // destination texture.
- texImage2DBase(target, level, internalformat, video->videoWidth(),
- video->videoHeight(), 0, format, type, nullptr);
-
- if (imageBuffer->copyToPlatformTexture(
- contextGL(), texture->object(), internalformat, type, level,
- m_unpackPremultiplyAlpha, m_unpackFlipY, IntPoint(0, 0),
- IntRect(0, 0, video->videoWidth(), video->videoHeight()))) {
- return;
- }
+ // Try using an accelerated image buffer, this allows YUV conversion to be
+ // done on the GPU.
+ std::unique_ptr<ImageBufferSurface> surface =
+ wrapUnique(new AcceleratedImageBufferSurface(
+ IntSize(video->videoWidth(), video->videoHeight())));
+ if (surface->isValid()) {
+ std::unique_ptr<ImageBuffer> imageBuffer(
+ ImageBuffer::create(std::move(surface)));
+ if (imageBuffer) {
+ // The video element paints an RGBA frame into our surface here. By
+ // using an AcceleratedImageBufferSurface, we enable the
+ // WebMediaPlayer implementation to do any necessary color space
+ // conversion on the GPU (though it
+ // may still do a CPU conversion and upload the results).
+ video->paintCurrentFrame(
+ imageBuffer->canvas(),
+ IntRect(0, 0, video->videoWidth(), video->videoHeight()), nullptr);
+
+ // This is a straight GPU-GPU copy, any necessary color space
+ // conversion was handled in the paintCurrentFrameInContext() call.
+
+ // Note that copyToPlatformTexture no longer allocates the
+ // destination texture.
+ texImage2DBase(target, level, internalformat, video->videoWidth(),
+ video->videoHeight(), 0, format, type, nullptr);
+
+ if (imageBuffer->copyToPlatformTexture(
aleksandar.stojiljkovic 2016/11/25 12:00:04 Copy from the CL description:
Ken Russell (switch to Gerrit) 2016/11/29 04:55:23 I see. Thanks for pointing that out.
+ contextGL(), texture->object(), internalformat, type, level,
+ m_unpackPremultiplyAlpha, m_unpackFlipY, IntPoint(0, 0),
+ IntRect(0, 0, video->videoWidth(), video->videoHeight()))) {
+ return;
}
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698