| 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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 // |aggressively_free_resources_| is true. | 427 // |aggressively_free_resources_| is true. |
| 428 Flush(); | 428 Flush(); |
| 429 } else { | 429 } else { |
| 430 ShallowFlushCHROMIUM(); | 430 ShallowFlushCHROMIUM(); |
| 431 } | 431 } |
| 432 } | 432 } |
| 433 | 433 |
| 434 bool GLES2Implementation::OnMemoryDump( | 434 bool GLES2Implementation::OnMemoryDump( |
| 435 const base::trace_event::MemoryDumpArgs& args, | 435 const base::trace_event::MemoryDumpArgs& args, |
| 436 base::trace_event::ProcessMemoryDump* pmd) { | 436 base::trace_event::ProcessMemoryDump* pmd) { |
| 437 using base::trace_event::MemoryAllocatorDump; | |
| 438 using base::trace_event::MemoryDumpLevelOfDetail; | |
| 439 | |
| 440 if (!transfer_buffer_->HaveBuffer()) | 437 if (!transfer_buffer_->HaveBuffer()) |
| 441 return true; | 438 return true; |
| 442 | 439 |
| 443 const uint64_t tracing_process_id = | 440 const uint64_t tracing_process_id = |
| 444 base::trace_event::MemoryDumpManager::GetInstance() | 441 base::trace_event::MemoryDumpManager::GetInstance() |
| 445 ->GetTracingProcessId(); | 442 ->GetTracingProcessId(); |
| 446 | 443 |
| 447 MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(base::StringPrintf( | 444 base::trace_event::MemoryAllocatorDump* dump = pmd->CreateAllocatorDump( |
| 448 "gpu/transfer_buffer_memory/buffer_%d", transfer_buffer_->GetShmId())); | 445 base::StringPrintf("gpu/transfer_buffer_memory/buffer_%d", |
| 449 dump->AddScalar(MemoryAllocatorDump::kNameSize, | 446 transfer_buffer_->GetShmId())); |
| 450 MemoryAllocatorDump::kUnitsBytes, | 447 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
| 448 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
| 451 transfer_buffer_->GetSize()); | 449 transfer_buffer_->GetSize()); |
| 452 | 450 dump->AddScalar("free_size", |
| 453 if (args.level_of_detail != MemoryDumpLevelOfDetail::BACKGROUND) { | 451 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
| 454 dump->AddScalar("free_size", MemoryAllocatorDump::kUnitsBytes, | 452 transfer_buffer_->GetFreeSize()); |
| 455 transfer_buffer_->GetFreeSize()); | 453 auto guid = |
| 456 auto guid = GetBufferGUIDForTracing(tracing_process_id, | 454 GetBufferGUIDForTracing(tracing_process_id, transfer_buffer_->GetShmId()); |
| 457 transfer_buffer_->GetShmId()); | 455 const int kImportance = 2; |
| 458 const int kImportance = 2; | 456 pmd->CreateSharedGlobalAllocatorDump(guid); |
| 459 pmd->CreateSharedGlobalAllocatorDump(guid); | 457 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
| 460 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | |
| 461 } | |
| 462 | 458 |
| 463 return true; | 459 return true; |
| 464 } | 460 } |
| 465 | 461 |
| 466 void GLES2Implementation::WaitForCmd() { | 462 void GLES2Implementation::WaitForCmd() { |
| 467 TRACE_EVENT0("gpu", "GLES2::WaitForCmd"); | 463 TRACE_EVENT0("gpu", "GLES2::WaitForCmd"); |
| 468 helper_->CommandBufferHelper::Finish(); | 464 helper_->CommandBufferHelper::Finish(); |
| 469 } | 465 } |
| 470 | 466 |
| 471 bool GLES2Implementation::IsExtensionAvailable(const char* ext) { | 467 bool GLES2Implementation::IsExtensionAvailable(const char* ext) { |
| (...skipping 6485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6957 cached_extensions_.clear(); | 6953 cached_extensions_.clear(); |
| 6958 } | 6954 } |
| 6959 | 6955 |
| 6960 // Include the auto-generated part of this file. We split this because it means | 6956 // Include the auto-generated part of this file. We split this because it means |
| 6961 // we can easily edit the non-auto generated parts right here in this file | 6957 // we can easily edit the non-auto generated parts right here in this file |
| 6962 // instead of having to edit some template or the code generator. | 6958 // instead of having to edit some template or the code generator. |
| 6963 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 6959 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
| 6964 | 6960 |
| 6965 } // namespace gles2 | 6961 } // namespace gles2 |
| 6966 } // namespace gpu | 6962 } // namespace gpu |
| OLD | NEW |