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

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

Issue 555129: Add commands Jump, Call and Return... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 // This file contains the command parser class. 5 // This file contains the command parser class.
6 6
7 #ifndef GPU_COMMAND_BUFFER_SERVICE_CMD_PARSER_H_ 7 #ifndef GPU_COMMAND_BUFFER_SERVICE_CMD_PARSER_H_
8 #define GPU_COMMAND_BUFFER_SERVICE_CMD_PARSER_H_ 8 #define GPU_COMMAND_BUFFER_SERVICE_CMD_PARSER_H_
9 9
10 #include "gpu/command_buffer/common/constants.h" 10 #include "gpu/command_buffer/common/constants.h"
(...skipping 11 matching lines...) Expand all
22 size_t shm_size, 22 size_t shm_size,
23 ptrdiff_t offset, 23 ptrdiff_t offset,
24 size_t size, 24 size_t size,
25 CommandBufferOffset start_get, 25 CommandBufferOffset start_get,
26 AsyncAPIInterface *handler); 26 AsyncAPIInterface *handler);
27 27
28 // Gets the "get" pointer. The get pointer is an index into the command 28 // Gets the "get" pointer. The get pointer is an index into the command
29 // buffer considered as an array of CommandBufferEntry. 29 // buffer considered as an array of CommandBufferEntry.
30 CommandBufferOffset get() const { return get_; } 30 CommandBufferOffset get() const { return get_; }
31 31
32 // Sets the "get" pointer. The get pointer is an index into the command buffer
33 // considered as an array of CommandBufferEntry.
34 bool set_get(CommandBufferOffset get) {
35 if (get < entry_count_) {
36 get_ = get;
37 return true;
38 }
39 return false;
40 }
41
32 // Sets the "put" pointer. The put pointer is an index into the command 42 // Sets the "put" pointer. The put pointer is an index into the command
33 // buffer considered as an array of CommandBufferEntry. 43 // buffer considered as an array of CommandBufferEntry.
34 void set_put(CommandBufferOffset put) { put_ = put; } 44 void set_put(CommandBufferOffset put) { put_ = put; }
35 45
36 // Gets the "put" pointer. The put pointer is an index into the command 46 // Gets the "put" pointer. The put pointer is an index into the command
37 // buffer considered as an array of CommandBufferEntry. 47 // buffer considered as an array of CommandBufferEntry.
38 CommandBufferOffset put() const { return put_; } 48 CommandBufferOffset put() const { return put_; }
39 49
40 // Checks whether there are commands to process. 50 // Checks whether there are commands to process.
41 bool IsEmpty() const { return put_ == get_; } 51 bool IsEmpty() const { return put_ == get_; }
42 52
43 // Processes one command, updating the get pointer. This will return an error 53 // Processes one command, updating the get pointer. This will return an error
44 // if there are no commands in the buffer. 54 // if there are no commands in the buffer.
45 parse_error::ParseError ProcessCommand(); 55 parse_error::ParseError ProcessCommand();
46 56
47 // Processes all commands until get == put. 57 // Processes all commands until get == put.
48 parse_error::ParseError ProcessAllCommands(); 58 parse_error::ParseError ProcessAllCommands();
49 59
50 // Reports an error. 60 // Reports an error.
51 void ReportError(unsigned int command_id, parse_error::ParseError result); 61 void ReportError(unsigned int command_id, parse_error::ParseError result);
52 62
53 private: 63 private:
54 CommandBufferOffset get_; 64 CommandBufferOffset get_;
55 CommandBufferOffset put_; 65 CommandBufferOffset put_;
56 CommandBufferEntry *buffer_; 66 CommandBufferEntry *buffer_;
57 size_t entry_count_; 67 int32 entry_count_;
58 AsyncAPIInterface *handler_; 68 AsyncAPIInterface *handler_;
59 }; 69 };
60 70
61 // This class defines the interface for an asynchronous API handler, that 71 // This class defines the interface for an asynchronous API handler, that
62 // is responsible for de-multiplexing commands and their arguments. 72 // is responsible for de-multiplexing commands and their arguments.
63 class AsyncAPIInterface { 73 class AsyncAPIInterface {
64 public: 74 public:
65 AsyncAPIInterface() {} 75 AsyncAPIInterface() {}
66 virtual ~AsyncAPIInterface() {} 76 virtual ~AsyncAPIInterface() {}
67 77
(...skipping 10 matching lines...) Expand all
78 unsigned int arg_count, 88 unsigned int arg_count,
79 const void* cmd_data) = 0; 89 const void* cmd_data) = 0;
80 90
81 // Returns a name for a command. Useful for logging / debuging. 91 // Returns a name for a command. Useful for logging / debuging.
82 virtual const char* GetCommandName(unsigned int command_id) const = 0; 92 virtual const char* GetCommandName(unsigned int command_id) const = 0;
83 }; 93 };
84 94
85 } // namespace gpu 95 } // namespace gpu
86 96
87 #endif // GPU_COMMAND_BUFFER_SERVICE_CMD_PARSER_H_ 97 #endif // GPU_COMMAND_BUFFER_SERVICE_CMD_PARSER_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/cmd_buffer_engine.h ('k') | gpu/command_buffer/service/cmd_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698