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> |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 unsigned int arg_count, | 148 unsigned int arg_count, |
149 const void* cmd_data); | 149 const void* cmd_data); |
150 | 150 |
151 // Gets an name for a common command. | 151 // Gets an name for a common command. |
152 const char* GetCommonCommandName(cmd::CommandId command_id) const; | 152 const char* GetCommonCommandName(cmd::CommandId command_id) const; |
153 | 153 |
154 private: | 154 private: |
155 // Generate a member function prototype for each command in an automated and | 155 // Generate a member function prototype for each command in an automated and |
156 // typesafe way. | 156 // typesafe way. |
157 #define COMMON_COMMAND_BUFFER_CMD_OP(name) \ | 157 #define COMMON_COMMAND_BUFFER_CMD_OP(name) \ |
158 error::Error Handle##name( \ | 158 error::Error Handle##name(uint32 immediate_data_size, const void* data); |
159 uint32 immediate_data_size, \ | |
160 const cmd::name& args); \ | |
161 | 159 |
162 COMMON_COMMAND_BUFFER_CMDS(COMMON_COMMAND_BUFFER_CMD_OP) | 160 COMMON_COMMAND_BUFFER_CMDS(COMMON_COMMAND_BUFFER_CMD_OP) |
163 | 161 |
164 #undef COMMON_COMMAND_BUFFER_CMD_OP | 162 #undef COMMON_COMMAND_BUFFER_CMD_OP |
165 | 163 |
166 CommandBufferEngine* engine_; | 164 CommandBufferEngine* engine_; |
167 | 165 |
168 typedef std::map<uint32, linked_ptr<Bucket> > BucketMap; | 166 typedef std::map<uint32, linked_ptr<Bucket> > BucketMap; |
169 BucketMap buckets_; | 167 BucketMap buckets_; |
| 168 |
| 169 typedef Error (CommonDecoder::*CmdHandler)( |
| 170 uint32 immediate_data_size, |
| 171 const void* data); |
| 172 |
| 173 // A struct to hold info about each command. |
| 174 struct CommandInfo { |
| 175 CmdHandler cmd_handler; |
| 176 uint8 arg_flags; // How to handle the arguments for this command |
| 177 uint8 cmd_flags; // How to handle this command |
| 178 uint16 arg_count; // How many arguments are expected for this command. |
| 179 }; |
| 180 |
| 181 // A table of CommandInfo for all the commands. |
| 182 static const CommandInfo command_info[]; |
| 183 |
170 }; | 184 }; |
171 | 185 |
172 } // namespace gpu | 186 } // namespace gpu |
173 | 187 |
174 #endif // GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_ | 188 #endif // GPU_COMMAND_BUFFER_SERVICE_COMMON_DECODER_H_ |
175 | 189 |
OLD | NEW |