| 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 // A class to emulate GLES2 over command buffers. | 5 // A class to emulate GLES2 over command buffers. |
| 6 | 6 |
| 7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 8 | 8 |
| 9 #include <GLES2/gl2.h> | 9 #include <GLES2/gl2.h> |
| 10 #include <GLES2/gl2ext.h> | 10 #include <GLES2/gl2ext.h> |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 ShallowFlushCHROMIUM(); | 324 ShallowFlushCHROMIUM(); |
| 325 gpu_control_->SetSurfaceVisible(visible); | 325 gpu_control_->SetSurfaceVisible(visible); |
| 326 } | 326 } |
| 327 | 327 |
| 328 void GLES2Implementation::SetAggressivelyFreeResources( | 328 void GLES2Implementation::SetAggressivelyFreeResources( |
| 329 bool aggressively_free_resources) { | 329 bool aggressively_free_resources) { |
| 330 TRACE_EVENT1("gpu", "GLES2Implementation::SetAggressivelyFreeResources", | 330 TRACE_EVENT1("gpu", "GLES2Implementation::SetAggressivelyFreeResources", |
| 331 "aggressively_free_resources", aggressively_free_resources); | 331 "aggressively_free_resources", aggressively_free_resources); |
| 332 aggressively_free_resources_ = aggressively_free_resources; | 332 aggressively_free_resources_ = aggressively_free_resources; |
| 333 | 333 |
| 334 // ShallowFlushCHROMIUM will free resources if |aggressively_free_resources_| | 334 if (aggressively_free_resources_ && helper_->HaveRingBuffer()) { |
| 335 // is false. | 335 // Ensure that we clean up as much cache memory as possible and fully flush. |
| 336 ShallowFlushCHROMIUM(); | 336 FlushDriverCachesCHROMIUM(); |
| 337 |
| 338 // Flush will delete transfer buffer resources if |
| 339 // |aggressively_free_resources_| is true. |
| 340 Flush(); |
| 341 } else { |
| 342 ShallowFlushCHROMIUM(); |
| 343 } |
| 337 } | 344 } |
| 338 | 345 |
| 339 void GLES2Implementation::WaitForCmd() { | 346 void GLES2Implementation::WaitForCmd() { |
| 340 TRACE_EVENT0("gpu", "GLES2::WaitForCmd"); | 347 TRACE_EVENT0("gpu", "GLES2::WaitForCmd"); |
| 341 helper_->CommandBufferHelper::Finish(); | 348 helper_->CommandBufferHelper::Finish(); |
| 342 } | 349 } |
| 343 | 350 |
| 344 bool GLES2Implementation::IsExtensionAvailable(const char* ext) { | 351 bool GLES2Implementation::IsExtensionAvailable(const char* ext) { |
| 345 const char* extensions = | 352 const char* extensions = |
| 346 reinterpret_cast<const char*>(GetStringHelper(GL_EXTENSIONS)); | 353 reinterpret_cast<const char*>(GetStringHelper(GL_EXTENSIONS)); |
| (...skipping 5640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5987 CheckGLError(); | 5994 CheckGLError(); |
| 5988 } | 5995 } |
| 5989 | 5996 |
| 5990 // Include the auto-generated part of this file. We split this because it means | 5997 // Include the auto-generated part of this file. We split this because it means |
| 5991 // we can easily edit the non-auto generated parts right here in this file | 5998 // we can easily edit the non-auto generated parts right here in this file |
| 5992 // instead of having to edit some template or the code generator. | 5999 // instead of having to edit some template or the code generator. |
| 5993 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 6000 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
| 5994 | 6001 |
| 5995 } // namespace gles2 | 6002 } // namespace gles2 |
| 5996 } // namespace gpu | 6003 } // namespace gpu |
| OLD | NEW |