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

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

Issue 212018: Change command buffer client code to use structures.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: '' Created 11 years, 3 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 /* 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 class CommandBufferEngine; 45 class CommandBufferEngine;
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
56 // Parameters: 56 // Overridden from AsyncAPIInterface.
57 // command: the command index.
58 // arg_count: the number of CommandBufferEntry arguments.
59 // args: the arguments.
60 // Returns:
61 // BufferSyncInterface::NO_ERROR if no error was found, one of
62 // BufferSyncInterface::ParseError otherwise.
63 virtual ParseError DoCommand(unsigned int command, 57 virtual ParseError DoCommand(unsigned int command,
64 unsigned int arg_count, 58 unsigned int arg_count,
65 const void* args); 59 const void* args);
66 60
67 // Sets the engine, to get shared memory buffers from, and to set the token 61 // Sets the engine, to get shared memory buffers from, and to set the token
68 // to. 62 // to.
69 void set_engine(CommandBufferEngine *engine) { engine_ = engine; } 63 void set_engine(CommandBufferEngine *engine) { engine_ = engine; }
70 private: 64 private:
71 // Decodes the SET_VERTEX_INPUT command.
72 ParseError DecodeSetVertexInput(unsigned int arg_count,
73 CommandBufferEntry *args);
74
75 // Decodes the CREATE_TEXTURE_2D command.
76 ParseError DecodeCreateTexture2D(unsigned int arg_count,
77 CommandBufferEntry *args);
78
79 // Decodes the CREATE_TEXTURE_3D command.
80 ParseError DecodeCreateTexture3D(unsigned int arg_count,
81 CommandBufferEntry *args);
82
83 // Decodes the CREATE_TEXTURE_CUBE command.
84 ParseError DecodeCreateTextureCube(unsigned int arg_count,
85 CommandBufferEntry *args);
86
87 // Decodes the SET_TEXTURE_DATA command.
88 ParseError DecodeSetTextureData(unsigned int arg_count,
89 CommandBufferEntry *args);
90
91 // Decodes the SET_TEXTURE_DATA_IMMEDIATE command.
92 ParseError DecodeSetTextureDataImmediate(unsigned int arg_count,
93 CommandBufferEntry *args);
94
95 // Decodes the GET_TEXTURE_DATA command.
96 ParseError DecodeGetTextureData(unsigned int arg_count,
97 CommandBufferEntry *args);
98
99 // Decodes the SET_SAMPLER_STATES command.
100 ParseError DecodeSetSamplerStates(unsigned int arg_count,
101 CommandBufferEntry *args);
102
103 // Decodes the SET_STENCIL_TEST command.
104 ParseError DecodeSetStencilTest(unsigned int arg_count,
105 CommandBufferEntry *args);
106
107 // Decodes the SET_BLENDING command.
108 ParseError DecodeSetBlending(unsigned int arg_count,
109 CommandBufferEntry *args);
110
111 // Gets the address of shared memory data, given a shared memory ID and an 65 // Gets the address of shared memory data, given a shared memory ID and an
112 // offset. Also checks that the size is consistent with the shared memory 66 // offset. Also checks that the size is consistent with the shared memory
113 // size. 67 // size.
114 // Parameters: 68 // Parameters:
115 // shm_id: the id of the shared memory buffer. 69 // shm_id: the id of the shared memory buffer.
116 // offset: the offset of the data in the shared memory buffer. 70 // offset: the offset of the data in the shared memory buffer.
117 // size: the size of the data. 71 // size: the size of the data.
118 // Returns: 72 // Returns:
119 // NULL if shm_id isn't a valid shared memory buffer ID or if the size 73 // NULL if shm_id isn't a valid shared memory buffer ID or if the size
120 // check fails. Return a pointer to the data otherwise. 74 // check fails. Return a pointer to the data otherwise.
121 void *GetAddressAndCheckSize(unsigned int shm_id, 75 void *GetAddressAndCheckSize(unsigned int shm_id,
122 unsigned int offset, 76 unsigned int offset,
123 unsigned int size); 77 unsigned int size);
124 78
125 // Generate a member function prototype for each command in an automated and 79 // Generate a member function prototype for each command in an automated and
126 // typesafe way. 80 // typesafe way.
127 #define O3D_COMMAND_BUFFER_CMD_OP(name) \ 81 #define O3D_COMMAND_BUFFER_CMD_OP(name) \
128 ParseError Handle_ ## name( \ 82 ParseError Handle ## name( \
129 unsigned int arg_count, \ 83 unsigned int arg_count, \
130 const cmd::name& args); \ 84 const cmd::name& args); \
131 85
132 O3D_COMMAND_BUFFER_CMDS 86 O3D_COMMAND_BUFFER_CMDS
133 87
134 #undef O3D_COMMAND_BUFFER_CMD_OP 88 #undef O3D_COMMAND_BUFFER_CMD_OP
135 89
136 GAPIInterface *gapi_; 90 GAPIInterface *gapi_;
137 CommandBufferEngine *engine_; 91 CommandBufferEngine *engine_;
138 }; 92 };
139 93
140 } // namespace command_buffer 94 } // namespace command_buffer
141 } // namespace o3d 95 } // namespace o3d
142 96
143 #endif // O3D_COMMAND_BUFFER_SERVICE_CROSS_GAPI_DECODER_H_ 97 #endif // O3D_COMMAND_BUFFER_SERVICE_CROSS_GAPI_DECODER_H_
OLDNEW
« no previous file with comments | « command_buffer/service/cross/effect_utils.h ('k') | command_buffer/service/cross/gapi_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698