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

Unified Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 1168853002: Use mapped memory for uploading large textures. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months 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: gpu/command_buffer/client/gles2_implementation.cc
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index e85929912f6af462e57c7e0ddbda2ee017f606fc..27779c958d51d34812da718c167e81bf3a24dcb6 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -2203,6 +2203,22 @@ void GLES2Implementation::TexImage2D(
return;
}
+ // Check if we can allocate shared memory to send it.
+ int32 mapped_shm_id = 0;
+ unsigned int mapped_shm_offset = 0;
+ void* mem = mapped_memory_->Alloc(size, &mapped_shm_id, &mapped_shm_offset);
+ if (mem) {
+ CopyRectToBuffer(
+ pixels, height, unpadded_row_size, src_padded_row_size, unpack_flip_y_,
+ mem, padded_row_size);
+ helper_->TexImage2D(
+ target, level, internalformat, width, height, format, type,
+ mapped_shm_id, mapped_shm_offset);
+ CheckGLError();
+ mapped_memory_->FreePendingToken(mem, helper_->InsertToken());
piman 2015/06/08 21:12:35 Can you force a shallow flush here? Without it, th
David Yen 2015/06/08 21:34:06 Done. Although in order to do this in my new versi
+ return;
+ }
+
// No, so send it using TexSubImage2D.
helper_->TexImage2D(
target, level, internalformat, width, height, format, type,
« 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