Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(550)

Side by Side Diff: gpu/command_buffer/service/common_decoder.h

Issue 855033002: command_buffer: Table based command dispatch for Common commands (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | gpu/command_buffer/service/common_decoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/common_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698