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

Side by Side 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: Address Feedback. 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 unified diff | Download patch
« no previous file with comments | « gpu/command_buffer/service/texture_manager.h ('k') | gpu/gpu.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 } 1203 }
1204 1204
1205 void TextureManager::AddToSignature( 1205 void TextureManager::AddToSignature(
1206 TextureInfo* info, 1206 TextureInfo* info,
1207 GLenum target, 1207 GLenum target,
1208 GLint level, 1208 GLint level,
1209 std::string* signature) const { 1209 std::string* signature) const {
1210 info->AddToSignature(feature_info_.get(), target, level, signature); 1210 info->AddToSignature(feature_info_.get(), target, level, signature);
1211 } 1211 }
1212 1212
1213 void TextureManager::AddPendingAsyncPixelTransfer(
1214 base::WeakPtr<gfx::AsyncPixelTransferState> state, TextureInfo* info) {
1215 pending_async_transfers_.push_back(PendingAsyncTransfer(state,info));
1216 }
1217
1218 void TextureManager::BindFinishedAsyncPixelTransfers(
1219 bool* texture_dirty, bool* framebuffer_dirty) {
1220 DCHECK(texture_dirty);
1221 DCHECK(framebuffer_dirty);
1222 *texture_dirty = false;
1223 *framebuffer_dirty = false;
1224
1225 // Remove finished transfers from the list, while
1226 // marking whether texture unit 0 or frame_buffer status is dirty.
1227 while(!pending_async_transfers_.empty()) {
1228 PendingAsyncTransfer state_info = pending_async_transfers_.front();
1229 if (!state_info.first.get()) {
1230 // The AsyncState is owned by the TextureInfo. So if the
1231 // async state is deleted, so is the TextureInfo.
1232 pending_async_transfers_.pop_front();
1233 continue;
1234 }
1235 // Terminate early, as all transfers finish in order.
1236 if (state_info.first->TransferIsInProgress())
1237 break;
1238 // If the transfer is finished, bind it to the texture,
1239 // update the TextureInfo, and remove it from pending list.
1240 *texture_dirty = true;
1241 *framebuffer_dirty |= state_info.second->IsAttachedToFramebuffer();
1242 gfx::AsyncTexImage2DParams tex_define_params;
1243 state_info.second->
1244 GetAsyncTransferState()->BindTransfer(&tex_define_params);
1245 SetLevelInfo(
1246 state_info.second,
1247 tex_define_params.target,
1248 tex_define_params.level,
1249 tex_define_params.internal_format,
1250 tex_define_params.width,
1251 tex_define_params.height,
1252 1, // depth
1253 tex_define_params.border,
1254 tex_define_params.format,
1255 tex_define_params.type,
1256 true); // cleared
1257 pending_async_transfers_.pop_front();
1258 }
1259 }
1260
1213 } // namespace gles2 1261 } // namespace gles2
1214 } // namespace gpu 1262 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/texture_manager.h ('k') | gpu/gpu.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698