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

Side by Side Diff: gpu/command_buffer/service/texture_manager.cc

Issue 12040049: gpu: Implement idle async pixel transfers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review feedback and make BindFinishedAsyncPixelTransfers() handle out of order async upload… Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/texture_manager.h" 5 #include "gpu/command_buffer/service/texture_manager.h"
6 #include "base/bits.h" 6 #include "base/bits.h"
7 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 8 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
9 #include "gpu/command_buffer/service/feature_info.h" 9 #include "gpu/command_buffer/service/feature_info.h"
10 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 10 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 1209
1210 void TextureManager::BindFinishedAsyncPixelTransfers( 1210 void TextureManager::BindFinishedAsyncPixelTransfers(
1211 bool* texture_dirty, bool* framebuffer_dirty) { 1211 bool* texture_dirty, bool* framebuffer_dirty) {
1212 DCHECK(texture_dirty); 1212 DCHECK(texture_dirty);
1213 DCHECK(framebuffer_dirty); 1213 DCHECK(framebuffer_dirty);
1214 *texture_dirty = false; 1214 *texture_dirty = false;
1215 *framebuffer_dirty = false; 1215 *framebuffer_dirty = false;
1216 1216
1217 // Remove finished transfers from the list, while 1217 // Remove finished transfers from the list, while
1218 // marking whether texture unit 0 or frame_buffer status is dirty. 1218 // marking whether texture unit 0 or frame_buffer status is dirty.
1219 while(!pending_async_transfers_.empty()) { 1219 PendingAsyncTransferList::iterator iter = pending_async_transfers_.begin();
1220 PendingAsyncTransfer state_info = pending_async_transfers_.front(); 1220 while (iter != pending_async_transfers_.end()) {
epenner 2013/03/08 21:44:57 I think this makes this more expensive right? Is i
reveman 2013/03/12 00:31:42 yes, but I'm pretty sure the number of pending upl
1221 PendingAsyncTransfer state_info = *iter;
1221 if (!state_info.first.get()) { 1222 if (!state_info.first.get()) {
1222 // The AsyncState is owned by the Texture. So if the 1223 // The AsyncState is owned by the Texture. So if the
1223 // async state is deleted, so is the Texture. 1224 // async state is deleted, so is the Texture.
1224 pending_async_transfers_.pop_front(); 1225 pending_async_transfers_.erase(iter++);
greggman 2013/03/08 21:06:21 this is not the correct way to erase in the stl is
reveman 2013/03/12 00:31:42 changed to that. seem to be a mix in chromium but
1225 continue; 1226 continue;
1226 } 1227 }
1227 // Terminate early, as all transfers finish in order. 1228 if (state_info.first->TransferIsInProgress()) {
1228 if (state_info.first->TransferIsInProgress()) 1229 iter++;
greggman 2013/03/08 21:06:21 this should be ++iter no?
reveman 2013/03/12 00:31:42 Done. I guess that's a bit more efficient.
1229 break; 1230 continue;
1231 }
1230 // If the transfer is finished, bind it to the texture, 1232 // If the transfer is finished, bind it to the texture,
1231 // update the Texture, and remove it from pending list. 1233 // update the Texture, and remove it from pending list.
1232 *texture_dirty = true; 1234 *texture_dirty = true;
1233 *framebuffer_dirty |= state_info.second->IsAttachedToFramebuffer(); 1235 *framebuffer_dirty |= state_info.second->IsAttachedToFramebuffer();
1234 gfx::AsyncTexImage2DParams tex_define_params; 1236 gfx::AsyncTexImage2DParams tex_define_params;
1235 state_info.second-> 1237 state_info.second->
1236 GetAsyncTransferState()->BindTransfer(&tex_define_params); 1238 GetAsyncTransferState()->BindTransfer(&tex_define_params);
1237 SetLevelInfo( 1239 SetLevelInfo(
1238 state_info.second, 1240 state_info.second,
1239 tex_define_params.target, 1241 tex_define_params.target,
1240 tex_define_params.level, 1242 tex_define_params.level,
1241 tex_define_params.internal_format, 1243 tex_define_params.internal_format,
1242 tex_define_params.width, 1244 tex_define_params.width,
1243 tex_define_params.height, 1245 tex_define_params.height,
1244 1, // depth 1246 1, // depth
1245 tex_define_params.border, 1247 tex_define_params.border,
1246 tex_define_params.format, 1248 tex_define_params.format,
1247 tex_define_params.type, 1249 tex_define_params.type,
1248 true); // cleared 1250 true); // cleared
1249 pending_async_transfers_.pop_front(); 1251 pending_async_transfers_.erase(iter++);
greggman 2013/03/08 21:06:21 same as above
reveman 2013/03/12 00:31:42 Done.
1250 } 1252 }
1251 } 1253 }
1252 1254
1253 } // namespace gles2 1255 } // namespace gles2
1254 } // namespace gpu 1256 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698