gpu: Add the ability to wait on upload completion.
Patch originally by Eric Penner <[email protected]>.
We currently have high latency if need to wait for uploads
in the renderer client. If we can do a shallow client side
wait it will be much better. This is effectively the
same as doing synchronous uploads, but exposes less driver
bug surface area then mixing uploads across threads.
BUG=161828, 178634
Review URL: https://chromiumcodereview.appspot.com/12210129
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186190 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 77aa601..ed177256 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -10151,6 +10151,26 @@
return error::kNoError;
}
+error::Error GLES2DecoderImpl::HandleWaitAsyncTexImage2DCHROMIUM(
+ uint32 immediate_data_size, const cmds::WaitAsyncTexImage2DCHROMIUM& c) {
+ TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleWaitAsyncTexImage2DCHROMIUM");
+ GLenum target = static_cast<GLenum>(c.target);
+
+ if (GL_TEXTURE_2D != target) {
+ SetGLError(GL_INVALID_ENUM, "glWaitAsyncTexImage2DCHROMIUM", "target");
+ return error::kNoError;
+ }
+ Texture* info = GetTextureInfoForTarget(target);
+ if (!info) {
+ SetGLError(GL_INVALID_OPERATION,
+ "glWaitAsyncTexImage2DCHROMIUM", "unknown texture");
+ return error::kNoError;
+ }
+ async_pixel_transfer_delegate_->WaitForTransferCompletion(
+ info->GetAsyncTransferState());
+ return error::kNoError;
+}
+
// Include the auto-generated part of this file. We split this because it means
// we can easily edit the non-auto generated parts right here in this file
// instead of having to edit some template or the code generator.