| OLD | NEW |
| 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 24 matching lines...) Expand all Loading... |
| 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/cmd_parser.h" |
| 40 | 40 |
| 41 namespace o3d { | 41 namespace o3d { |
| 42 namespace command_buffer { | 42 namespace command_buffer { |
| 43 | 43 |
| 44 class GAPIInterface; | 44 class GAPIInterface; |
| 45 class CommandBufferEngine; | 45 class CommandBufferUpcallInterface; |
| 46 | 46 |
| 47 // This class implements the AsyncAPIInterface interface, decoding GAPI | 47 // This class implements the AsyncAPIInterface interface, decoding GAPI |
| 48 // commands and sending them to a GAPI interface. | 48 // commands and sending them to a GAPI interface. |
| 49 class GAPIDecoder : public AsyncAPIInterface { | 49 class GAPIDecoder : public AsyncAPIInterface { |
| 50 public: | 50 public: |
| 51 typedef BufferSyncInterface::ParseError ParseError; | 51 typedef BufferSyncInterface::ParseError ParseError; |
| 52 | 52 |
| 53 explicit GAPIDecoder(GAPIInterface *gapi) : gapi_(gapi), engine_(NULL) {} | 53 explicit GAPIDecoder(GAPIInterface *gapi) : gapi_(gapi), engine_(NULL) {} |
| 54 virtual ~GAPIDecoder() {} | 54 virtual ~GAPIDecoder() {} |
| 55 // Executes a command. | 55 // Executes a command. |
| 56 // Parameters: | 56 // Parameters: |
| 57 // command: the command index. | 57 // command: the command index. |
| 58 // arg_count: the number of CommandBufferEntry arguments. | 58 // arg_count: the number of CommandBufferEntry arguments. |
| 59 // args: the arguments. | 59 // args: the arguments. |
| 60 // Returns: | 60 // Returns: |
| 61 // BufferSyncInterface::NO_ERROR if no error was found, one of | 61 // BufferSyncInterface::NO_ERROR if no error was found, one of |
| 62 // BufferSyncInterface::ParseError otherwise. | 62 // BufferSyncInterface::ParseError otherwise. |
| 63 virtual ParseError DoCommand(unsigned int command, | 63 virtual ParseError DoCommand(unsigned int command, |
| 64 unsigned int arg_count, | 64 unsigned int arg_count, |
| 65 const void* args); | 65 const void* args); |
| 66 | 66 |
| 67 // Sets the engine, to get shared memory buffers from, and to set the token | 67 // Sets the engine, to get shared memory buffers from, and to set the token |
| 68 // to. | 68 // to. |
| 69 void set_engine(CommandBufferEngine *engine) { engine_ = engine; } | 69 void set_engine(CommandBufferUpcallInterface *engine) { engine_ = engine; } |
| 70 private: | 70 private: |
| 71 // Decodes the SET_VERTEX_INPUT command. | 71 // Decodes the SET_VERTEX_INPUT command. |
| 72 ParseError DecodeSetVertexInput(unsigned int arg_count, | 72 ParseError DecodeSetVertexInput(unsigned int arg_count, |
| 73 CommandBufferEntry *args); | 73 CommandBufferEntry *args); |
| 74 | 74 |
| 75 // Decodes the CREATE_TEXTURE_2D command. | 75 // Decodes the CREATE_TEXTURE_2D command. |
| 76 ParseError DecodeCreateTexture2D(unsigned int arg_count, | 76 ParseError DecodeCreateTexture2D(unsigned int arg_count, |
| 77 CommandBufferEntry *args); | 77 CommandBufferEntry *args); |
| 78 | 78 |
| 79 // Decodes the CREATE_TEXTURE_3D command. | 79 // Decodes the CREATE_TEXTURE_3D command. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 #define O3D_COMMAND_BUFFER_CMD_OP(name) \ | 127 #define O3D_COMMAND_BUFFER_CMD_OP(name) \ |
| 128 ParseError Handle_ ## name( \ | 128 ParseError Handle_ ## name( \ |
| 129 unsigned int arg_count, \ | 129 unsigned int arg_count, \ |
| 130 const cmd::name& args); \ | 130 const cmd::name& args); \ |
| 131 | 131 |
| 132 O3D_COMMAND_BUFFER_CMDS | 132 O3D_COMMAND_BUFFER_CMDS |
| 133 | 133 |
| 134 #undef O3D_COMMAND_BUFFER_CMD_OP | 134 #undef O3D_COMMAND_BUFFER_CMD_OP |
| 135 | 135 |
| 136 GAPIInterface *gapi_; | 136 GAPIInterface *gapi_; |
| 137 CommandBufferEngine *engine_; | 137 CommandBufferUpcallInterface *engine_; |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 } // namespace command_buffer | 140 } // namespace command_buffer |
| 141 } // namespace o3d | 141 } // namespace o3d |
| 142 | 142 |
| 143 #endif // O3D_COMMAND_BUFFER_SERVICE_CROSS_GAPI_DECODER_H_ | 143 #endif // O3D_COMMAND_BUFFER_SERVICE_CROSS_GAPI_DECODER_H_ |
| OLD | NEW |