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

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

Issue 2506863002: implement tex(Sub)Image2D/3D for HTMLVideoElement (Closed)
Patch Set: roll webgl 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 | « third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h ('k') | 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 d801d90ef7233f920f4a08f549777b7252f68277..767b8910d685308e27cdeaf0bed25288a3f17b5d 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -5130,6 +5130,9 @@ void WebGLRenderingContextBase::texImageHelperHTMLVideoElement(
GLint yoffset,
GLint zoffset,
HTMLVideoElement* video,
+ const IntRect& sourceImageRect,
+ GLsizei depth,
+ GLint unpackImageHeight,
ExceptionState& exceptionState) {
const char* funcName = getTexImageFunctionName(functionID);
if (isContextLost())
@@ -5140,7 +5143,7 @@ void WebGLRenderingContextBase::texImageHelperHTMLVideoElement(
if (!texture)
return;
TexImageFunctionType functionType;
- if (functionID == TexImage2D)
+ if (functionID == TexImage2D || functionID == TexImage3D)
functionType = TexImage;
else
functionType = TexSubImage;
@@ -5150,7 +5153,15 @@ void WebGLRenderingContextBase::texImageHelperHTMLVideoElement(
yoffset, zoffset))
return;
- if (functionID == TexImage2D) {
+ bool sourceImageRectIsDefault =
+ sourceImageRect == sentinelEmptyRect() ||
+ sourceImageRect ==
+ IntRect(0, 0, video->videoWidth(), video->videoHeight());
+ if (functionID == TexImage2D && sourceImageRectIsDefault && depth == 1 &&
+ unpackImageHeight == 0) {
+ 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.
@@ -5207,8 +5218,8 @@ void WebGLRenderingContextBase::texImageHelperHTMLVideoElement(
texImageImpl(functionID, target, level, internalformat, xoffset, yoffset,
zoffset, format, type, image.get(),
WebGLImageConversion::HtmlDomVideo, m_unpackFlipY,
- m_unpackPremultiplyAlpha,
- IntRect(0, 0, video->videoWidth(), video->videoHeight()), 1, 0);
+ m_unpackPremultiplyAlpha, sourceImageRect, depth,
+ unpackImageHeight);
}
void WebGLRenderingContextBase::texImageBitmapByGPU(ImageBitmap* bitmap,
@@ -5230,7 +5241,8 @@ void WebGLRenderingContextBase::texImage2D(GLenum target,
HTMLVideoElement* video,
ExceptionState& exceptionState) {
texImageHelperHTMLVideoElement(TexImage2D, target, level, internalformat,
- format, type, 0, 0, 0, video, exceptionState);
+ format, type, 0, 0, 0, video,
+ sentinelEmptyRect(), 1, 0, exceptionState);
}
void WebGLRenderingContextBase::texImageHelperImageBitmap(
@@ -5489,7 +5501,8 @@ void WebGLRenderingContextBase::texSubImage2D(GLenum target,
HTMLVideoElement* video,
ExceptionState& exceptionState) {
texImageHelperHTMLVideoElement(TexSubImage2D, target, level, 0, format, type,
- xoffset, yoffset, 0, video, exceptionState);
+ xoffset, yoffset, 0, video,
+ sentinelEmptyRect(), 1, 0, exceptionState);
}
void WebGLRenderingContextBase::texSubImage2D(GLenum target,
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698