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> |
11 #include <GLES2/gl2extchromium.h> | 11 #include <GLES2/gl2extchromium.h> |
12 #include <GLES3/gl3.h> | 12 #include <GLES3/gl3.h> |
13 #include <stddef.h> | 13 #include <stddef.h> |
14 #include <stdint.h> | 14 #include <stdint.h> |
15 #include <algorithm> | 15 #include <algorithm> |
16 #include <map> | 16 #include <map> |
17 #include <set> | 17 #include <set> |
18 #include <sstream> | 18 #include <sstream> |
19 #include <string> | 19 #include <string> |
20 #include "base/atomic_sequence_num.h" | 20 #include "base/atomic_sequence_num.h" |
21 #include "base/bits.h" | 21 #include "base/bits.h" |
22 #include "base/compiler_specific.h" | 22 #include "base/compiler_specific.h" |
23 #include "base/debug/activity_tracker.h" | |
23 #include "base/numerics/safe_math.h" | 24 #include "base/numerics/safe_math.h" |
24 #include "base/strings/string_split.h" | 25 #include "base/strings/string_split.h" |
25 #include "base/strings/stringprintf.h" | 26 #include "base/strings/stringprintf.h" |
26 #include "base/sys_info.h" | 27 #include "base/sys_info.h" |
27 #include "base/threading/thread_task_runner_handle.h" | 28 #include "base/threading/thread_task_runner_handle.h" |
28 #include "base/trace_event/memory_allocator_dump.h" | 29 #include "base/trace_event/memory_allocator_dump.h" |
29 #include "base/trace_event/memory_dump_manager.h" | 30 #include "base/trace_event/memory_dump_manager.h" |
30 #include "base/trace_event/process_memory_dump.h" | 31 #include "base/trace_event/process_memory_dump.h" |
31 #include "base/trace_event/trace_event.h" | 32 #include "base/trace_event/trace_event.h" |
32 #include "gpu/command_buffer/client/buffer_tracker.h" | 33 #include "gpu/command_buffer/client/buffer_tracker.h" |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
412 callback)); | 413 callback)); |
413 } | 414 } |
414 | 415 |
415 void GLES2Implementation::SetAggressivelyFreeResources( | 416 void GLES2Implementation::SetAggressivelyFreeResources( |
416 bool aggressively_free_resources) { | 417 bool aggressively_free_resources) { |
417 TRACE_EVENT1("gpu", "GLES2Implementation::SetAggressivelyFreeResources", | 418 TRACE_EVENT1("gpu", "GLES2Implementation::SetAggressivelyFreeResources", |
418 "aggressively_free_resources", aggressively_free_resources); | 419 "aggressively_free_resources", aggressively_free_resources); |
419 aggressively_free_resources_ = aggressively_free_resources; | 420 aggressively_free_resources_ = aggressively_free_resources; |
420 | 421 |
421 if (aggressively_free_resources_ && helper_->HaveRingBuffer()) { | 422 if (aggressively_free_resources_ && helper_->HaveRingBuffer()) { |
423 // TODO(manzagop): remove ScopedActivity once crbug.com/703342 is fixed. | |
424 base::debug::ScopedActivity activity_flush(0, 0, | |
bcwhite
2017/03/21 12:34:38
Do you want an ID for the second parameter to dist
manzagop (departed)
2017/03/21 14:00:23
Done. Here and below.
| |
425 aggressively_free_resources); | |
426 | |
422 // Ensure that we clean up as much cache memory as possible and fully flush. | 427 // Ensure that we clean up as much cache memory as possible and fully flush. |
423 FlushDriverCachesCHROMIUM(); | 428 FlushDriverCachesCHROMIUM(); |
424 | 429 |
425 // Flush will delete transfer buffer resources if | 430 // Flush will delete transfer buffer resources if |
426 // |aggressively_free_resources_| is true. | 431 // |aggressively_free_resources_| is true. |
427 Flush(); | 432 Flush(); |
428 } else { | 433 } else { |
434 // TODO(manzagop): remove ScopedActivity once crbug.com/703342 is fixed. | |
435 base::debug::ScopedActivity activity_shallow_flush( | |
436 0, 0, aggressively_free_resources); | |
429 ShallowFlushCHROMIUM(); | 437 ShallowFlushCHROMIUM(); |
430 } | 438 } |
431 } | 439 } |
432 | 440 |
433 bool GLES2Implementation::OnMemoryDump( | 441 bool GLES2Implementation::OnMemoryDump( |
434 const base::trace_event::MemoryDumpArgs& args, | 442 const base::trace_event::MemoryDumpArgs& args, |
435 base::trace_event::ProcessMemoryDump* pmd) { | 443 base::trace_event::ProcessMemoryDump* pmd) { |
436 using base::trace_event::MemoryAllocatorDump; | 444 using base::trace_event::MemoryAllocatorDump; |
437 using base::trace_event::MemoryDumpLevelOfDetail; | 445 using base::trace_event::MemoryDumpLevelOfDetail; |
438 | 446 |
(...skipping 6628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7067 CheckGLError(); | 7075 CheckGLError(); |
7068 } | 7076 } |
7069 | 7077 |
7070 // Include the auto-generated part of this file. We split this because it means | 7078 // Include the auto-generated part of this file. We split this because it means |
7071 // we can easily edit the non-auto generated parts right here in this file | 7079 // we can easily edit the non-auto generated parts right here in this file |
7072 // instead of having to edit some template or the code generator. | 7080 // instead of having to edit some template or the code generator. |
7073 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 7081 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
7074 | 7082 |
7075 } // namespace gles2 | 7083 } // namespace gles2 |
7076 } // namespace gpu | 7084 } // namespace gpu |
OLD | NEW |