OLD | NEW |
---|---|
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 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1197 } | 1197 } |
1198 | 1198 |
1199 void TextureManager::AddToSignature( | 1199 void TextureManager::AddToSignature( |
1200 TextureInfo* info, | 1200 TextureInfo* info, |
1201 GLenum target, | 1201 GLenum target, |
1202 GLint level, | 1202 GLint level, |
1203 std::string* signature) const { | 1203 std::string* signature) const { |
1204 info->AddToSignature(feature_info_.get(), target, level, signature); | 1204 info->AddToSignature(feature_info_.get(), target, level, signature); |
1205 } | 1205 } |
1206 | 1206 |
1207 void TextureManager::AddPendingAsyncPixelTransfer( | |
1208 base::WeakPtr<gfx::AsyncPixelTransferState> state, TextureInfo* info) { | |
1209 pending_async_transfers_.push_back(PendingAsyncTransfer(state,info)); | |
1210 } | |
1211 | |
1212 void TextureManager::BindFinishedAsyncPixelTransfers( | |
1213 bool* texture_dirty, bool* framebuffer_dirty) { | |
1214 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
| |
1215 DCHECK(framebuffer_dirty); | |
1216 *texture_dirty = false; | |
1217 *framebuffer_dirty = false; | |
1218 | |
1219 // Remove finished transfers from the list, while | |
1220 // marking whether the texture unit or frame_buffer is dirty. | |
1221 for (PendingAsyncTransferList::iterator it = pending_async_transfers_.begin(); | |
1222 it != pending_async_transfers_.end(); | |
1223 it++) { | |
greggman
2012/12/14 06:08:06
always pre-increment stl iterators no?
++it me
epenner
2012/12/14 21:01:34
Done.
| |
1224 // The AsyncState is owned by the TextureInfo. So if the | |
1225 // async state is deleted, so is the TextureInfo. | |
1226 if (!it->first.get()) { | |
1227 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.
| |
1228 continue; | |
1229 } | |
1230 // If the transfer is finished, bind it to the texture, | |
1231 // and update the TextureInfo. | |
1232 if (!it->first->TransferIsInProgress()) { | |
1233 // Set the dirty status. | |
1234 *texture_dirty = true; | |
1235 *framebuffer_dirty |= it->second->IsAttachedToFramebuffer(); | |
1236 gfx::AsyncTexImage2DParams tex_define_params; | |
1237 it->second->GetAsyncTransferState()->BindTransfer(&tex_define_params); | |
1238 SetLevelInfo( | |
1239 it->second, | |
1240 tex_define_params.target, | |
1241 tex_define_params.level, | |
1242 tex_define_params.internal_format, | |
1243 tex_define_params.width, | |
1244 tex_define_params.height, | |
1245 1, // depth | |
1246 tex_define_params.border, | |
1247 tex_define_params.format, | |
1248 tex_define_params.type, | |
1249 true); // cleared | |
1250 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.
| |
1251 continue; | |
1252 } | |
1253 } | |
1254 } | |
1255 | |
1207 } // namespace gles2 | 1256 } // namespace gles2 |
1208 } // namespace gpu | 1257 } // namespace gpu |
OLD | NEW |