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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 uint32_t size = (height - 1) * pixels_padded_row_size + unpadded_row_size; | 70 uint32_t size = (height - 1) * pixels_padded_row_size + unpadded_row_size; |
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 |
| 80 static base::StaticAtomicSequenceNumber g_flush_id; |
| 81 |
79 uint32_t GenerateNextFlushId() { | 82 uint32_t GenerateNextFlushId() { |
80 static base::subtle::Atomic32 flush_id = 0; | 83 return static_cast<uint32_t>(g_flush_id.GetNext()); |
81 base::subtle::Atomic32 my_id = | |
82 base::subtle::Barrier_AtomicIncrement(&flush_id, 1); | |
83 return static_cast<uint32_t>(my_id); | |
84 } | 84 } |
85 | 85 |
86 } // anonymous namespace | 86 } // anonymous namespace |
87 | 87 |
88 #if !defined(_MSC_VER) | 88 #if !defined(_MSC_VER) |
89 const size_t GLES2Implementation::kMaxSizeOfSimpleResult; | 89 const size_t GLES2Implementation::kMaxSizeOfSimpleResult; |
90 const unsigned int GLES2Implementation::kStartingOffset; | 90 const unsigned int GLES2Implementation::kStartingOffset; |
91 #endif | 91 #endif |
92 | 92 |
93 GLES2Implementation::GLStaticState::GLStaticState() { | 93 GLES2Implementation::GLStaticState::GLStaticState() { |
(...skipping 6729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6823 cached_extensions_.clear(); | 6823 cached_extensions_.clear(); |
6824 } | 6824 } |
6825 | 6825 |
6826 // Include the auto-generated part of this file. We split this because it means | 6826 // 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 | 6827 // 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. | 6828 // instead of having to edit some template or the code generator. |
6829 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 6829 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
6830 | 6830 |
6831 } // namespace gles2 | 6831 } // namespace gles2 |
6832 } // namespace gpu | 6832 } // namespace gpu |
OLD | NEW |