| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_definition.h" | 5 #include "gpu/command_buffer/service/texture_definition.h" |
| 6 | 6 |
| 7 #include "gpu/command_buffer/service/texture_manager.h" | 7 #include "gpu/command_buffer/service/texture_manager.h" |
| 8 #include "ui/gl/gl_image.h" | 8 #include "ui/gl/gl_image.h" |
| 9 #include "ui/gl/gl_implementation.h" | 9 #include "ui/gl/gl_implementation.h" |
| 10 #include "ui/gl/scoped_binders.h" | 10 #include "ui/gl/scoped_binders.h" |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 if (it->client == client) { | 271 if (it->client == client) { |
| 272 it->read_fence = make_linked_ptr(gfx::GLFence::Create()); | 272 it->read_fence = make_linked_ptr(gfx::GLFence::Create()); |
| 273 return; | 273 return; |
| 274 } | 274 } |
| 275 } | 275 } |
| 276 NOTREACHED(); | 276 NOTREACHED(); |
| 277 } | 277 } |
| 278 | 278 |
| 279 void NativeImageBuffer::DidWrite(gfx::GLImage* client) { | 279 void NativeImageBuffer::DidWrite(gfx::GLImage* client) { |
| 280 base::AutoLock lock(lock_); | 280 base::AutoLock lock(lock_); |
| 281 // TODO(sievers): crbug.com/352419 | 281 // Sharing semantics require the client to flush in order to make changes |
| 282 // This is super-risky. We need to somehow find out about when the current | 282 // visible to other clients. |
| 283 // context gets flushed, so that we will only ever wait on the write fence | |
| 284 // (esp. from another context) if it was flushed and is guaranteed to clear. | |
| 285 // On the other hand, proactively flushing here is not feasible in terms | |
| 286 // of perf when there are multiple draw calls per frame. | |
| 287 write_fence_.reset(gfx::GLFence::CreateWithoutFlush()); | 283 write_fence_.reset(gfx::GLFence::CreateWithoutFlush()); |
| 288 write_client_ = client; | 284 write_client_ = client; |
| 289 for (std::list<ClientInfo>::iterator it = client_infos_.begin(); | 285 for (std::list<ClientInfo>::iterator it = client_infos_.begin(); |
| 290 it != client_infos_.end(); | 286 it != client_infos_.end(); |
| 291 it++) { | 287 it++) { |
| 292 it->needs_wait_before_read = true; | 288 it->needs_wait_before_read = true; |
| 293 } | 289 } |
| 294 } | 290 } |
| 295 | 291 |
| 296 TextureDefinition::LevelInfo::LevelInfo(GLenum target, | 292 TextureDefinition::LevelInfo::LevelInfo(GLenum target, |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 | 431 |
| 436 // All structural changes should have orphaned the texture. | 432 // All structural changes should have orphaned the texture. |
| 437 if (image_buffer_ && !texture->GetLevelImage(texture->target(), 0)) | 433 if (image_buffer_ && !texture->GetLevelImage(texture->target(), 0)) |
| 438 return false; | 434 return false; |
| 439 | 435 |
| 440 return true; | 436 return true; |
| 441 } | 437 } |
| 442 | 438 |
| 443 } // namespace gles2 | 439 } // namespace gles2 |
| 444 } // namespace gpu | 440 } // namespace gpu |
| OLD | NEW |