Chromium Code Reviews| 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/compiler_specific.h" | 21 #include "base/compiler_specific.h" |
| 21 #include "base/strings/string_split.h" | 22 #include "base/strings/string_split.h" |
| 22 #include "base/strings/stringprintf.h" | 23 #include "base/strings/stringprintf.h" |
| 23 #include "base/sys_info.h" | 24 #include "base/sys_info.h" |
| 24 #include "base/thread_task_runner_handle.h" | 25 #include "base/thread_task_runner_handle.h" |
| 25 #include "base/trace_event/memory_allocator_dump.h" | 26 #include "base/trace_event/memory_allocator_dump.h" |
| 26 #include "base/trace_event/memory_dump_manager.h" | 27 #include "base/trace_event/memory_dump_manager.h" |
| 27 #include "base/trace_event/process_memory_dump.h" | 28 #include "base/trace_event/process_memory_dump.h" |
| 28 #include "base/trace_event/trace_event.h" | 29 #include "base/trace_event/trace_event.h" |
| 29 #include "gpu/command_buffer/client/buffer_tracker.h" | 30 #include "gpu/command_buffer/client/buffer_tracker.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 memcpy(dest, source, size); | 71 memcpy(dest, source, size); |
| 71 } | 72 } |
| 72 } | 73 } |
| 73 | 74 |
| 74 // A 32-bit and 64-bit compatible way of converting a pointer to a GLuint. | 75 // A 32-bit and 64-bit compatible way of converting a pointer to a GLuint. |
| 75 GLuint ToGLuint(const void* ptr) { | 76 GLuint ToGLuint(const void* ptr) { |
| 76 return static_cast<GLuint>(reinterpret_cast<size_t>(ptr)); | 77 return static_cast<GLuint>(reinterpret_cast<size_t>(ptr)); |
| 77 } | 78 } |
| 78 | 79 |
| 79 uint32_t GenerateNextFlushId() { | 80 uint32_t GenerateNextFlushId() { |
| 80 static base::subtle::Atomic32 flush_id = 0; | 81 static base::AtomicSequenceNumber flush_id; |
|
piman
2016/03/16 23:49:29
I was thinking, move this out of the function and
danakj
2016/03/16 23:50:41
Oh, snap. Sure :)
| |
| 81 base::subtle::Atomic32 my_id = | 82 return static_cast<uint32_t>(flush_id.GetNext()); |
| 82 base::subtle::Barrier_AtomicIncrement(&flush_id, 1); | |
| 83 return static_cast<uint32_t>(my_id); | |
| 84 } | 83 } |
| 85 | 84 |
| 86 } // anonymous namespace | 85 } // anonymous namespace |
| 87 | 86 |
| 88 #if !defined(_MSC_VER) | 87 #if !defined(_MSC_VER) |
| 89 const size_t GLES2Implementation::kMaxSizeOfSimpleResult; | 88 const size_t GLES2Implementation::kMaxSizeOfSimpleResult; |
| 90 const unsigned int GLES2Implementation::kStartingOffset; | 89 const unsigned int GLES2Implementation::kStartingOffset; |
| 91 #endif | 90 #endif |
| 92 | 91 |
| 93 GLES2Implementation::GLStaticState::GLStaticState() { | 92 GLES2Implementation::GLStaticState::GLStaticState() { |
| (...skipping 6729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6823 cached_extensions_.clear(); | 6822 cached_extensions_.clear(); |
| 6824 } | 6823 } |
| 6825 | 6824 |
| 6826 // Include the auto-generated part of this file. We split this because it means | 6825 // Include the auto-generated part of this file. We split this because it means |
| 6827 // we can easily edit the non-auto generated parts right here in this file | 6826 // we can easily edit the non-auto generated parts right here in this file |
| 6828 // instead of having to edit some template or the code generator. | 6827 // instead of having to edit some template or the code generator. |
| 6829 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 6828 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
| 6830 | 6829 |
| 6831 } // namespace gles2 | 6830 } // namespace gles2 |
| 6832 } // namespace gpu | 6831 } // namespace gpu |
| OLD | NEW |