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

Side by Side Diff: command_buffer/service/cross/cmd_parser.h

Issue 329046: Splits the command buffers into common commands... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: '' Created 11 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2009, Google Inc. 2 * Copyright 2009, Google Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // Checks whether there are commands to process. 70 // Checks whether there are commands to process.
71 bool IsEmpty() const { return put_ == get_; } 71 bool IsEmpty() const { return put_ == get_; }
72 72
73 // Processes one command, updating the get pointer. This will return an error 73 // Processes one command, updating the get pointer. This will return an error
74 // if there are no commands in the buffer. 74 // if there are no commands in the buffer.
75 parse_error::ParseError ProcessCommand(); 75 parse_error::ParseError ProcessCommand();
76 76
77 // Processes all commands until get == put. 77 // Processes all commands until get == put.
78 parse_error::ParseError ProcessAllCommands(); 78 parse_error::ParseError ProcessAllCommands();
79 79
80 // Reports an error.
81 void ReportError(unsigned int command_id, parse_error::ParseError result);
82
80 private: 83 private:
81 CommandBufferOffset get_; 84 CommandBufferOffset get_;
82 CommandBufferOffset put_; 85 CommandBufferOffset put_;
83 CommandBufferEntry *buffer_; 86 CommandBufferEntry *buffer_;
84 size_t entry_count_; 87 size_t entry_count_;
85 AsyncAPIInterface *handler_; 88 AsyncAPIInterface *handler_;
86 }; 89 };
87 90
88 // This class defines the interface for an asynchronous API handler, that 91 // This class defines the interface for an asynchronous API handler, that
89 // is responsible for de-multiplexing commands and their arguments. 92 // is responsible for de-multiplexing commands and their arguments.
90 class AsyncAPIInterface { 93 class AsyncAPIInterface {
91 public: 94 public:
92 AsyncAPIInterface() {} 95 AsyncAPIInterface() {}
93 virtual ~AsyncAPIInterface() {} 96 virtual ~AsyncAPIInterface() {}
94 97
95 // Executes a command. 98 // Executes a command.
96 // Parameters: 99 // Parameters:
97 // command: the command index. 100 // command: the command index.
98 // arg_count: the number of CommandBufferEntry arguments. 101 // arg_count: the number of CommandBufferEntry arguments.
99 // cmd_data: the command data. 102 // cmd_data: the command data.
100 // Returns: 103 // Returns:
101 // parse_error::NO_ERROR if no error was found, one of 104 // parse_error::NO_ERROR if no error was found, one of
102 // parse_error::ParseError otherwise. 105 // parse_error::ParseError otherwise.
103 virtual parse_error::ParseError DoCommand( 106 virtual parse_error::ParseError DoCommand(
104 unsigned int command, 107 unsigned int command,
105 unsigned int arg_count, 108 unsigned int arg_count,
106 const void* cmd_data) = 0; 109 const void* cmd_data) = 0;
110
111 // Returns a name for a command. Useful for logging / debuging.
112 virtual const char* GetCommandName(unsigned int command_id) const = 0;
107 }; 113 };
108 114
109 } // namespace command_buffer 115 } // namespace command_buffer
110 } // namespace o3d 116 } // namespace o3d
111 117
112 #endif // O3D_COMMAND_BUFFER_SERVICE_CROSS_CMD_PARSER_H_ 118 #endif // O3D_COMMAND_BUFFER_SERVICE_CROSS_CMD_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698