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

Unified Diff: gpu/command_buffer/service/texture_manager.cc

Issue 11428140: gpu: Add async pixel transfer interface, stub and tests. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Move BindFinishedTransfers to MakeCurrent. Rebase again. Created 8 years 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
Index: gpu/command_buffer/service/texture_manager.cc
diff --git a/gpu/command_buffer/service/texture_manager.cc b/gpu/command_buffer/service/texture_manager.cc
index 6dc4b84a9cee0e5e004e6ca07578037856fcc744..53ffe9fb7cb26807c6daac2394819a19a7ee1550 100644
--- a/gpu/command_buffer/service/texture_manager.cc
+++ b/gpu/command_buffer/service/texture_manager.cc
@@ -1210,5 +1210,52 @@ void TextureManager::AddToSignature(
info->AddToSignature(feature_info_.get(), target, level, signature);
}
+void TextureManager::AddPendingAsyncPixelTransfer(
+ base::WeakPtr<gfx::AsyncPixelTransferState> state, TextureInfo* info) {
+ pending_async_transfers_.push_back(PendingAsyncTransfer(state,info));
+}
+
+void TextureManager::BindFinishedAsyncPixelTransfers(
+ bool* texture_dirty, bool* framebuffer_dirty) {
+ DCHECK(texture_dirty);
+ DCHECK(framebuffer_dirty);
+ *texture_dirty = false;
+ *framebuffer_dirty = false;
+
+ // Remove finished transfers from the list, while
+ // marking whether the texture unit or frame_buffer is dirty.
+ for (PendingAsyncTransferList::iterator it = pending_async_transfers_.begin();
+ it != pending_async_transfers_.end(); ) {
+ // The AsyncState is owned by the TextureInfo. So if the
+ // async state is deleted, so is the TextureInfo.
+ if (!it->first.get()) {
+ pending_async_transfers_.erase(it++);
greggman 2012/12/15 06:45:04 I still believe this needs to be it = pending_
epenner 2012/12/17 06:29:18 I realized I could use front()/pop_front() in this
+ continue;
+ }
+ // Terminate early, as transfers finish in order.
+ if (it->first->TransferIsInProgress())
+ break;
+ // If the transfer is finished, bind it to the texture,
+ // and update the TextureInfo.
+ *texture_dirty = true;
+ *framebuffer_dirty |= it->second->IsAttachedToFramebuffer();
+ gfx::AsyncTexImage2DParams tex_define_params;
+ it->second->GetAsyncTransferState()->BindTransfer(&tex_define_params);
+ SetLevelInfo(
+ it->second,
+ tex_define_params.target,
+ tex_define_params.level,
+ tex_define_params.internal_format,
+ tex_define_params.width,
+ tex_define_params.height,
+ 1, // depth
+ tex_define_params.border,
+ tex_define_params.format,
+ tex_define_params.type,
+ true); // cleared
+ pending_async_transfers_.erase(it++);
greggman 2012/12/15 06:45:04 I still believe this needs to be it = pending_
epenner 2012/12/17 06:29:18 Ditto
+ }
+}
+
} // namespace gles2
} // namespace gpu

Powered by Google App Engine
This is Rietveld 408576698