Chromium Code Reviews| 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 7f6dadb6b7099ce7ce9bc6053fab7f6f246b75a9..02217a6400186a5a334f4ebbe24bd08c568e5eb2 100644 |
| --- a/gpu/command_buffer/service/texture_manager.cc |
| +++ b/gpu/command_buffer/service/texture_manager.cc |
| @@ -1204,5 +1204,54 @@ 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); |
|
greggman
2012/12/14 06:08:06
If this is going to be called often (like from DoC
epenner
2012/12/14 21:01:34
It doesn't need to happen in DoCommand IMO. Only o
|
| + 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(); |
| + it++) { |
|
greggman
2012/12/14 06:08:06
always pre-increment stl iterators no?
++it me
epenner
2012/12/14 21:01:34
Done.
|
| + // 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/14 06:08:06
I don't think you can call erase in stl like this
epenner
2012/12/14 21:01:34
Sorry, last minute change from remove_if(). Done.
|
| + continue; |
| + } |
| + // If the transfer is finished, bind it to the texture, |
| + // and update the TextureInfo. |
| + if (!it->first->TransferIsInProgress()) { |
| + // Set the dirty status. |
| + *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/14 06:08:06
Same as above. Besides this would skip the element
epenner
2012/12/14 21:01:34
See above. Done.
|
| + continue; |
| + } |
| + } |
| +} |
| + |
| } // namespace gles2 |
| } // namespace gpu |