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

Side by Side Diff: command_buffer/service/cross/gapi_decoder.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 18 matching lines...) Expand all
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 32
33 // This file contains the GAPI decoder class. 33 // This file contains the GAPI decoder class.
34 34
35 #ifndef O3D_COMMAND_BUFFER_SERVICE_CROSS_GAPI_DECODER_H_ 35 #ifndef O3D_COMMAND_BUFFER_SERVICE_CROSS_GAPI_DECODER_H_
36 #define O3D_COMMAND_BUFFER_SERVICE_CROSS_GAPI_DECODER_H_ 36 #define O3D_COMMAND_BUFFER_SERVICE_CROSS_GAPI_DECODER_H_
37 37
38 #include "core/cross/types.h" 38 #include "core/cross/types.h"
39 #include "command_buffer/service/cross/cmd_parser.h" 39 #include "command_buffer/service/cross/common_decoder.h"
40 #include "command_buffer/common/cross/o3d_cmd_format.h" 40 #include "command_buffer/common/cross/o3d_cmd_format.h"
41 41
42 namespace o3d { 42 namespace o3d {
43 namespace command_buffer { 43 namespace command_buffer {
44
45 class CommandBufferEngine;
46
47 namespace o3d { 44 namespace o3d {
48 45
49 class GAPIInterface; 46 class GAPIInterface;
50 47
51 // This class implements the AsyncAPIInterface interface, decoding GAPI 48 // This class implements the AsyncAPIInterface interface, decoding GAPI
52 // commands and sending them to a GAPI interface. 49 // commands and sending them to a GAPI interface.
53 class GAPIDecoder : public AsyncAPIInterface { 50 class GAPIDecoder : public CommonDecoder {
54 public: 51 public:
55 typedef parse_error::ParseError ParseError; 52 typedef parse_error::ParseError ParseError;
56 53
57 explicit GAPIDecoder(GAPIInterface *gapi) : gapi_(gapi), engine_(NULL) {} 54 explicit GAPIDecoder(GAPIInterface *gapi) : gapi_(gapi) {}
58 virtual ~GAPIDecoder() {} 55 virtual ~GAPIDecoder() {}
59 56
60 // Overridden from AsyncAPIInterface. 57 // Overridden from AsyncAPIInterface.
61 virtual ParseError DoCommand(unsigned int command, 58 virtual ParseError DoCommand(unsigned int command,
62 unsigned int arg_count, 59 unsigned int arg_count,
63 const void* args); 60 const void* args);
64 61
65 // Sets the engine, to get shared memory buffers from, and to set the token 62 // Overridden from AsyncAPIInterface.
66 // to. 63 virtual const char* GetCommandName(unsigned int command_id) const;
67 void set_engine(CommandBufferEngine *engine) { engine_ = engine; } 64
68 private: 65 private:
69 // Gets the address of shared memory data, given a shared memory ID and an
70 // offset. Also checks that the size is consistent with the shared memory
71 // size.
72 // Parameters:
73 // shm_id: the id of the shared memory buffer.
74 // offset: the offset of the data in the shared memory buffer.
75 // size: the size of the data.
76 // Returns:
77 // NULL if shm_id isn't a valid shared memory buffer ID or if the size
78 // check fails. Return a pointer to the data otherwise.
79 void *GetAddressAndCheckSize(unsigned int shm_id,
80 unsigned int offset,
81 unsigned int size);
82
83 // Generate a member function prototype for each command in an automated and 66 // Generate a member function prototype for each command in an automated and
84 // typesafe way. 67 // typesafe way.
85 #define O3D_COMMAND_BUFFER_CMD_OP(name) \ 68 #define O3D_COMMAND_BUFFER_CMD_OP(name) \
86 ParseError Handle ## name( \ 69 ParseError Handle ## name( \
87 unsigned int arg_count, \ 70 unsigned int arg_count, \
88 const o3d::name& args); \ 71 const o3d::name& args); \
89 72
90 O3D_COMMAND_BUFFER_CMDS(O3D_COMMAND_BUFFER_CMD_OP) 73 O3D_COMMAND_BUFFER_CMDS(O3D_COMMAND_BUFFER_CMD_OP)
91 74
92 #undef O3D_COMMAND_BUFFER_CMD_OP 75 #undef O3D_COMMAND_BUFFER_CMD_OP
93 76
94 GAPIInterface *gapi_; 77 GAPIInterface *gapi_;
95 CommandBufferEngine *engine_;
96 }; 78 };
97 79
98 } // namespace o3d 80 } // namespace o3d
99 } // namespace command_buffer 81 } // namespace command_buffer
100 } // namespace o3d 82 } // namespace o3d
101 83
102 #endif // O3D_COMMAND_BUFFER_SERVICE_CROSS_GAPI_DECODER_H_ 84 #endif // O3D_COMMAND_BUFFER_SERVICE_CROSS_GAPI_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698