diff options
author | zmo <zmo@chromium.org> | 2015-06-23 13:41:51 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-23 20:43:31 +0000 |
commit | dbea74da580a7bf0dbb10fc3af32f7ae24d2794b (patch) | |
tree | 6417f8f922d60529e75a16b34e7f69e721fe84bb | |
parent | e77db02268ba0afea2e60b0822b264ad841d37b3 (diff) | |
download | chromium_src-dbea74da580a7bf0dbb10fc3af32f7ae24d2794b.zip chromium_src-dbea74da580a7bf0dbb10fc3af32f7ae24d2794b.tar.gz chromium_src-dbea74da580a7bf0dbb10fc3af32f7ae24d2794b.tar.bz2 |
Remove Chromium specific PixelStorei params in GPU command buffer.
Including:
UNPACK_FLIP_Y, UNPACK_PREMULTIPLY_ALPHA, UNPACK_UNMULTIPLY_ALPHA
They are used by Copy{Sub}TextureCHROMIUM only, so we could just add them
as command arguments.
BUG=502491
TEST=gpu_unittests, webgl_conformance tests
R=piman@chromium.org
TBR=jamesr@chromium.org
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1189303003
Cr-Commit-Position: refs/heads/master@{#335742}
27 files changed, 585 insertions, 293 deletions
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc index 848c59f..f081f62 100644 --- a/cc/resources/resource_provider.cc +++ b/cc/resources/resource_provider.cc @@ -1879,7 +1879,8 @@ void ResourceProvider::CopyResource(ResourceId source_id, dest_resource->allocated = true; gl->CopySubTextureCHROMIUM(dest_resource->target, source_resource->gl_id, dest_resource->gl_id, rect.x(), rect.y(), rect.x(), - rect.y(), rect.width(), rect.height()); + rect.y(), rect.width(), rect.height(), + false, false, false); if (source_resource->gl_read_lock_query_id) { // End query and create a read lock fence that will prevent access to // source resource until CopySubTextureCHROMIUM command has completed. diff --git a/content/renderer/media/android/webmediaplayer_android.cc b/content/renderer/media/android/webmediaplayer_android.cc index 1549481..7b0bed9 100644 --- a/content/renderer/media/android/webmediaplayer_android.cc +++ b/content/renderer/media/android/webmediaplayer_android.cc @@ -29,6 +29,7 @@ #include "content/renderer/render_frame_impl.h" #include "content/renderer/render_thread_impl.h" #include "content/renderer/render_view_impl.h" +#include "gpu/blink/webgraphicscontext3d_impl.h" #include "gpu/GLES2/gl2extchromium.h" #include "gpu/command_buffer/client/gles2_interface.h" #include "gpu/command_buffer/common/mailbox_holder.h" @@ -650,6 +651,12 @@ bool WebMediaPlayerAndroid::copyVideoTextureToPlatformTexture( if (needs_external_surface_) return false; + // TODO(zmo): Remove the casting once Copy{Sub}TextureCHROMIUM API + // signatures are switched over in blink. + gpu_blink::WebGraphicsContext3DImpl* web_graphics_context_impl = + reinterpret_cast<gpu_blink::WebGraphicsContext3DImpl*>( + web_graphics_context); + scoped_refptr<VideoFrame> video_frame; { base::AutoLock auto_lock(current_frame_lock_); @@ -664,31 +671,33 @@ bool WebMediaPlayerAndroid::copyVideoTextureToPlatformTexture( mailbox_holder.texture_target == GL_TEXTURE_EXTERNAL_OES) || (is_remote_ && mailbox_holder.texture_target == GL_TEXTURE_2D)); - web_graphics_context->waitSyncPoint(mailbox_holder.sync_point); + web_graphics_context_impl->waitSyncPoint(mailbox_holder.sync_point); // Ensure the target of texture is set before copyTextureCHROMIUM, otherwise // an invalid texture target may be used for copy texture. - uint32 src_texture = web_graphics_context->createAndConsumeTextureCHROMIUM( - mailbox_holder.texture_target, mailbox_holder.mailbox.name); + uint32 src_texture = + web_graphics_context_impl->createAndConsumeTextureCHROMIUM( + mailbox_holder.texture_target, mailbox_holder.mailbox.name); // The video is stored in an unmultiplied format, so premultiply if // necessary. - web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, - premultiply_alpha); + web_graphics_context_impl->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, + premultiply_alpha); // Application itself needs to take care of setting the right flip_y // value down to get the expected result. // flip_y==true means to reverse the video orientation while // flip_y==false means to keep the intrinsic orientation. - web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, flip_y); - web_graphics_context->copyTextureCHROMIUM(GL_TEXTURE_2D, src_texture, texture, - internal_format, type); - web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false); - web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, - false); - - web_graphics_context->deleteTexture(src_texture); - web_graphics_context->flush(); + web_graphics_context_impl->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, flip_y); + web_graphics_context_impl->copyTextureCHROMIUM( + GL_TEXTURE_2D, src_texture, texture, internal_format, type, + flip_y, premultiply_alpha, false); + web_graphics_context_impl->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false); + web_graphics_context_impl->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, + false); + + web_graphics_context_impl->deleteTexture(src_texture); + web_graphics_context_impl->flush(); SyncPointClientImpl client(web_graphics_context); video_frame->UpdateReleaseSyncPoint(&client); diff --git a/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_copy_texture.txt b/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_copy_texture.txt index 279dbdb..ed6bf72 100644 --- a/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_copy_texture.txt +++ b/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_copy_texture.txt @@ -14,7 +14,6 @@ Dependencies OpenGL ES 2.0 is required. - CHROMIUM_flipy affects the definition of this extension. EXT_texture_format_BGRA8888 affects the definition of this extension. Overview @@ -22,13 +21,7 @@ Overview This extension expands on the functionality provided by the glCopyTexImage2D command. A new function is exported, glCopyTextureCHROMIUM, that performs the same copy operation as - glCopyTexImage2D, while respecting the pixel-storage modifiers - UNPACK_FLIP_Y_CHROMIUM, GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM and - GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM. - - If GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM and - GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM are enabled. Then no alpha - processing occurs. This is the equivalent of having neither flag set. + glCopyTexImage2D. The extension also supports copying BGRA textures and copying EXTERNAL_OES texture to BGRA texture, which is not explicitly @@ -40,7 +33,10 @@ New Procedures and Functions void glCopyTextureCHROMIUM (GLenum target, GLenum source_id, GLenum dest_id, - GLint internal_format, GLenum dest_type) + GLint internal_format, GLenum dest_type, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha) Copies the contents of texture referred to by <source_id> to <dest_id> texture. If <source_id> texture is not defined or has different dimension @@ -72,6 +68,12 @@ New Procedures and Functions <target> uses the same parameters as TexImage2D. + If <flip_y> is true, vertically flip texture image data. + + If <unpack_premultiply_alpha> and <unpack_unmultiply_alpha> are true, + no alpha processing occurs. This is the equivalent of having neither flag + set. + INVALID_OPERATION is generated if <internal_format> is not one of the valid formats described above. @@ -98,12 +100,16 @@ New Procedures and Functions GLenum dest_id, GLint xoffset, GLint yoffset, GLint x, GLint y, - GLsizei width, GLsizei height) + GLsizei width, GLsizei height, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha) Copies the sub contents of texture referred to by <source_id> to <dest_id> texture without redefining <dest_id> texture. - See CopyTextureCHROMIUM for the interpretation of the <target> arguments. + See CopyTextureCHROMIUM for the interpretation of the <target>, <flip_y>, + <premultiply_alpha>, and <unmultiply_alpha> arguments. <xoffset> and <yoffset> specify a texel offset in the x and y direction respectively within the destination texture. @@ -147,4 +153,6 @@ Revision History 8/1/2011 Documented the extension 7/4/2013 Add a new parameter dest_type to glCopyTextureCHROMIUM() - 16/7/2014 Add GL_TEXTURE_RECTANGLE_ARB as valid source_id target. + 16/7/2014 Add GL_TEXTURE_RECTANGLE_ARB as valid source_id target + 19/6/2015 Add arguments unpack_flip_y, unpack_premultiply_alpha, and + unpack_unmultiply_alpha to both commands. diff --git a/gpu/GLES2/gl2extchromium.h b/gpu/GLES2/gl2extchromium.h index af904f3..8a7ecf0 100644 --- a/gpu/GLES2/gl2extchromium.h +++ b/gpu/GLES2/gl2extchromium.h @@ -398,21 +398,29 @@ typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERCHROMIUMPROC) (GLint srcX0, GLint #define GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM 0x9241 #endif #ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glCopyTextureCHROMIUM(GLenum target, - GLenum source_id, - GLenum dest_id, - GLint internalformat, - GLenum dest_type); - -GL_APICALL void GL_APIENTRY glCopySubTextureCHROMIUM(GLenum target, - GLenum source_id, - GLenum dest_id, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height); +GL_APICALL void GL_APIENTRY glCopyTextureCHROMIUM( + GLenum target, + GLenum source_id, + GLenum dest_id, + GLint internalformat, + GLenum dest_type, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha); + +GL_APICALL void GL_APIENTRY glCopySubTextureCHROMIUM( + GLenum target, + GLenum source_id, + GLenum dest_id, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha); #endif typedef void(GL_APIENTRYP PFNGLCOPYTEXTURECHROMIUMPROC)(GLenum target, GLenum source_id, diff --git a/gpu/blink/webgraphicscontext3d_impl.cc b/gpu/blink/webgraphicscontext3d_impl.cc index 139803e..fb463b7 100644 --- a/gpu/blink/webgraphicscontext3d_impl.cc +++ b/gpu/blink/webgraphicscontext3d_impl.cc @@ -71,6 +71,30 @@ void WebGraphicsContext3DErrorMessageCallback::OnErrorMessage( graphics_context_->OnErrorMessage(msg, id); } +void WebGraphicsContext3DImpl::copyTextureCHROMIUM( + blink::WGC3Denum target, + blink::WebGLId source_id, + blink::WebGLId dest_id, + blink::WGC3Denum internal_format, + blink::WGC3Denum dest_type) { + copyTextureCHROMIUM(target, source_id, dest_id, internal_format, dest_type, + false, false, false); +} + +void WebGraphicsContext3DImpl::copySubTextureCHROMIUM( + blink::WGC3Denum target, + blink::WebGLId source_id, + blink::WebGLId dest_id, + blink::WGC3Dint xoffset, + blink::WGC3Dint yoffset, + blink::WGC3Dint x, + blink::WGC3Dint y, + blink::WGC3Dsizei width, + blink::WGC3Dsizei height) { + copySubTextureCHROMIUM(target, source_id, dest_id, xoffset, yoffset, + x, y, width, height, false, false, false); +} + // Helper macros to reduce the amount of code. #define DELEGATE_TO_GL(name, glname) \ @@ -181,6 +205,14 @@ void WebGraphicsContext3DImpl::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, \ gl_->glname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); \ } +#define DELEGATE_TO_GL_12(name, glname, t1, t2, t3, t4, t5, t6, t7, t8, \ + t9, t10, t11, t12) \ +void WebGraphicsContext3DImpl::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, \ + t6 a6, t7 a7, t8 a8, t9 a9, t10 a10,\ + t11 a11, t12 a12) { \ + gl_->glname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); \ +} + WebGraphicsContext3DImpl::WebGraphicsContext3DImpl() : initialized_(false), initialize_failed_(false), @@ -818,25 +850,31 @@ DELEGATE_TO_GL_3(getQueryivEXT, GetQueryivEXT, WGC3Denum, WGC3Denum, WGC3Dint*) DELEGATE_TO_GL_3(getQueryObjectuivEXT, GetQueryObjectuivEXT, WebGLId, WGC3Denum, WGC3Duint*) -DELEGATE_TO_GL_5(copyTextureCHROMIUM, +DELEGATE_TO_GL_8(copyTextureCHROMIUM, CopyTextureCHROMIUM, WGC3Denum, WebGLId, WebGLId, WGC3Denum, - WGC3Denum); - -DELEGATE_TO_GL_9(copySubTextureCHROMIUM, - CopySubTextureCHROMIUM, WGC3Denum, - WebGLId, - WebGLId, - WGC3Dint, - WGC3Dint, - WGC3Dint, - WGC3Dint, - WGC3Dsizei, - WGC3Dsizei); + WGC3Dboolean, + WGC3Dboolean, + WGC3Dboolean); + +DELEGATE_TO_GL_12(copySubTextureCHROMIUM, + CopySubTextureCHROMIUM, + WGC3Denum, + WebGLId, + WebGLId, + WGC3Dint, + WGC3Dint, + WGC3Dint, + WGC3Dint, + WGC3Dsizei, + WGC3Dsizei, + WGC3Dboolean, + WGC3Dboolean, + WGC3Dboolean); DELEGATE_TO_GL_3(bindUniformLocationCHROMIUM, BindUniformLocationCHROMIUM, WebGLId, WGC3Dint, const WGC3Dchar*) diff --git a/gpu/blink/webgraphicscontext3d_impl.h b/gpu/blink/webgraphicscontext3d_impl.h index c2f3c88..1e3fa1c 100644 --- a/gpu/blink/webgraphicscontext3d_impl.h +++ b/gpu/blink/webgraphicscontext3d_impl.h @@ -518,6 +518,8 @@ class GPU_BLINK_EXPORT WebGraphicsContext3DImpl blink::WGC3Denum pname, blink::WGC3Duint* params); + // TODO(zmo): Remove the following two functions when blink side switch + // over to the correct version. void copyTextureCHROMIUM(blink::WGC3Denum target, blink::WebGLId source_id, blink::WebGLId dest_id, @@ -534,6 +536,30 @@ class GPU_BLINK_EXPORT WebGraphicsContext3DImpl blink::WGC3Dsizei width, blink::WGC3Dsizei height) override; + void copyTextureCHROMIUM( + blink::WGC3Denum target, + blink::WebGLId source_id, + blink::WebGLId dest_id, + blink::WGC3Denum internal_format, + blink::WGC3Denum dest_type, + blink::WGC3Dboolean unpack_flip_y, + blink::WGC3Dboolean unpack_premultiply_alpha, + blink::WGC3Dboolean unpack_unmultiply_alpha); + + void copySubTextureCHROMIUM( + blink::WGC3Denum target, + blink::WebGLId source_id, + blink::WebGLId dest_id, + blink::WGC3Dint xoffset, + blink::WGC3Dint yoffset, + blink::WGC3Dint x, + blink::WGC3Dint y, + blink::WGC3Dsizei width, + blink::WGC3Dsizei height, + blink::WGC3Dboolean unpack_flip_y, + blink::WGC3Dboolean unpack_premultiply_alpha, + blink::WGC3Dboolean unpack_unmultiply_alpha); + virtual void bindUniformLocationCHROMIUM(blink::WebGLId program, blink::WGC3Dint location, const blink::WGC3Dchar* uniform); diff --git a/gpu/command_buffer/client/gles2_c_lib_autogen.h b/gpu/command_buffer/client/gles2_c_lib_autogen.h index a8841c4..87c04d2 100644 --- a/gpu/command_buffer/client/gles2_c_lib_autogen.h +++ b/gpu/command_buffer/client/gles2_c_lib_autogen.h @@ -1223,9 +1223,13 @@ void GLES2CopyTextureCHROMIUM(GLenum target, GLenum source_id, GLenum dest_id, GLint internalformat, - GLenum dest_type) { - gles2::GetGLContext()->CopyTextureCHROMIUM(target, source_id, dest_id, - internalformat, dest_type); + GLenum dest_type, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha) { + gles2::GetGLContext()->CopyTextureCHROMIUM( + target, source_id, dest_id, internalformat, dest_type, unpack_flip_y, + unpack_premultiply_alpha, unpack_unmultiply_alpha); } void GLES2CopySubTextureCHROMIUM(GLenum target, GLenum source_id, @@ -1235,9 +1239,13 @@ void GLES2CopySubTextureCHROMIUM(GLenum target, GLint x, GLint y, GLsizei width, - GLsizei height) { + GLsizei height, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha) { gles2::GetGLContext()->CopySubTextureCHROMIUM( - target, source_id, dest_id, xoffset, yoffset, x, y, width, height); + target, source_id, dest_id, xoffset, yoffset, x, y, width, height, + unpack_flip_y, unpack_premultiply_alpha, unpack_unmultiply_alpha); } void GLES2CompressedCopyTextureCHROMIUM(GLenum target, GLenum source_id, diff --git a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h index 58cdb23..ce32148 100644 --- a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h +++ b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h @@ -2464,11 +2464,15 @@ void CopyTextureCHROMIUM(GLenum target, GLenum source_id, GLenum dest_id, GLint internalformat, - GLenum dest_type) { + GLenum dest_type, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha) { gles2::cmds::CopyTextureCHROMIUM* c = GetCmdSpace<gles2::cmds::CopyTextureCHROMIUM>(); if (c) { - c->Init(target, source_id, dest_id, internalformat, dest_type); + c->Init(target, source_id, dest_id, internalformat, dest_type, + unpack_flip_y, unpack_premultiply_alpha, unpack_unmultiply_alpha); } } @@ -2480,11 +2484,15 @@ void CopySubTextureCHROMIUM(GLenum target, GLint x, GLint y, GLsizei width, - GLsizei height) { + GLsizei height, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha) { gles2::cmds::CopySubTextureCHROMIUM* c = GetCmdSpace<gles2::cmds::CopySubTextureCHROMIUM>(); if (c) { - c->Init(target, source_id, dest_id, xoffset, yoffset, x, y, width, height); + c->Init(target, source_id, dest_id, xoffset, yoffset, x, y, width, height, + unpack_flip_y, unpack_premultiply_alpha, unpack_unmultiply_alpha); } } diff --git a/gpu/command_buffer/client/gles2_implementation_autogen.h b/gpu/command_buffer/client/gles2_implementation_autogen.h index f2c1b5e..36617ee 100644 --- a/gpu/command_buffer/client/gles2_implementation_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_autogen.h @@ -918,7 +918,10 @@ void CopyTextureCHROMIUM(GLenum target, GLenum source_id, GLenum dest_id, GLint internalformat, - GLenum dest_type) override; + GLenum dest_type, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha) override; void CopySubTextureCHROMIUM(GLenum target, GLenum source_id, @@ -928,7 +931,10 @@ void CopySubTextureCHROMIUM(GLenum target, GLint x, GLint y, GLsizei width, - GLsizei height) override; + GLsizei height, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha) override; void CompressedCopyTextureCHROMIUM(GLenum target, GLenum source_id, diff --git a/gpu/command_buffer/client/gles2_implementation_impl_autogen.h b/gpu/command_buffer/client/gles2_implementation_impl_autogen.h index 3786799..8586fe3 100644 --- a/gpu/command_buffer/client/gles2_implementation_impl_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_impl_autogen.h @@ -3149,39 +3149,54 @@ void GLES2Implementation::TexImageIOSurface2DCHROMIUM(GLenum target, CheckGLError(); } -void GLES2Implementation::CopyTextureCHROMIUM(GLenum target, - GLenum source_id, - GLenum dest_id, - GLint internalformat, - GLenum dest_type) { +void GLES2Implementation::CopyTextureCHROMIUM( + GLenum target, + GLenum source_id, + GLenum dest_id, + GLint internalformat, + GLenum dest_type, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTextureCHROMIUM(" - << GLES2Util::GetStringEnum(target) << ", " - << GLES2Util::GetStringEnum(source_id) << ", " - << GLES2Util::GetStringEnum(dest_id) << ", " - << internalformat << ", " - << GLES2Util::GetStringPixelType(dest_type) << ")"); - helper_->CopyTextureCHROMIUM(target, source_id, dest_id, internalformat, - dest_type); + GPU_CLIENT_LOG( + "[" << GetLogPrefix() << "] glCopyTextureCHROMIUM(" + << GLES2Util::GetStringEnum(target) << ", " + << GLES2Util::GetStringEnum(source_id) << ", " + << GLES2Util::GetStringEnum(dest_id) << ", " << internalformat << ", " + << GLES2Util::GetStringPixelType(dest_type) << ", " + << GLES2Util::GetStringBool(unpack_flip_y) << ", " + << GLES2Util::GetStringBool(unpack_premultiply_alpha) << ", " + << GLES2Util::GetStringBool(unpack_unmultiply_alpha) << ")"); + helper_->CopyTextureCHROMIUM( + target, source_id, dest_id, internalformat, dest_type, unpack_flip_y, + unpack_premultiply_alpha, unpack_unmultiply_alpha); CheckGLError(); } -void GLES2Implementation::CopySubTextureCHROMIUM(GLenum target, - GLenum source_id, - GLenum dest_id, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height) { +void GLES2Implementation::CopySubTextureCHROMIUM( + GLenum target, + GLenum source_id, + GLenum dest_id, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopySubTextureCHROMIUM(" - << GLES2Util::GetStringEnum(target) << ", " - << GLES2Util::GetStringEnum(source_id) << ", " - << GLES2Util::GetStringEnum(dest_id) << ", " << xoffset - << ", " << yoffset << ", " << x << ", " << y << ", " - << width << ", " << height << ")"); + GPU_CLIENT_LOG( + "[" << GetLogPrefix() << "] glCopySubTextureCHROMIUM(" + << GLES2Util::GetStringEnum(target) << ", " + << GLES2Util::GetStringEnum(source_id) << ", " + << GLES2Util::GetStringEnum(dest_id) << ", " << xoffset << ", " + << yoffset << ", " << x << ", " << y << ", " << width << ", " + << height << ", " << GLES2Util::GetStringBool(unpack_flip_y) << ", " + << GLES2Util::GetStringBool(unpack_premultiply_alpha) << ", " + << GLES2Util::GetStringBool(unpack_unmultiply_alpha) << ")"); if (width < 0) { SetGLError(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", "width < 0"); return; @@ -3190,8 +3205,9 @@ void GLES2Implementation::CopySubTextureCHROMIUM(GLenum target, SetGLError(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", "height < 0"); return; } - helper_->CopySubTextureCHROMIUM(target, source_id, dest_id, xoffset, yoffset, - x, y, width, height); + helper_->CopySubTextureCHROMIUM( + target, source_id, dest_id, xoffset, yoffset, x, y, width, height, + unpack_flip_y, unpack_premultiply_alpha, unpack_unmultiply_alpha); CheckGLError(); } diff --git a/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h b/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h index 8515496..7cf70eb 100644 --- a/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h @@ -2845,9 +2845,10 @@ TEST_F(GLES2ImplementationTest, CopyTextureCHROMIUM) { cmds::CopyTextureCHROMIUM cmd; }; Cmds expected; - expected.cmd.Init(1, 2, 3, GL_ALPHA, GL_UNSIGNED_BYTE); + expected.cmd.Init(1, 2, 3, GL_ALPHA, GL_UNSIGNED_BYTE, true, true, true); - gl_->CopyTextureCHROMIUM(1, 2, 3, GL_ALPHA, GL_UNSIGNED_BYTE); + gl_->CopyTextureCHROMIUM(1, 2, 3, GL_ALPHA, GL_UNSIGNED_BYTE, true, true, + true); EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } @@ -2856,9 +2857,9 @@ TEST_F(GLES2ImplementationTest, CopySubTextureCHROMIUM) { cmds::CopySubTextureCHROMIUM cmd; }; Cmds expected; - expected.cmd.Init(1, 2, 3, 4, 5, 6, 7, 8, 9); + expected.cmd.Init(1, 2, 3, 4, 5, 6, 7, 8, 9, true, true, true); - gl_->CopySubTextureCHROMIUM(1, 2, 3, 4, 5, 6, 7, 8, 9); + gl_->CopySubTextureCHROMIUM(1, 2, 3, 4, 5, 6, 7, 8, 9, true, true, true); EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } diff --git a/gpu/command_buffer/client/gles2_interface_autogen.h b/gpu/command_buffer/client/gles2_interface_autogen.h index c6e9a0a..ea392f3 100644 --- a/gpu/command_buffer/client/gles2_interface_autogen.h +++ b/gpu/command_buffer/client/gles2_interface_autogen.h @@ -681,7 +681,10 @@ virtual void CopyTextureCHROMIUM(GLenum target, GLenum source_id, GLenum dest_id, GLint internalformat, - GLenum dest_type) = 0; + GLenum dest_type, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha) = 0; virtual void CopySubTextureCHROMIUM(GLenum target, GLenum source_id, GLenum dest_id, @@ -690,7 +693,10 @@ virtual void CopySubTextureCHROMIUM(GLenum target, GLint x, GLint y, GLsizei width, - GLsizei height) = 0; + GLsizei height, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha) = 0; virtual void CompressedCopyTextureCHROMIUM(GLenum target, GLenum source_id, GLenum dest_id) = 0; diff --git a/gpu/command_buffer/client/gles2_interface_stub_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_autogen.h index 9bd9a58..80d2e6e 100644 --- a/gpu/command_buffer/client/gles2_interface_stub_autogen.h +++ b/gpu/command_buffer/client/gles2_interface_stub_autogen.h @@ -662,7 +662,10 @@ void CopyTextureCHROMIUM(GLenum target, GLenum source_id, GLenum dest_id, GLint internalformat, - GLenum dest_type) override; + GLenum dest_type, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha) override; void CopySubTextureCHROMIUM(GLenum target, GLenum source_id, GLenum dest_id, @@ -671,7 +674,10 @@ void CopySubTextureCHROMIUM(GLenum target, GLint x, GLint y, GLsizei width, - GLsizei height) override; + GLsizei height, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha) override; void CompressedCopyTextureCHROMIUM(GLenum target, GLenum source_id, GLenum dest_id) override; diff --git a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h index 393d1ff..e23ce05 100644 --- a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h +++ b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h @@ -1127,21 +1127,29 @@ void GLES2InterfaceStub::TexImageIOSurface2DCHROMIUM(GLenum /* target */, GLuint /* ioSurfaceId */, GLuint /* plane */) { } -void GLES2InterfaceStub::CopyTextureCHROMIUM(GLenum /* target */, - GLenum /* source_id */, - GLenum /* dest_id */, - GLint /* internalformat */, - GLenum /* dest_type */) { -} -void GLES2InterfaceStub::CopySubTextureCHROMIUM(GLenum /* target */, - GLenum /* source_id */, - GLenum /* dest_id */, - GLint /* xoffset */, - GLint /* yoffset */, - GLint /* x */, - GLint /* y */, - GLsizei /* width */, - GLsizei /* height */) { +void GLES2InterfaceStub::CopyTextureCHROMIUM( + GLenum /* target */, + GLenum /* source_id */, + GLenum /* dest_id */, + GLint /* internalformat */, + GLenum /* dest_type */, + GLboolean /* unpack_flip_y */, + GLboolean /* unpack_premultiply_alpha */, + GLboolean /* unpack_unmultiply_alpha */) { +} +void GLES2InterfaceStub::CopySubTextureCHROMIUM( + GLenum /* target */, + GLenum /* source_id */, + GLenum /* dest_id */, + GLint /* xoffset */, + GLint /* yoffset */, + GLint /* x */, + GLint /* y */, + GLsizei /* width */, + GLsizei /* height */, + GLboolean /* unpack_flip_y */, + GLboolean /* unpack_premultiply_alpha */, + GLboolean /* unpack_unmultiply_alpha */) { } void GLES2InterfaceStub::CompressedCopyTextureCHROMIUM(GLenum /* target */, GLenum /* source_id */, diff --git a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h index 28fbeaf..406d2d8 100644 --- a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h +++ b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h @@ -662,7 +662,10 @@ void CopyTextureCHROMIUM(GLenum target, GLenum source_id, GLenum dest_id, GLint internalformat, - GLenum dest_type) override; + GLenum dest_type, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha) override; void CopySubTextureCHROMIUM(GLenum target, GLenum source_id, GLenum dest_id, @@ -671,7 +674,10 @@ void CopySubTextureCHROMIUM(GLenum target, GLint x, GLint y, GLsizei width, - GLsizei height) override; + GLsizei height, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha) override; void CompressedCopyTextureCHROMIUM(GLenum target, GLenum source_id, GLenum dest_id) override; diff --git a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h index 76a5bde..c9d2d18 100644 --- a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h +++ b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h @@ -1911,28 +1911,38 @@ void GLES2TraceImplementation::TexImageIOSurface2DCHROMIUM(GLenum target, gl_->TexImageIOSurface2DCHROMIUM(target, width, height, ioSurfaceId, plane); } -void GLES2TraceImplementation::CopyTextureCHROMIUM(GLenum target, - GLenum source_id, - GLenum dest_id, - GLint internalformat, - GLenum dest_type) { +void GLES2TraceImplementation::CopyTextureCHROMIUM( + GLenum target, + GLenum source_id, + GLenum dest_id, + GLint internalformat, + GLenum dest_type, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::CopyTextureCHROMIUM"); gl_->CopyTextureCHROMIUM(target, source_id, dest_id, internalformat, - dest_type); -} - -void GLES2TraceImplementation::CopySubTextureCHROMIUM(GLenum target, - GLenum source_id, - GLenum dest_id, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height) { + dest_type, unpack_flip_y, unpack_premultiply_alpha, + unpack_unmultiply_alpha); +} + +void GLES2TraceImplementation::CopySubTextureCHROMIUM( + GLenum target, + GLenum source_id, + GLenum dest_id, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::CopySubTextureCHROMIUM"); - gl_->CopySubTextureCHROMIUM(target, source_id, dest_id, xoffset, yoffset, x, - y, width, height); + gl_->CopySubTextureCHROMIUM( + target, source_id, dest_id, xoffset, yoffset, x, y, width, height, + unpack_flip_y, unpack_premultiply_alpha, unpack_unmultiply_alpha); } void GLES2TraceImplementation::CompressedCopyTextureCHROMIUM(GLenum target, diff --git a/gpu/command_buffer/cmd_buffer_functions.txt b/gpu/command_buffer/cmd_buffer_functions.txt index f043280..590a4b3f 100644 --- a/gpu/command_buffer/cmd_buffer_functions.txt +++ b/gpu/command_buffer/cmd_buffer_functions.txt @@ -274,8 +274,8 @@ GL_APICALL GLuint GL_APIENTRY glCreateGpuMemoryBufferImageCHROMIUM (GLsize GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLidShader shader, GLsizeiNotNegative bufsize, GLsizeiOptional* length, char* source); GL_APICALL void GL_APIENTRY glPostSubBufferCHROMIUM (GLint x, GLint y, GLint width, GLint height); GL_APICALL void GL_APIENTRY glTexImageIOSurface2DCHROMIUM (GLenumTextureBindTarget target, GLsizei width, GLsizei height, GLuint ioSurfaceId, GLuint plane); -GL_APICALL void GL_APIENTRY glCopyTextureCHROMIUM (GLenum target, GLenum source_id, GLenum dest_id, GLintTextureInternalFormat internalformat, GLenumPixelType dest_type); -GL_APICALL void GL_APIENTRY glCopySubTextureCHROMIUM (GLenum target, GLenum source_id, GLenum dest_id, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glCopyTextureCHROMIUM (GLenum target, GLenum source_id, GLenum dest_id, GLintTextureInternalFormat internalformat, GLenumPixelType dest_type, GLboolean unpack_flip_y, GLboolean unpack_premultiply_alpha, GLboolean unpack_unmultiply_alpha); +GL_APICALL void GL_APIENTRY glCopySubTextureCHROMIUM (GLenum target, GLenum source_id, GLenum dest_id, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, GLboolean unpack_flip_y, GLboolean unpack_premultiply_alpha, GLboolean unpack_unmultiply_alpha); GL_APICALL void GL_APIENTRY glCompressedCopyTextureCHROMIUM (GLenum target, GLenum source_id, GLenum dest_id); GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenumDrawMode mode, GLint first, GLsizei count, GLsizei primcount); GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE (GLenumDrawMode mode, GLsizei count, GLenumIndexType type, const void* indices, GLsizei primcount); diff --git a/gpu/command_buffer/common/gles2_cmd_format_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_autogen.h index 272aed2..e7a6272 100644 --- a/gpu/command_buffer/common/gles2_cmd_format_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_format_autogen.h @@ -12156,13 +12156,19 @@ struct CopyTextureCHROMIUM { GLenum _source_id, GLenum _dest_id, GLint _internalformat, - GLenum _dest_type) { + GLenum _dest_type, + GLboolean _unpack_flip_y, + GLboolean _unpack_premultiply_alpha, + GLboolean _unpack_unmultiply_alpha) { SetHeader(); target = _target; source_id = _source_id; dest_id = _dest_id; internalformat = _internalformat; dest_type = _dest_type; + unpack_flip_y = _unpack_flip_y; + unpack_premultiply_alpha = _unpack_premultiply_alpha; + unpack_unmultiply_alpha = _unpack_unmultiply_alpha; } void* Set(void* cmd, @@ -12170,9 +12176,13 @@ struct CopyTextureCHROMIUM { GLenum _source_id, GLenum _dest_id, GLint _internalformat, - GLenum _dest_type) { - static_cast<ValueType*>(cmd) - ->Init(_target, _source_id, _dest_id, _internalformat, _dest_type); + GLenum _dest_type, + GLboolean _unpack_flip_y, + GLboolean _unpack_premultiply_alpha, + GLboolean _unpack_unmultiply_alpha) { + static_cast<ValueType*>(cmd)->Init( + _target, _source_id, _dest_id, _internalformat, _dest_type, + _unpack_flip_y, _unpack_premultiply_alpha, _unpack_unmultiply_alpha); return NextCmdAddress<ValueType>(cmd); } @@ -12182,10 +12192,13 @@ struct CopyTextureCHROMIUM { uint32_t dest_id; int32_t internalformat; uint32_t dest_type; + uint32_t unpack_flip_y; + uint32_t unpack_premultiply_alpha; + uint32_t unpack_unmultiply_alpha; }; -static_assert(sizeof(CopyTextureCHROMIUM) == 24, - "size of CopyTextureCHROMIUM should be 24"); +static_assert(sizeof(CopyTextureCHROMIUM) == 36, + "size of CopyTextureCHROMIUM should be 36"); static_assert(offsetof(CopyTextureCHROMIUM, header) == 0, "offset of CopyTextureCHROMIUM header should be 0"); static_assert(offsetof(CopyTextureCHROMIUM, target) == 4, @@ -12198,6 +12211,14 @@ static_assert(offsetof(CopyTextureCHROMIUM, internalformat) == 16, "offset of CopyTextureCHROMIUM internalformat should be 16"); static_assert(offsetof(CopyTextureCHROMIUM, dest_type) == 20, "offset of CopyTextureCHROMIUM dest_type should be 20"); +static_assert(offsetof(CopyTextureCHROMIUM, unpack_flip_y) == 24, + "offset of CopyTextureCHROMIUM unpack_flip_y should be 24"); +static_assert( + offsetof(CopyTextureCHROMIUM, unpack_premultiply_alpha) == 28, + "offset of CopyTextureCHROMIUM unpack_premultiply_alpha should be 28"); +static_assert( + offsetof(CopyTextureCHROMIUM, unpack_unmultiply_alpha) == 32, + "offset of CopyTextureCHROMIUM unpack_unmultiply_alpha should be 32"); struct CopySubTextureCHROMIUM { typedef CopySubTextureCHROMIUM ValueType; @@ -12219,7 +12240,10 @@ struct CopySubTextureCHROMIUM { GLint _x, GLint _y, GLsizei _width, - GLsizei _height) { + GLsizei _height, + GLboolean _unpack_flip_y, + GLboolean _unpack_premultiply_alpha, + GLboolean _unpack_unmultiply_alpha) { SetHeader(); target = _target; source_id = _source_id; @@ -12230,6 +12254,9 @@ struct CopySubTextureCHROMIUM { y = _y; width = _width; height = _height; + unpack_flip_y = _unpack_flip_y; + unpack_premultiply_alpha = _unpack_premultiply_alpha; + unpack_unmultiply_alpha = _unpack_unmultiply_alpha; } void* Set(void* cmd, @@ -12241,9 +12268,14 @@ struct CopySubTextureCHROMIUM { GLint _x, GLint _y, GLsizei _width, - GLsizei _height) { - static_cast<ValueType*>(cmd)->Init(_target, _source_id, _dest_id, _xoffset, - _yoffset, _x, _y, _width, _height); + GLsizei _height, + GLboolean _unpack_flip_y, + GLboolean _unpack_premultiply_alpha, + GLboolean _unpack_unmultiply_alpha) { + static_cast<ValueType*>(cmd) + ->Init(_target, _source_id, _dest_id, _xoffset, _yoffset, _x, _y, + _width, _height, _unpack_flip_y, _unpack_premultiply_alpha, + _unpack_unmultiply_alpha); return NextCmdAddress<ValueType>(cmd); } @@ -12257,10 +12289,13 @@ struct CopySubTextureCHROMIUM { int32_t y; int32_t width; int32_t height; + uint32_t unpack_flip_y; + uint32_t unpack_premultiply_alpha; + uint32_t unpack_unmultiply_alpha; }; -static_assert(sizeof(CopySubTextureCHROMIUM) == 40, - "size of CopySubTextureCHROMIUM should be 40"); +static_assert(sizeof(CopySubTextureCHROMIUM) == 52, + "size of CopySubTextureCHROMIUM should be 52"); static_assert(offsetof(CopySubTextureCHROMIUM, header) == 0, "offset of CopySubTextureCHROMIUM header should be 0"); static_assert(offsetof(CopySubTextureCHROMIUM, target) == 4, @@ -12281,6 +12316,14 @@ static_assert(offsetof(CopySubTextureCHROMIUM, width) == 32, "offset of CopySubTextureCHROMIUM width should be 32"); static_assert(offsetof(CopySubTextureCHROMIUM, height) == 36, "offset of CopySubTextureCHROMIUM height should be 36"); +static_assert(offsetof(CopySubTextureCHROMIUM, unpack_flip_y) == 40, + "offset of CopySubTextureCHROMIUM unpack_flip_y should be 40"); +static_assert( + offsetof(CopySubTextureCHROMIUM, unpack_premultiply_alpha) == 44, + "offset of CopySubTextureCHROMIUM unpack_premultiply_alpha should be 44"); +static_assert( + offsetof(CopySubTextureCHROMIUM, unpack_unmultiply_alpha) == 48, + "offset of CopySubTextureCHROMIUM unpack_unmultiply_alpha should be 48"); struct CompressedCopyTextureCHROMIUM { typedef CompressedCopyTextureCHROMIUM ValueType; diff --git a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h index 8700f7f..cb4145a6 100644 --- a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h @@ -4129,9 +4129,11 @@ TEST_F(GLES2FormatTest, TexImageIOSurface2DCHROMIUM) { TEST_F(GLES2FormatTest, CopyTextureCHROMIUM) { cmds::CopyTextureCHROMIUM& cmd = *GetBufferAs<cmds::CopyTextureCHROMIUM>(); - void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11), - static_cast<GLenum>(12), static_cast<GLenum>(13), - static_cast<GLint>(14), static_cast<GLenum>(15)); + void* next_cmd = + cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12), + static_cast<GLenum>(13), static_cast<GLint>(14), + static_cast<GLenum>(15), static_cast<GLboolean>(16), + static_cast<GLboolean>(17), static_cast<GLboolean>(18)); EXPECT_EQ(static_cast<uint32_t>(cmds::CopyTextureCHROMIUM::kCmdId), cmd.header.command); EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); @@ -4140,17 +4142,21 @@ TEST_F(GLES2FormatTest, CopyTextureCHROMIUM) { EXPECT_EQ(static_cast<GLenum>(13), cmd.dest_id); EXPECT_EQ(static_cast<GLint>(14), cmd.internalformat); EXPECT_EQ(static_cast<GLenum>(15), cmd.dest_type); + EXPECT_EQ(static_cast<GLboolean>(16), cmd.unpack_flip_y); + EXPECT_EQ(static_cast<GLboolean>(17), cmd.unpack_premultiply_alpha); + EXPECT_EQ(static_cast<GLboolean>(18), cmd.unpack_unmultiply_alpha); CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd)); } TEST_F(GLES2FormatTest, CopySubTextureCHROMIUM) { cmds::CopySubTextureCHROMIUM& cmd = *GetBufferAs<cmds::CopySubTextureCHROMIUM>(); - void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11), - static_cast<GLenum>(12), static_cast<GLenum>(13), - static_cast<GLint>(14), static_cast<GLint>(15), - static_cast<GLint>(16), static_cast<GLint>(17), - static_cast<GLsizei>(18), static_cast<GLsizei>(19)); + void* next_cmd = cmd.Set( + &cmd, static_cast<GLenum>(11), static_cast<GLenum>(12), + static_cast<GLenum>(13), static_cast<GLint>(14), static_cast<GLint>(15), + static_cast<GLint>(16), static_cast<GLint>(17), static_cast<GLsizei>(18), + static_cast<GLsizei>(19), static_cast<GLboolean>(20), + static_cast<GLboolean>(21), static_cast<GLboolean>(22)); EXPECT_EQ(static_cast<uint32_t>(cmds::CopySubTextureCHROMIUM::kCmdId), cmd.header.command); EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); @@ -4163,6 +4169,9 @@ TEST_F(GLES2FormatTest, CopySubTextureCHROMIUM) { EXPECT_EQ(static_cast<GLint>(17), cmd.y); EXPECT_EQ(static_cast<GLsizei>(18), cmd.width); EXPECT_EQ(static_cast<GLsizei>(19), cmd.height); + EXPECT_EQ(static_cast<GLboolean>(20), cmd.unpack_flip_y); + EXPECT_EQ(static_cast<GLboolean>(21), cmd.unpack_premultiply_alpha); + EXPECT_EQ(static_cast<GLboolean>(22), cmd.unpack_unmultiply_alpha); CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd)); } diff --git a/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h b/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h index 4ce6088..7cba537 100644 --- a/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h @@ -45,10 +45,6 @@ static const GLES2Util::EnumToString enum_to_string_table[] = { "GL_DRAW_BUFFER0_EXT", }, { - 0x94F8, - "GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL", - }, - { 0x8D94, "GL_RED_INTEGER", }, @@ -585,10 +581,18 @@ static const GLES2Util::EnumToString enum_to_string_table[] = { "GL_MULTISAMPLE_BUFFER_BIT7_QCOM", }, { + 0x94F8, + "GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL", + }, + { 0x8A48, "GL_TEXTURE_SRGB_DECODE_EXT", }, { + 0x300E, + "GL_CONTEXT_LOST", + }, + { 0x02000000, "GL_MULTISAMPLE_BUFFER_BIT1_QCOM", }, @@ -881,10 +885,6 @@ static const GLES2Util::EnumToString enum_to_string_table[] = { "GL_FETCH_PER_SAMPLE_ARM", }, { - 0x8F97, - "GL_RGBA8_SNORM", - }, - { 0x92D3, "GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_EXT", }, @@ -1725,8 +1725,8 @@ static const GLES2Util::EnumToString enum_to_string_table[] = { "GL_DEPTH_COMPONENT16_NONLINEAR_NV", }, { - 0x8508, - "GL_DECR_WRAP", + 0x889F, + "GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING", }, { 0x8219, @@ -1813,6 +1813,10 @@ static const GLES2Util::EnumToString enum_to_string_table[] = { "GL_LEQUAL", }, { + 0x8BD6, + "GL_TEXTURE_FORMAT_QCOM", + }, + { 0x8228, "GL_RG_INTEGER", }, @@ -1973,6 +1977,10 @@ static const GLES2Util::EnumToString enum_to_string_table[] = { "GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_EXT", }, { + 0x8DCA, + "GL_INT_SAMPLER_2D", + }, + { 0x93C7, "GL_COMPRESSED_RGBA_ASTC_6x5x5_OES", }, @@ -2325,10 +2333,6 @@ static const GLES2Util::EnumToString enum_to_string_table[] = { "GL_BLEND_EQUATION", }, { - 0x8DCA, - "GL_INT_SAMPLER_2D", - }, - { 0x911F, "GL_BUFFER_ACCESS_FLAGS", }, @@ -2409,8 +2413,8 @@ static const GLES2Util::EnumToString enum_to_string_table[] = { "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE", }, { - 0x929E, - "GL_DIFFERENCE_KHR", + 0x846E, + "GL_ALIASED_LINE_WIDTH_RANGE", }, { 0x0B90, @@ -2573,8 +2577,8 @@ static const GLES2Util::EnumToString enum_to_string_table[] = { "GL_ALIASED_POINT_SIZE_RANGE", }, { - 0x846E, - "GL_ALIASED_LINE_WIDTH_RANGE", + 0x929E, + "GL_DIFFERENCE_KHR", }, { 0x929F, @@ -2777,10 +2781,6 @@ static const GLES2Util::EnumToString enum_to_string_table[] = { "GL_BUFFER_SIZE", }, { - 0x8BD6, - "GL_TEXTURE_FORMAT_QCOM", - }, - { 0x8B99, "GL_PALETTE8_RGB5_A1_OES", }, @@ -3105,8 +3105,8 @@ static const GLES2Util::EnumToString enum_to_string_table[] = { "GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV", }, { - 0x1102, - "GL_NICEST", + 0x8251, + "GL_DEBUG_TYPE_OTHER_KHR", }, { 0x8C4F, @@ -3729,10 +3729,6 @@ static const GLES2Util::EnumToString enum_to_string_table[] = { "GL_FIRST_VERTEX_CONVENTION_EXT", }, { - 0x300E, - "GL_CONTEXT_LOST", - }, - { 0x8E24, "GL_TRANSFORM_FEEDBACK_ACTIVE", }, @@ -3897,6 +3893,10 @@ static const GLES2Util::EnumToString enum_to_string_table[] = { "GL_MIN_SAMPLE_SHADING_VALUE_OES", }, { + 0x8F97, + "GL_RGBA8_SNORM", + }, + { 0x8CE9, "GL_COLOR_ATTACHMENT9_EXT", }, @@ -3917,8 +3917,8 @@ static const GLES2Util::EnumToString enum_to_string_table[] = { "GL_UNSIGNED_INT_VEC2", }, { - 0x889F, - "GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING", + 0x8508, + "GL_DECR_WRAP", }, { 0x92AD, @@ -4193,8 +4193,8 @@ static const GLES2Util::EnumToString enum_to_string_table[] = { "GL_FASTEST", }, { - 0x8251, - "GL_DEBUG_TYPE_OTHER_KHR", + 0x1102, + "GL_NICEST", }, { 0x8250, diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index caf752e..c2fd4e7 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -1035,7 +1035,10 @@ class GLES2DecoderImpl : public GLES2Decoder, GLuint source_id, GLuint dest_id, GLenum internal_format, - GLenum dest_type); + GLenum dest_type, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha); void DoCopySubTextureCHROMIUM(GLenum target, GLuint source_id, @@ -1045,7 +1048,10 @@ class GLES2DecoderImpl : public GLES2Decoder, GLint x, GLint y, GLsizei width, - GLsizei height); + GLsizei height, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha); void DoCompressedCopyTextureCHROMIUM(GLenum target, GLuint source_id, @@ -12016,13 +12022,23 @@ bool GLES2DecoderImpl::ValidateCompressedCopyTextureCHROMIUM( return true; } -void GLES2DecoderImpl::DoCopyTextureCHROMIUM(GLenum target, - GLuint source_id, - GLuint dest_id, - GLenum internal_format, - GLenum dest_type) { +void GLES2DecoderImpl::DoCopyTextureCHROMIUM( + GLenum target, + GLuint source_id, + GLuint dest_id, + GLenum internal_format, + GLenum dest_type, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha) { TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopyTextureCHROMIUM"); + // TODO(zmo): Get rid of the following three lines when we begin to pass + // in meaningful data to these three arguments in blink. + unpack_flip_y = unpack_flip_y_; + unpack_premultiply_alpha = unpack_premultiply_alpha_; + unpack_unmultiply_alpha = unpack_unpremultiply_alpha_; + TextureRef* source_texture_ref = GetTexture(source_id); TextureRef* dest_texture_ref = GetTexture(dest_id); Texture* source_texture = source_texture_ref->texture(); @@ -12136,8 +12152,8 @@ void GLES2DecoderImpl::DoCopyTextureCHROMIUM(GLenum target, // Try using GLImage::CopyTexSubImage when possible. bool unpack_premultiply_alpha_change = - unpack_premultiply_alpha_ ^ unpack_unpremultiply_alpha_; - if (image && !unpack_flip_y_ && !unpack_premultiply_alpha_change) { + (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; + if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); if (image->CopyTexSubImage(GL_TEXTURE_2D, gfx::Point(0, 0), gfx::Rect(0, 0, source_width, source_height))) { @@ -12154,31 +12170,45 @@ void GLES2DecoderImpl::DoCopyTextureCHROMIUM(GLenum target, // instead of using kIdentityMatrix crbug.com/226218. copy_texture_CHROMIUM_->DoCopyTextureWithTransform( this, source_texture->target(), source_texture->service_id(), - dest_texture->service_id(), source_width, source_height, unpack_flip_y_, - unpack_premultiply_alpha_, unpack_unpremultiply_alpha_, + dest_texture->service_id(), source_width, source_height, + unpack_flip_y == GL_TRUE, + unpack_premultiply_alpha == GL_TRUE, + unpack_unmultiply_alpha == GL_TRUE, kIdentityMatrix); } else { copy_texture_CHROMIUM_->DoCopyTexture( this, source_texture->target(), source_texture->service_id(), source_internal_format, dest_texture->service_id(), internal_format, - source_width, source_height, unpack_flip_y_, unpack_premultiply_alpha_, - unpack_unpremultiply_alpha_); + source_width, source_height, + unpack_flip_y == GL_TRUE, + unpack_premultiply_alpha == GL_TRUE, + unpack_unmultiply_alpha == GL_TRUE); } DoDidUseTexImageIfNeeded(source_texture, source_texture->target()); } -void GLES2DecoderImpl::DoCopySubTextureCHROMIUM(GLenum target, - GLuint source_id, - GLuint dest_id, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height) { +void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( + GLenum target, + GLuint source_id, + GLuint dest_id, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha) { TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopySubTextureCHROMIUM"); + // TODO(zmo): Get rid of the following three lines when we begin to pass + // in meaningful data to these three arguments in blink. + unpack_flip_y = unpack_flip_y_; + unpack_premultiply_alpha = unpack_premultiply_alpha_; + unpack_unmultiply_alpha = unpack_unpremultiply_alpha_; + TextureRef* source_texture_ref = GetTexture(source_id); TextureRef* dest_texture_ref = GetTexture(dest_id); Texture* source_texture = source_texture_ref->texture(); @@ -12298,8 +12328,8 @@ void GLES2DecoderImpl::DoCopySubTextureCHROMIUM(GLenum target, // Try using GLImage::CopyTexSubImage when possible. bool unpack_premultiply_alpha_change = - unpack_premultiply_alpha_ ^ unpack_unpremultiply_alpha_; - if (image && !unpack_flip_y_ && !unpack_premultiply_alpha_change) { + (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; + if (image && !unpack_flip_y && !unpack_premultiply_alpha_change) { glBindTexture(GL_TEXTURE_2D, dest_texture->service_id()); if (image->CopyTexSubImage(GL_TEXTURE_2D, gfx::Point(xoffset, yoffset), gfx::Rect(x, y, width, height))) { @@ -12315,8 +12345,10 @@ void GLES2DecoderImpl::DoCopySubTextureCHROMIUM(GLenum target, this, source_texture->target(), source_texture->service_id(), source_internal_format, dest_texture->service_id(), dest_internal_format, xoffset, yoffset, x, y, width, height, dest_width, dest_height, - source_width, source_height, unpack_flip_y_, unpack_premultiply_alpha_, - unpack_unpremultiply_alpha_); + source_width, source_height, + unpack_flip_y == GL_TRUE, + unpack_premultiply_alpha == GL_TRUE, + unpack_unmultiply_alpha == GL_TRUE); DoDidUseTexImageIfNeeded(source_texture, source_texture->target()); } @@ -12375,14 +12407,6 @@ void GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM(GLenum target, return; } - bool unpack_premultiply_alpha_change = - unpack_premultiply_alpha_ ^ unpack_unpremultiply_alpha_; - if (unpack_flip_y_ || unpack_premultiply_alpha_change) { - LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCompressedCopyTextureCHROMIUM", - "pixel-storage multipliers are not supported"); - return; - } - if (!ValidateCompressedCopyTextureCHROMIUM( "glCompressedCopyTextureCHROMIUM", target, @@ -12494,14 +12518,12 @@ void GLES2DecoderImpl::DoCompressedCopyTextureCHROMIUM(GLenum target, copy_texture_CHROMIUM_->DoCopyTextureWithTransform( this, source_texture->target(), source_texture->service_id(), dest_texture->service_id(), source_width, source_height, - unpack_flip_y_, unpack_premultiply_alpha_, - unpack_unpremultiply_alpha_, kIdentityMatrix); + false, false, false, kIdentityMatrix); } else { copy_texture_CHROMIUM_->DoCopyTexture( this, source_texture->target(), source_texture->service_id(), source_internal_format, dest_texture->service_id(), GL_RGBA, - source_width, source_height, unpack_flip_y_, - unpack_premultiply_alpha_, unpack_unpremultiply_alpha_); + source_width, source_height, false, false, false); } DoDidUseTexImageIfNeeded(source_texture, source_texture->target()); diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h index 4925c73e..1314d0d 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h @@ -4454,6 +4454,11 @@ error::Error GLES2DecoderImpl::HandleCopyTextureCHROMIUM( GLenum dest_id = static_cast<GLenum>(c.dest_id); GLint internalformat = static_cast<GLint>(c.internalformat); GLenum dest_type = static_cast<GLenum>(c.dest_type); + GLboolean unpack_flip_y = static_cast<GLboolean>(c.unpack_flip_y); + GLboolean unpack_premultiply_alpha = + static_cast<GLboolean>(c.unpack_premultiply_alpha); + GLboolean unpack_unmultiply_alpha = + static_cast<GLboolean>(c.unpack_unmultiply_alpha); if (!validators_->texture_internal_format.IsValid(internalformat)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopyTextureCHROMIUM", "internalformat GL_INVALID_VALUE"); @@ -4464,7 +4469,9 @@ error::Error GLES2DecoderImpl::HandleCopyTextureCHROMIUM( "dest_type"); return error::kNoError; } - DoCopyTextureCHROMIUM(target, source_id, dest_id, internalformat, dest_type); + DoCopyTextureCHROMIUM(target, source_id, dest_id, internalformat, dest_type, + unpack_flip_y, unpack_premultiply_alpha, + unpack_unmultiply_alpha); return error::kNoError; } @@ -4483,6 +4490,11 @@ error::Error GLES2DecoderImpl::HandleCopySubTextureCHROMIUM( GLint y = static_cast<GLint>(c.y); GLsizei width = static_cast<GLsizei>(c.width); GLsizei height = static_cast<GLsizei>(c.height); + GLboolean unpack_flip_y = static_cast<GLboolean>(c.unpack_flip_y); + GLboolean unpack_premultiply_alpha = + static_cast<GLboolean>(c.unpack_premultiply_alpha); + GLboolean unpack_unmultiply_alpha = + static_cast<GLboolean>(c.unpack_unmultiply_alpha); if (width < 0) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", "width < 0"); @@ -4494,7 +4506,8 @@ error::Error GLES2DecoderImpl::HandleCopySubTextureCHROMIUM( return error::kNoError; } DoCopySubTextureCHROMIUM(target, source_id, dest_id, xoffset, yoffset, x, y, - width, height); + width, height, unpack_flip_y, + unpack_premultiply_alpha, unpack_unmultiply_alpha); return error::kNoError; } diff --git a/gpu/command_buffer/tests/gl_copy_texture_CHROMIUM_unittest.cc b/gpu/command_buffer/tests/gl_copy_texture_CHROMIUM_unittest.cc index 160e85f..cce8943 100644 --- a/gpu/command_buffer/tests/gl_copy_texture_CHROMIUM_unittest.cc +++ b/gpu/command_buffer/tests/gl_copy_texture_CHROMIUM_unittest.cc @@ -75,14 +75,14 @@ TEST_P(GLCopyTextureCHROMIUMTest, Basic) { if (copy_type == TexImage) { glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, - GL_UNSIGNED_BYTE); + GL_UNSIGNED_BYTE, false, false, false); } else { glBindTexture(GL_TEXTURE_2D, textures_[1]); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0, - 0, 1, 1); + 0, 1, 1, false, false, false); } EXPECT_TRUE(glGetError() == GL_NO_ERROR); @@ -122,11 +122,11 @@ TEST_P(GLCopyTextureCHROMIUMTest, ImmutableTexture) { if (copy_type == TexImage) { glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, - GL_UNSIGNED_BYTE); + GL_UNSIGNED_BYTE, false, false, false); EXPECT_TRUE(glGetError() == GL_INVALID_OPERATION); } else { glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0, - 0, 1, 1); + 0, 1, 1, false, false, false); EXPECT_TRUE(glGetError() == GL_NO_ERROR); // Check the FB is still bound. @@ -160,7 +160,8 @@ TEST_P(GLCopyTextureCHROMIUMTest, InternalFormat) { if (copy_type == TexImage) { glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], - dest_formats[dest_index], GL_UNSIGNED_BYTE); + dest_formats[dest_index], GL_UNSIGNED_BYTE, + false, false, false); } else { glBindTexture(GL_TEXTURE_2D, textures_[1]); glTexImage2D(GL_TEXTURE_2D, 0, dest_formats[dest_index], 1, 1, 0, @@ -168,7 +169,7 @@ TEST_P(GLCopyTextureCHROMIUMTest, InternalFormat) { EXPECT_TRUE(GL_NO_ERROR == glGetError()); glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, - 0, 0, 0, 1, 1); + 0, 0, 0, 1, 1, false, false, false); } EXPECT_TRUE(GL_NO_ERROR == glGetError()) << "src_index:" << src_index @@ -192,14 +193,14 @@ TEST_P(GLCopyTextureCHROMIUMTest, InternalFormatNotSupported) { if (copy_type == TexImage) { glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], unsupported_dest_formats[dest_index], - GL_UNSIGNED_BYTE); + GL_UNSIGNED_BYTE, false, false, false); } else { glBindTexture(GL_TEXTURE_2D, textures_[1]); glTexImage2D(GL_TEXTURE_2D, 0, unsupported_dest_formats[dest_index], 1, 1, 0, unsupported_dest_formats[dest_index], GL_UNSIGNED_BYTE, nullptr); glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, - 0, 0, 1, 1); + 0, 0, 1, 1, false, false, false); } EXPECT_TRUE(GL_INVALID_OPERATION == glGetError()) << "dest_index:" << dest_index; @@ -240,7 +241,7 @@ TEST_F(GLCopyTextureCHROMIUMTest, RedefineDestinationTexture) { // If the dest texture has different properties, glCopyTextureCHROMIUM() // redefines them. glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, - GL_UNSIGNED_BYTE); + GL_UNSIGNED_BYTE, false, false, false); EXPECT_TRUE(GL_NO_ERROR == glGetError()); // glTexSubImage2D() succeeds because textures_[1] is redefined into 2x2 @@ -285,13 +286,13 @@ TEST_P(GLCopyTextureCHROMIUMTest, FlipY) { if (copy_type == TexImage) { glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, - GL_UNSIGNED_BYTE); + GL_UNSIGNED_BYTE, true, false, false); } else { glBindTexture(GL_TEXTURE_2D, textures_[1]); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0, - 0, 2, 2); + 0, 2, 2, true, false, false); } EXPECT_TRUE(GL_NO_ERROR == glGetError()); @@ -322,13 +323,13 @@ TEST_P(GLCopyTextureCHROMIUMTest, PremultiplyAlpha) { glPixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE); if (copy_type == TexImage) { glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, - GL_UNSIGNED_BYTE); + GL_UNSIGNED_BYTE, false, true, false); } else { glBindTexture(GL_TEXTURE_2D, textures_[1]); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0, - 0, 1, 1); + 0, 1, 1, false, true, false); } EXPECT_TRUE(GL_NO_ERROR == glGetError()); @@ -355,13 +356,13 @@ TEST_P(GLCopyTextureCHROMIUMTest, UnpremultiplyAlpha) { glPixelStorei(GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE); if (copy_type == TexImage) { glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, - GL_UNSIGNED_BYTE); + GL_UNSIGNED_BYTE, false, false, true); } else { glBindTexture(GL_TEXTURE_2D, textures_[1]); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0, - 0, 1, 1); + 0, 1, 1, false, false, true); } EXPECT_TRUE(GL_NO_ERROR == glGetError()); @@ -396,13 +397,13 @@ TEST_P(GLCopyTextureCHROMIUMTest, FlipYAndPremultiplyAlpha) { glPixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE); if (copy_type == TexImage) { glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, - GL_UNSIGNED_BYTE); + GL_UNSIGNED_BYTE, true, true, false); } else { glBindTexture(GL_TEXTURE_2D, textures_[1]); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0, - 0, 2, 2); + 0, 2, 2, true, true, false); } EXPECT_TRUE(GL_NO_ERROR == glGetError()); @@ -441,13 +442,13 @@ TEST_P(GLCopyTextureCHROMIUMTest, FlipYAndUnpremultiplyAlpha) { glPixelStorei(GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, GL_TRUE); if (copy_type == TexImage) { glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, - GL_UNSIGNED_BYTE); + GL_UNSIGNED_BYTE, true, false, true); } else { glBindTexture(GL_TEXTURE_2D, textures_[1]); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0, - 0, 2, 2); + 0, 2, 2, true, false, true); } EXPECT_TRUE(GL_NO_ERROR == glGetError()); @@ -509,10 +510,10 @@ TEST_P(GLCopyTextureCHROMIUMTest, BasicStatePreservation) { if (copy_type == TexImage) { glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, - GL_UNSIGNED_BYTE); + GL_UNSIGNED_BYTE, false, false, false); } else { glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, - 0, 0, 1, 1); + 0, 0, 1, 1, false, false, false); } EXPECT_TRUE(GL_NO_ERROR == glGetError()); @@ -568,10 +569,10 @@ TEST_P(GLCopyTextureCHROMIUMTest, TextureStatePreserved) { if (copy_type == TexImage) { glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, - GL_UNSIGNED_BYTE); + GL_UNSIGNED_BYTE, false, false, false); } else { glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0, - 0, 1, 1); + 0, 1, 1, false, false, false); } EXPECT_TRUE(GL_NO_ERROR == glGetError()); @@ -640,10 +641,10 @@ TEST_P(GLCopyTextureCHROMIUMTest, FBOStatePreserved) { if (copy_type == TexImage) { glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, - GL_UNSIGNED_BYTE); + GL_UNSIGNED_BYTE, false, false, false); } else { glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0, - 0, 1, 1); + 0, 1, 1, false, false, false); } EXPECT_TRUE(GL_NO_ERROR == glGetError()); @@ -749,13 +750,13 @@ TEST_P(GLCopyTextureCHROMIUMTest, ProgramStatePreservation) { pixels); if (copy_type == TexImage) { glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, - GL_UNSIGNED_BYTE); + GL_UNSIGNED_BYTE, false, false, false); } else { glBindTexture(GL_TEXTURE_2D, textures_[1]); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0, - 0, 1, 1); + 0, 1, 1, false, false, false); } // test using program after @@ -781,13 +782,13 @@ TEST_P(GLCopyTextureCHROMIUMTest, UninitializedSource) { if (copy_type == TexImage) { glCopyTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], GL_RGBA, - GL_UNSIGNED_BYTE); + GL_UNSIGNED_BYTE, false, false, false); } else { glBindTexture(GL_TEXTURE_2D, textures_[1]); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, kWidth, kHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 0, - 0, kWidth, kHeight); + 0, kWidth, kHeight, false, false, false); } EXPECT_TRUE(GL_NO_ERROR == glGetError()); @@ -815,27 +816,27 @@ TEST_F(GLCopyTextureCHROMIUMTest, CopySubTextureDimension) { nullptr); glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 1, 1, 0, - 0, 1, 1); + 0, 1, 1, false, false, false); EXPECT_TRUE(GL_NO_ERROR == glGetError()); // xoffset < 0 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], -1, 1, 0, - 0, 1, 1); + 0, 1, 1, false, false, false); EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); // x < 0 glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 1, 1, -1, - 0, 1, 1); + 0, 1, 1, false, false, false); EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); // xoffset + width > dest_width glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 2, 2, 0, - 0, 2, 2); + 0, 2, 2, false, false, false); EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); // x + width > source_width glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 0, 1, - 1, 2, 2); + 1, 2, 2, false, false, false); EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); } @@ -867,13 +868,13 @@ TEST_F(GLCopyTextureCHROMIUMTest, CopySubTextureOffset) { transparent_pixels); glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 1, 1, 0, - 0, 1, 1); + 0, 1, 1, false, false, false); EXPECT_TRUE(glGetError() == GL_NO_ERROR); glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 1, 0, 1, - 0, 1, 1); + 0, 1, 1, false, false, false); EXPECT_TRUE(glGetError() == GL_NO_ERROR); glCopySubTextureCHROMIUM(GL_TEXTURE_2D, textures_[0], textures_[1], 0, 1, 0, - 1, 1, 1); + 1, 1, 1, false, false, false); EXPECT_TRUE(glGetError() == GL_NO_ERROR); // Check the FB is still bound. diff --git a/media/blink/skcanvas_video_renderer.cc b/media/blink/skcanvas_video_renderer.cc index 363c21d..71d1e77 100644 --- a/media/blink/skcanvas_video_renderer.cc +++ b/media/blink/skcanvas_video_renderer.cc @@ -644,7 +644,8 @@ void SkCanvasVideoRenderer::CopyVideoFrameSingleTextureToGLTexture( // "flip_y == false" means to keep the intrinsic orientation. gl->PixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, flip_y); gl->CopyTextureCHROMIUM(GL_TEXTURE_2D, source_texture, texture, - internal_format, type); + internal_format, type, + flip_y, premultiply_alpha, false); gl->PixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false); gl->PixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, false); diff --git a/mojo/gpu/mojo_gles2_impl_autogen.cc b/mojo/gpu/mojo_gles2_impl_autogen.cc index 054a593..2b54de9 100644 --- a/mojo/gpu/mojo_gles2_impl_autogen.cc +++ b/mojo/gpu/mojo_gles2_impl_autogen.cc @@ -1450,9 +1450,14 @@ void MojoGLES2Impl::CopyTextureCHROMIUM(GLenum target, GLenum source_id, GLenum dest_id, GLint internalformat, - GLenum dest_type) { + GLenum dest_type, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha) { MojoGLES2MakeCurrent(context_); - glCopyTextureCHROMIUM(target, source_id, dest_id, internalformat, dest_type); + glCopyTextureCHROMIUM(target, source_id, dest_id, internalformat, dest_type, + unpack_flip_y, unpack_premultiply_alpha, + unpack_unmultiply_alpha); } void MojoGLES2Impl::CopySubTextureCHROMIUM(GLenum target, GLenum source_id, @@ -1462,10 +1467,14 @@ void MojoGLES2Impl::CopySubTextureCHROMIUM(GLenum target, GLint x, GLint y, GLsizei width, - GLsizei height) { + GLsizei height, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha) { MojoGLES2MakeCurrent(context_); glCopySubTextureCHROMIUM(target, source_id, dest_id, xoffset, yoffset, x, y, - width, height); + width, height, unpack_flip_y, + unpack_premultiply_alpha, unpack_unmultiply_alpha); } void MojoGLES2Impl::CompressedCopyTextureCHROMIUM(GLenum target, GLenum source_id, diff --git a/mojo/gpu/mojo_gles2_impl_autogen.h b/mojo/gpu/mojo_gles2_impl_autogen.h index 723dda6..92eb9c0 100644 --- a/mojo/gpu/mojo_gles2_impl_autogen.h +++ b/mojo/gpu/mojo_gles2_impl_autogen.h @@ -686,7 +686,10 @@ class MojoGLES2Impl : public gpu::gles2::GLES2Interface { GLenum source_id, GLenum dest_id, GLint internalformat, - GLenum dest_type) override; + GLenum dest_type, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha) override; void CopySubTextureCHROMIUM(GLenum target, GLenum source_id, GLenum dest_id, @@ -695,7 +698,10 @@ class MojoGLES2Impl : public gpu::gles2::GLES2Interface { GLint x, GLint y, GLsizei width, - GLsizei height) override; + GLsizei height, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha) override; void CompressedCopyTextureCHROMIUM(GLenum target, GLenum source_id, GLenum dest_id) override; diff --git a/third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_chromium_copy_texture_autogen.h b/third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_chromium_copy_texture_autogen.h index 9a3c398..e0ad481 100644 --- a/third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_chromium_copy_texture_autogen.h +++ b/third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_chromium_copy_texture_autogen.h @@ -14,18 +14,41 @@ VISIT_GL_CALL(CopyTextureCHROMIUM, GLenum source_id, GLenum dest_id, GLint internalformat, - GLenum dest_type), - (target, source_id, dest_id, internalformat, dest_type)) -VISIT_GL_CALL( - CopySubTextureCHROMIUM, - void, - (GLenum target, - GLenum source_id, - GLenum dest_id, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height), - (target, source_id, dest_id, xoffset, yoffset, x, y, width, height)) + GLenum dest_type, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha), + (target, + source_id, + dest_id, + internalformat, + dest_type, + unpack_flip_y, + unpack_premultiply_alpha, + unpack_unmultiply_alpha)) +VISIT_GL_CALL(CopySubTextureCHROMIUM, + void, + (GLenum target, + GLenum source_id, + GLenum dest_id, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha), + (target, + source_id, + dest_id, + xoffset, + yoffset, + x, + y, + width, + height, + unpack_flip_y, + unpack_premultiply_alpha, + unpack_unmultiply_alpha)) |