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 #ifndef GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <stack> | 9 #include <stack> |
10 #include <string> | 10 #include <string> |
11 #include "base/memory/linked_ptr.h" | 11 #include "base/memory/linked_ptr.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "gpu/command_buffer/common/buffer.h" |
13 #include "gpu/command_buffer/service/cmd_parser.h" | 14 #include "gpu/command_buffer/service/cmd_parser.h" |
14 #include "gpu/gpu_export.h" | 15 #include "gpu/gpu_export.h" |
15 | 16 |
16 namespace gpu { | 17 namespace gpu { |
17 | 18 |
18 class CommandBufferEngine; | 19 class CommandBufferEngine; |
19 | 20 |
20 // This class is a helper base class for implementing the common parts of the | 21 // This class is a helper base class for implementing the common parts of the |
21 // o3d/gl2 command buffer decoder. | 22 // o3d/gl2 command buffer decoder. |
22 class GPU_EXPORT CommonDecoder : NON_EXPORTED_BASE(public AsyncAPIInterface) { | 23 class GPU_EXPORT CommonDecoder : NON_EXPORTED_BASE(public AsyncAPIInterface) { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 unsigned int offset, | 123 unsigned int offset, |
123 unsigned int size); | 124 unsigned int size); |
124 | 125 |
125 // Typed version of GetAddressAndCheckSize. | 126 // Typed version of GetAddressAndCheckSize. |
126 template <typename T> | 127 template <typename T> |
127 T GetSharedMemoryAs(unsigned int shm_id, unsigned int offset, | 128 T GetSharedMemoryAs(unsigned int shm_id, unsigned int offset, |
128 unsigned int size) { | 129 unsigned int size) { |
129 return static_cast<T>(GetAddressAndCheckSize(shm_id, offset, size)); | 130 return static_cast<T>(GetAddressAndCheckSize(shm_id, offset, size)); |
130 } | 131 } |
131 | 132 |
| 133 // Get the actual shared memory buffer. |
| 134 Buffer GetSharedMemoryBuffer(unsigned int shm_id); |
| 135 |
132 protected: | 136 protected: |
133 // Executes a common command. | 137 // Executes a common command. |
134 // Parameters: | 138 // Parameters: |
135 // command: the command index. | 139 // command: the command index. |
136 // arg_count: the number of CommandBufferEntry arguments. | 140 // arg_count: the number of CommandBufferEntry arguments. |
137 // cmd_data: the command data. | 141 // cmd_data: the command data. |
138 // Returns: | 142 // Returns: |
139 // error::kNoError if no error was found, one of | 143 // error::kNoError if no error was found, one of |
140 // error::Error otherwise. | 144 // error::Error otherwise. |
141 error::Error DoCommonCommand( | 145 error::Error DoCommonCommand( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 178 |
175 uint32 offset; | 179 uint32 offset; |
176 }; | 180 }; |
177 std::stack<CommandAddress> call_stack_; | 181 std::stack<CommandAddress> call_stack_; |
178 }; | 182 }; |
179 | 183 |
180 } // namespace gpu | 184 } // namespace gpu |
181 | 185 |
182 #endif // GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_ | 186 #endif // GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_ |
183 | 187 |
OLD | NEW |