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 12 matching lines...) Expand all Loading... |
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
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 binary format definition of the command buffer. | 33 // This file contains the binary format definition of the command buffer and |
| 34 // command buffer commands. |
| 35 // It is recommended you use the CommandBufferHelper object to create commands |
| 36 // but if you want to go lower level you can use the structures here to help. |
| 37 // |
| 38 // A few ways to use them: |
| 39 // |
| 40 // Fill out a structure in place: |
| 41 // |
| 42 // cmd::SetViewport::Set(ptrToSomeSharedMemory, |
| 43 // left, right, width, height, z_min, z_max); |
| 44 // |
| 45 // Fill out consecutive commands: |
| 46 // |
| 47 // Note that each cmd::XXX::Set function returns a pointer to the place |
| 48 // the next command should go. |
| 49 // |
| 50 // void* dest = ptrToSomeSharedMemory; |
| 51 // dest = cmd::SetViewport::Set(dest, left, right, width, height, min, max); |
| 52 // dest = cmd::Clear::Set(dest, buffers, r, g, b, a, depth, stencil); |
| 53 // dest = cmd::Draw::Set(dest, primitive_type, first, count); |
| 54 // |
| 55 // NOTE: The types in this file must be POD types. That means they can not have |
| 56 // constructors, destructors, virtual functions or inheritance and they can only |
| 57 // use other POD types or intrinsics as members. |
34 | 58 |
35 #ifndef O3D_COMMAND_BUFFER_COMMON_CROSS_CMD_BUFFER_FORMAT_H_ | 59 #ifndef O3D_COMMAND_BUFFER_COMMON_CROSS_CMD_BUFFER_FORMAT_H_ |
36 #define O3D_COMMAND_BUFFER_COMMON_CROSS_CMD_BUFFER_FORMAT_H_ | 60 #define O3D_COMMAND_BUFFER_COMMON_CROSS_CMD_BUFFER_FORMAT_H_ |
37 | 61 |
38 #include "base/basictypes.h" | 62 #include "base/basictypes.h" |
39 #include "command_buffer/common/cross/types.h" | 63 #include "command_buffer/common/cross/types.h" |
40 #include "command_buffer/common/cross/bitfield_helpers.h" | 64 #include "command_buffer/common/cross/bitfield_helpers.h" |
41 #include "core/cross/packing.h" | 65 #include "core/cross/packing.h" |
42 | 66 |
43 namespace o3d { | 67 namespace o3d { |
44 namespace command_buffer { | 68 namespace command_buffer { |
45 | 69 |
| 70 // Computes the number of command buffer entries needed for a certain size. In |
| 71 // other words it rounds up to a multiple of entries. |
| 72 inline uint32 ComputeNumEntries(size_t size_in_bytes) { |
| 73 return static_cast<uint32>( |
| 74 (size_in_bytes + sizeof(uint32) - 1) / sizeof(uint32)); // NOLINT |
| 75 } |
| 76 |
| 77 // Rounds up to a multiple of entries in bytes. |
| 78 inline size_t RoundSizeToMultipleOfEntries(size_t size_in_bytes) { |
| 79 return ComputeNumEntries(size_in_bytes) * sizeof(uint32); |
| 80 } |
| 81 |
46 // Struct that defines the command header in the command buffer. | 82 // Struct that defines the command header in the command buffer. |
47 struct CommandHeader { | 83 struct CommandHeader { |
48 Uint32 size:8; | 84 Uint32 size:8; |
49 Uint32 command:24; | 85 Uint32 command:24; |
| 86 |
| 87 void Init(uint32 _command, uint32 _size) { |
| 88 command = _command; |
| 89 size = _size; |
| 90 } |
| 91 |
| 92 // Sets the header based on the passed in command. Can not be used for |
| 93 // variable sized commands like immediate commands or Noop. |
| 94 template <typename T> |
| 95 void SetCmd() { |
| 96 COMPILE_ASSERT(T::kArgFlags == cmd::kFixed, Cmd_kArgFlags_not_kFixed); |
| 97 Init(T::kCmdId, ComputeNumEntries(sizeof(T))); // NOLINT |
| 98 } |
| 99 |
| 100 // Sets the header by a size in bytes. |
| 101 template <typename T> |
| 102 void SetCmdBySize(uint32 size_in_bytes) { |
| 103 COMPILE_ASSERT(T::kArgFlags == cmd::kAtLeastN, Cmd_kArgFlags_not_kAtLeastN); |
| 104 Init(T::kCmdId, ComputeNumEntries(sizeof(T) + size_in_bytes)); // NOLINT |
| 105 } |
50 }; | 106 }; |
| 107 |
51 COMPILE_ASSERT(sizeof(CommandHeader) == 4, Sizeof_CommandHeader_is_not_4); | 108 COMPILE_ASSERT(sizeof(CommandHeader) == 4, Sizeof_CommandHeader_is_not_4); |
52 | 109 |
53 // Union that defines possible command buffer entries. | 110 // Union that defines possible command buffer entries. |
54 union CommandBufferEntry { | 111 union CommandBufferEntry { |
55 CommandHeader value_header; | 112 CommandHeader value_header; |
56 Uint32 value_uint32; | 113 Uint32 value_uint32; |
57 Int32 value_int32; | 114 Int32 value_int32; |
58 float value_float; | 115 float value_float; |
59 }; | 116 }; |
60 | 117 |
61 COMPILE_ASSERT(sizeof(CommandBufferEntry) == 4, | 118 COMPILE_ASSERT(sizeof(CommandBufferEntry) == 4, |
62 Sizeof_CommandBufferEntry_is_not_4); | 119 Sizeof_CommandBufferEntry_is_not_4); |
63 | 120 |
64 // Bitfields for the SET_VERTEX_INPUT command. | 121 // Bitfields for the SetVertexInput command. |
65 namespace set_vertex_input_cmd { | 122 namespace set_vertex_input_cmd { |
66 // argument 4 | 123 // argument 4 |
67 typedef BitField<0, 4> SemanticIndex; | 124 typedef BitField<0, 4> SemanticIndex; // TODO(gman): shouldn't this be bigger |
| 125 // than 4 bits for future expansion? |
68 typedef BitField<4, 4> Semantic; | 126 typedef BitField<4, 4> Semantic; |
69 typedef BitField<8, 8> Type; | 127 typedef BitField<8, 8> Type; |
70 typedef BitField<16, 16> Stride; | 128 typedef BitField<16, 16> Stride; |
71 } // namespace set_vertex_input_cmd | 129 } // namespace set_vertex_input_cmd |
72 | 130 |
73 // Bitfields for the CREATE_TEXTURE_2D command. | 131 // Bitfields for the CreateTexture2d command. |
74 namespace create_texture_2d_cmd { | 132 namespace create_texture_2d_cmd { |
75 // argument 1 | 133 // argument 1 |
76 typedef BitField<0, 16> Width; | 134 typedef BitField<0, 16> Width; |
77 typedef BitField<16, 16> Height; | 135 typedef BitField<16, 16> Height; |
78 // argument 2 | 136 // argument 2 |
79 typedef BitField<0, 4> Levels; | 137 typedef BitField<0, 4> Levels; |
80 typedef BitField<4, 4> Unused; | 138 typedef BitField<4, 4> Unused; |
81 typedef BitField<8, 8> Format; | 139 typedef BitField<8, 8> Format; |
82 typedef BitField<16, 16> Flags; | 140 typedef BitField<16, 16> Flags; |
83 } // namespace create_texture_2d_cmd | 141 } // namespace create_texture_2d_cmd |
84 | 142 |
85 // Bitfields for the CREATE_TEXTURE_3D command. | 143 // Bitfields for the CreateTexture3d command. |
86 namespace create_texture_3d_cmd { | 144 namespace create_texture_3d_cmd { |
87 // argument 1 | 145 // argument 1 |
88 typedef BitField<0, 16> Width; | 146 typedef BitField<0, 16> Width; |
89 typedef BitField<16, 16> Height; | 147 typedef BitField<16, 16> Height; |
90 // argument 2 | 148 // argument 2 |
91 typedef BitField<0, 16> Depth; | 149 typedef BitField<0, 16> Depth; |
92 typedef BitField<16, 16> Unused1; | 150 typedef BitField<16, 16> Unused1; |
93 // argument 3 | 151 // argument 3 |
94 typedef BitField<0, 4> Levels; | 152 typedef BitField<0, 4> Levels; |
95 typedef BitField<4, 4> Unused2; | 153 typedef BitField<4, 4> Unused2; |
96 typedef BitField<8, 8> Format; | 154 typedef BitField<8, 8> Format; |
97 typedef BitField<16, 16> Flags; | 155 typedef BitField<16, 16> Flags; |
98 } // namespace create_texture_3d_cmd | 156 } // namespace create_texture_3d_cmd |
99 | 157 |
100 // Bitfields for the CREATE_TEXTURE_CUBE command. | 158 // Bitfields for the CreateTextureCube command. |
101 namespace create_texture_cube_cmd { | 159 namespace create_texture_cube_cmd { |
102 // argument 1 | 160 // argument 1 |
103 typedef BitField<0, 16> Side; | 161 typedef BitField<0, 16> Side; |
104 typedef BitField<16, 16> Unused1; | 162 typedef BitField<16, 16> Unused1; |
105 // argument 2 | 163 // argument 2 |
106 typedef BitField<0, 4> Levels; | 164 typedef BitField<0, 4> Levels; |
107 typedef BitField<4, 4> Unused2; | 165 typedef BitField<4, 4> Unused2; |
108 typedef BitField<8, 8> Format; | 166 typedef BitField<8, 8> Format; |
109 typedef BitField<16, 16> Flags; | 167 typedef BitField<16, 16> Flags; |
110 } // namespace create_texture_cube_cmd | 168 } // namespace create_texture_cube_cmd |
111 | 169 |
112 // Bitfields for the CREATE_RENDER_SURFACE command. | 170 // Bitfields for the CreateRenderSurface command. |
113 namespace create_render_surface_cmd { | 171 namespace create_render_surface_cmd { |
114 // argument 1 | 172 // argument 1 |
115 typedef BitField<0, 16> Width; | 173 typedef BitField<0, 16> Width; |
116 typedef BitField<16, 16> Height; | 174 typedef BitField<16, 16> Height; |
117 // argument 2 may refer to side or depth | 175 // argument 2 may refer to side or depth |
118 typedef BitField<0, 16> Levels; | 176 typedef BitField<0, 16> Levels; |
119 typedef BitField<16, 16> Side; | 177 typedef BitField<16, 16> Side; |
120 } // namespace create_render_surface_cmd | 178 } // namespace create_render_surface_cmd |
121 | 179 |
122 // Bitfields for the SET_TEXTURE_DATA command. | 180 // Bitfields for the CreateDepthSurface command. |
| 181 namespace create_depth_surface_cmd { |
| 182 // argument 1 |
| 183 typedef BitField<0, 16> Width; |
| 184 typedef BitField<16, 16> Height; |
| 185 } // namespace create_depth_surface_cmd |
| 186 |
| 187 // Bitfields for the SetTextureData command. |
123 namespace set_texture_data_cmd { | 188 namespace set_texture_data_cmd { |
124 // argument 1 | 189 // argument 1 |
125 typedef BitField<0, 16> X; | 190 typedef BitField<0, 16> X; |
126 typedef BitField<16, 16> Y; | 191 typedef BitField<16, 16> Y; |
127 // argument 2 | 192 // argument 2 |
128 typedef BitField<0, 16> Width; | 193 typedef BitField<0, 16> Width; |
129 typedef BitField<16, 16> Height; | 194 typedef BitField<16, 16> Height; |
130 // argument 3 | 195 // argument 3 |
131 typedef BitField<0, 16> Z; | 196 typedef BitField<0, 16> Z; |
132 typedef BitField<16, 16> Depth; | 197 typedef BitField<16, 16> Depth; |
133 // argument 4 | 198 // argument 4 |
134 typedef BitField<0, 4> Level; | 199 typedef BitField<0, 4> Level; |
135 typedef BitField<4, 3> Face; | 200 typedef BitField<4, 3> Face; |
136 typedef BitField<7, 25> Unused; | 201 typedef BitField<7, 25> Unused; |
137 } // namespace set_texture_data_cmd | 202 } // namespace set_texture_data_cmd |
138 | 203 |
139 // Bitfields for the SET_TEXTURE_DATA_IMMEDIATE command. | 204 // Bitfields for the SetTextureDataImmediate command. |
140 namespace set_texture_data_immediate_cmd { | 205 namespace set_texture_data_immediate_cmd { |
141 // argument 1 | 206 // argument 1 |
142 typedef BitField<0, 16> X; | 207 typedef BitField<0, 16> X; |
143 typedef BitField<16, 16> Y; | 208 typedef BitField<16, 16> Y; |
144 // argument 2 | 209 // argument 2 |
145 typedef BitField<0, 16> Width; | 210 typedef BitField<0, 16> Width; |
146 typedef BitField<16, 16> Height; | 211 typedef BitField<16, 16> Height; |
147 // argument 3 | 212 // argument 3 |
148 typedef BitField<0, 16> Z; | 213 typedef BitField<0, 16> Z; |
149 typedef BitField<16, 16> Depth; | 214 typedef BitField<16, 16> Depth; |
150 // argument 4 | 215 // argument 4 |
151 typedef BitField<0, 4> Level; | 216 typedef BitField<0, 4> Level; |
152 typedef BitField<4, 3> Face; | 217 typedef BitField<4, 3> Face; |
153 typedef BitField<7, 25> Unused; | 218 typedef BitField<7, 25> Unused; |
154 } // namespace set_texture_data_immediate_cmd | 219 } // namespace set_texture_data_immediate_cmd |
155 | 220 |
156 // Bitfields for the GET_TEXTURE_DATA command. | 221 // Bitfields for the GetTextureData command. |
157 namespace get_texture_data_cmd { | 222 namespace get_texture_data_cmd { |
158 // argument 1 | 223 // argument 1 |
159 typedef BitField<0, 16> X; | 224 typedef BitField<0, 16> X; |
160 typedef BitField<16, 16> Y; | 225 typedef BitField<16, 16> Y; |
161 // argument 2 | 226 // argument 2 |
162 typedef BitField<0, 16> Width; | 227 typedef BitField<0, 16> Width; |
163 typedef BitField<16, 16> Height; | 228 typedef BitField<16, 16> Height; |
164 // argument 3 | 229 // argument 3 |
165 typedef BitField<0, 16> Z; | 230 typedef BitField<0, 16> Z; |
166 typedef BitField<16, 16> Depth; | 231 typedef BitField<16, 16> Depth; |
167 // argument 4 | 232 // argument 4 |
168 typedef BitField<0, 4> Level; | 233 typedef BitField<0, 4> Level; |
169 typedef BitField<4, 3> Face; | 234 typedef BitField<4, 3> Face; |
170 typedef BitField<7, 25> Unused; | 235 typedef BitField<7, 25> Unused; |
171 } // namespace get_texture_data_cmd | 236 } // namespace get_texture_data_cmd |
172 | 237 |
173 // Bitfields for the SET_SAMPLER_STATES command. | 238 // Bitfields for the SetSamplerStates command. |
174 namespace set_sampler_states { | 239 namespace set_sampler_states { |
175 // argument 2 | 240 // argument 2 |
176 typedef BitField<0, 3> AddressingU; | 241 typedef BitField<0, 3> AddressingU; |
177 typedef BitField<3, 3> AddressingV; | 242 typedef BitField<3, 3> AddressingV; |
178 typedef BitField<6, 3> AddressingW; | 243 typedef BitField<6, 3> AddressingW; |
179 typedef BitField<9, 3> MagFilter; | 244 typedef BitField<9, 3> MagFilter; |
180 typedef BitField<12, 3> MinFilter; | 245 typedef BitField<12, 3> MinFilter; |
181 typedef BitField<15, 3> MipFilter; | 246 typedef BitField<15, 3> MipFilter; |
182 typedef BitField<18, 6> Unused; | 247 typedef BitField<18, 6> Unused; |
183 typedef BitField<24, 8> MaxAnisotropy; | 248 typedef BitField<24, 8> MaxAnisotropy; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 | 336 |
272 | 337 |
273 // This macro is used to safely and convienently expand the list of commnad | 338 // This macro is used to safely and convienently expand the list of commnad |
274 // buffer commands in to various lists and never have them get out of sync. To | 339 // buffer commands in to various lists and never have them get out of sync. To |
275 // add a new command, add it this list, create the corresponding structure below | 340 // add a new command, add it this list, create the corresponding structure below |
276 // and then add a function in gapi_decoder.cc called Handle_COMMAND_NAME where | 341 // and then add a function in gapi_decoder.cc called Handle_COMMAND_NAME where |
277 // COMMAND_NAME is the name of your command structure. | 342 // COMMAND_NAME is the name of your command structure. |
278 // | 343 // |
279 // NOTE: THE ORDER OF THESE MUST NOT CHANGE (their id is derived by order) | 344 // NOTE: THE ORDER OF THESE MUST NOT CHANGE (their id is derived by order) |
280 #define O3D_COMMAND_BUFFER_CMDS \ | 345 #define O3D_COMMAND_BUFFER_CMDS \ |
281 O3D_COMMAND_BUFFER_CMD_OP(NOOP) /* 0 */ \ | 346 O3D_COMMAND_BUFFER_CMD_OP(Noop) /* 0 */ \ |
282 O3D_COMMAND_BUFFER_CMD_OP(SET_TOKEN) \ | 347 O3D_COMMAND_BUFFER_CMD_OP(SetToken) /* 1 */ \ |
283 O3D_COMMAND_BUFFER_CMD_OP(BEGIN_FRAME) \ | 348 O3D_COMMAND_BUFFER_CMD_OP(BeginFrame) /* 2 */ \ |
284 O3D_COMMAND_BUFFER_CMD_OP(END_FRAME) \ | 349 O3D_COMMAND_BUFFER_CMD_OP(EndFrame) /* 3 */ \ |
285 O3D_COMMAND_BUFFER_CMD_OP(CLEAR) \ | 350 O3D_COMMAND_BUFFER_CMD_OP(Clear) /* 4 */ \ |
286 O3D_COMMAND_BUFFER_CMD_OP(CREATE_VERTEX_BUFFER) \ | 351 O3D_COMMAND_BUFFER_CMD_OP(CreateVertexBuffer) /* 5 */ \ |
287 O3D_COMMAND_BUFFER_CMD_OP(DESTROY_VERTEX_BUFFER) \ | 352 O3D_COMMAND_BUFFER_CMD_OP(DestroyVertexBuffer) /* 6 */ \ |
288 O3D_COMMAND_BUFFER_CMD_OP(SET_VERTEX_BUFFER_DATA) \ | 353 O3D_COMMAND_BUFFER_CMD_OP(SetVertexBufferData) /* 7 */ \ |
289 O3D_COMMAND_BUFFER_CMD_OP(SET_VERTEX_BUFFER_DATA_IMMEDIATE) \ | 354 O3D_COMMAND_BUFFER_CMD_OP(SetVertexBufferDataImmediate) /* 8 */ \ |
290 O3D_COMMAND_BUFFER_CMD_OP(GET_VERTEX_BUFFER_DATA) \ | 355 O3D_COMMAND_BUFFER_CMD_OP(GetVertexBufferData) /* 9 */ \ |
291 O3D_COMMAND_BUFFER_CMD_OP(CREATE_INDEX_BUFFER) /* 10 */ \ | 356 O3D_COMMAND_BUFFER_CMD_OP(CreateIndexBuffer) /* 10 */ \ |
292 O3D_COMMAND_BUFFER_CMD_OP(DESTROY_INDEX_BUFFER) \ | 357 O3D_COMMAND_BUFFER_CMD_OP(DestroyIndexBuffer) /* 11 */ \ |
293 O3D_COMMAND_BUFFER_CMD_OP(SET_INDEX_BUFFER_DATA) \ | 358 O3D_COMMAND_BUFFER_CMD_OP(SetIndexBufferData) /* 12 */ \ |
294 O3D_COMMAND_BUFFER_CMD_OP(SET_INDEX_BUFFER_DATA_IMMEDIATE) \ | 359 O3D_COMMAND_BUFFER_CMD_OP(SetIndexBufferDataImmediate) /* 13 */ \ |
295 O3D_COMMAND_BUFFER_CMD_OP(GET_INDEX_BUFFER_DATA) \ | 360 O3D_COMMAND_BUFFER_CMD_OP(GetIndexBufferData) /* 14 */ \ |
296 O3D_COMMAND_BUFFER_CMD_OP(CREATE_VERTEX_STRUCT) \ | 361 O3D_COMMAND_BUFFER_CMD_OP(CreateVertexStruct) /* 15 */ \ |
297 O3D_COMMAND_BUFFER_CMD_OP(DESTROY_VERTEX_STRUCT) \ | 362 O3D_COMMAND_BUFFER_CMD_OP(DestroyVertexStruct) /* 16 */ \ |
298 O3D_COMMAND_BUFFER_CMD_OP(SET_VERTEX_INPUT) \ | 363 O3D_COMMAND_BUFFER_CMD_OP(SetVertexInput) /* 17 */ \ |
299 O3D_COMMAND_BUFFER_CMD_OP(SET_VERTEX_STRUCT) \ | 364 O3D_COMMAND_BUFFER_CMD_OP(SetVertexStruct) /* 18 */ \ |
300 O3D_COMMAND_BUFFER_CMD_OP(DRAW) \ | 365 O3D_COMMAND_BUFFER_CMD_OP(Draw) /* 19 */ \ |
301 O3D_COMMAND_BUFFER_CMD_OP(DRAW_INDEXED) /* 20 */ \ | 366 O3D_COMMAND_BUFFER_CMD_OP(DrawIndexed) /* 20 */ \ |
302 O3D_COMMAND_BUFFER_CMD_OP(CREATE_EFFECT) \ | 367 O3D_COMMAND_BUFFER_CMD_OP(CreateEffect) /* 21 */ \ |
303 O3D_COMMAND_BUFFER_CMD_OP(CREATE_EFFECT_IMMEDIATE) \ | 368 O3D_COMMAND_BUFFER_CMD_OP(CreateEffectImmediate) /* 22 */ \ |
304 O3D_COMMAND_BUFFER_CMD_OP(DESTROY_EFFECT) \ | 369 O3D_COMMAND_BUFFER_CMD_OP(DestroyEffect) /* 23 */ \ |
305 O3D_COMMAND_BUFFER_CMD_OP(SET_EFFECT) \ | 370 O3D_COMMAND_BUFFER_CMD_OP(SetEffect) /* 24 */ \ |
306 O3D_COMMAND_BUFFER_CMD_OP(GET_PARAM_COUNT) \ | 371 O3D_COMMAND_BUFFER_CMD_OP(GetParamCount) /* 25 */ \ |
307 O3D_COMMAND_BUFFER_CMD_OP(CREATE_PARAM) \ | 372 O3D_COMMAND_BUFFER_CMD_OP(CreateParam) /* 26 */ \ |
308 O3D_COMMAND_BUFFER_CMD_OP(CREATE_PARAM_BY_NAME) \ | 373 O3D_COMMAND_BUFFER_CMD_OP(CreateParamByName) /* 27 */ \ |
309 O3D_COMMAND_BUFFER_CMD_OP(CREATE_PARAM_BY_NAME_IMMEDIATE) \ | 374 O3D_COMMAND_BUFFER_CMD_OP(CreateParamByNameImmediate) /* 28 */ \ |
310 O3D_COMMAND_BUFFER_CMD_OP(DESTROY_PARAM) \ | 375 O3D_COMMAND_BUFFER_CMD_OP(DestroyParam) /* 29 */ \ |
311 O3D_COMMAND_BUFFER_CMD_OP(SET_PARAM_DATA) /* 30 */ \ | 376 O3D_COMMAND_BUFFER_CMD_OP(SetParamData) /* 30 */ \ |
312 O3D_COMMAND_BUFFER_CMD_OP(SET_PARAM_DATA_IMMEDIATE) \ | 377 O3D_COMMAND_BUFFER_CMD_OP(SetParamDataImmediate) /* 31 */ \ |
313 O3D_COMMAND_BUFFER_CMD_OP(GET_PARAM_DESC) \ | 378 O3D_COMMAND_BUFFER_CMD_OP(GetParamDesc) /* 32 */ \ |
314 O3D_COMMAND_BUFFER_CMD_OP(GET_STREAM_COUNT) \ | 379 O3D_COMMAND_BUFFER_CMD_OP(GetStreamCount) /* 33 */ \ |
315 O3D_COMMAND_BUFFER_CMD_OP(GET_STREAM_DESC) \ | 380 O3D_COMMAND_BUFFER_CMD_OP(GetStreamDesc) /* 34 */ \ |
316 O3D_COMMAND_BUFFER_CMD_OP(DESTROY_TEXTURE) \ | 381 O3D_COMMAND_BUFFER_CMD_OP(DestroyTexture) /* 35 */ \ |
317 O3D_COMMAND_BUFFER_CMD_OP(CREATE_TEXTURE_2D) \ | 382 O3D_COMMAND_BUFFER_CMD_OP(CreateTexture2d) /* 36 */ \ |
318 O3D_COMMAND_BUFFER_CMD_OP(CREATE_TEXTURE_3D) \ | 383 O3D_COMMAND_BUFFER_CMD_OP(CreateTexture3d) /* 37 */ \ |
319 O3D_COMMAND_BUFFER_CMD_OP(CREATE_TEXTURE_CUBE) \ | 384 O3D_COMMAND_BUFFER_CMD_OP(CreateTextureCube) /* 38 */ \ |
320 O3D_COMMAND_BUFFER_CMD_OP(SET_TEXTURE_DATA) \ | 385 O3D_COMMAND_BUFFER_CMD_OP(SetTextureData) /* 39 */ \ |
321 O3D_COMMAND_BUFFER_CMD_OP(SET_TEXTURE_DATA_IMMEDIATE) /* 40 */ \ | 386 O3D_COMMAND_BUFFER_CMD_OP(SetTextureDataImmediate) /* 40 */ \ |
322 O3D_COMMAND_BUFFER_CMD_OP(GET_TEXTURE_DATA) \ | 387 O3D_COMMAND_BUFFER_CMD_OP(GetTextureData) /* 41 */ \ |
323 O3D_COMMAND_BUFFER_CMD_OP(CREATE_SAMPLER) \ | 388 O3D_COMMAND_BUFFER_CMD_OP(CreateSampler) /* 42 */ \ |
324 O3D_COMMAND_BUFFER_CMD_OP(DESTROY_SAMPLER) \ | 389 O3D_COMMAND_BUFFER_CMD_OP(DestroySampler) /* 43 */ \ |
325 O3D_COMMAND_BUFFER_CMD_OP(SET_SAMPLER_STATES) \ | 390 O3D_COMMAND_BUFFER_CMD_OP(SetSamplerStates) /* 44 */ \ |
326 O3D_COMMAND_BUFFER_CMD_OP(SET_SAMPLER_BORDER_COLOR) \ | 391 O3D_COMMAND_BUFFER_CMD_OP(SetSamplerBorderColor) /* 45 */ \ |
327 O3D_COMMAND_BUFFER_CMD_OP(SET_SAMPLER_TEXTURE) \ | 392 O3D_COMMAND_BUFFER_CMD_OP(SetSamplerTexture) /* 46 */ \ |
328 O3D_COMMAND_BUFFER_CMD_OP(SET_VIEWPORT) \ | 393 O3D_COMMAND_BUFFER_CMD_OP(SetViewport) /* 47 */ \ |
329 O3D_COMMAND_BUFFER_CMD_OP(SET_SCISSOR) \ | 394 O3D_COMMAND_BUFFER_CMD_OP(SetScissor) /* 48 */ \ |
330 O3D_COMMAND_BUFFER_CMD_OP(SET_POINT_LINE_RASTER) \ | 395 O3D_COMMAND_BUFFER_CMD_OP(SetPointLineRaster) /* 49 */ \ |
331 O3D_COMMAND_BUFFER_CMD_OP(SET_POLYGON_RASTER) /* 50 */ \ | 396 O3D_COMMAND_BUFFER_CMD_OP(SetPolygonRaster) /* 50 */ \ |
332 O3D_COMMAND_BUFFER_CMD_OP(SET_POLYGON_OFFSET) \ | 397 O3D_COMMAND_BUFFER_CMD_OP(SetPolygonOffset) /* 51 */ \ |
333 O3D_COMMAND_BUFFER_CMD_OP(SET_ALPHA_TEST) \ | 398 O3D_COMMAND_BUFFER_CMD_OP(SetAlphaTest) /* 52 */ \ |
334 O3D_COMMAND_BUFFER_CMD_OP(SET_DEPTH_TEST) \ | 399 O3D_COMMAND_BUFFER_CMD_OP(SetDepthTest) /* 53 */ \ |
335 O3D_COMMAND_BUFFER_CMD_OP(SET_STENCIL_TEST) \ | 400 O3D_COMMAND_BUFFER_CMD_OP(SetStencilTest) /* 54 */ \ |
336 O3D_COMMAND_BUFFER_CMD_OP(SET_BLENDING) \ | 401 O3D_COMMAND_BUFFER_CMD_OP(SetBlending) /* 55 */ \ |
337 O3D_COMMAND_BUFFER_CMD_OP(SET_BLENDING_COLOR) \ | 402 O3D_COMMAND_BUFFER_CMD_OP(SetBlendingColor) /* 56 */ \ |
338 O3D_COMMAND_BUFFER_CMD_OP(SET_COLOR_WRITE) \ | 403 O3D_COMMAND_BUFFER_CMD_OP(SetColorWrite) /* 57 */ \ |
339 O3D_COMMAND_BUFFER_CMD_OP(CREATE_RENDER_SURFACE) \ | 404 O3D_COMMAND_BUFFER_CMD_OP(CreateRenderSurface) /* 58 */ \ |
340 O3D_COMMAND_BUFFER_CMD_OP(DESTROY_RENDER_SURFACE) \ | 405 O3D_COMMAND_BUFFER_CMD_OP(DestroyRenderSurface) /* 59 */ \ |
341 O3D_COMMAND_BUFFER_CMD_OP(CREATE_DEPTH_SURFACE) /* 60 */ \ | 406 O3D_COMMAND_BUFFER_CMD_OP(CreateDepthSurface) /* 60 */ \ |
342 O3D_COMMAND_BUFFER_CMD_OP(DESTROY_DEPTH_SURFACE) \ | 407 O3D_COMMAND_BUFFER_CMD_OP(DestroyDepthSurface) /* 61 */ \ |
343 O3D_COMMAND_BUFFER_CMD_OP(SET_RENDER_SURFACE) \ | 408 O3D_COMMAND_BUFFER_CMD_OP(SetRenderSurface) /* 62 */ \ |
344 O3D_COMMAND_BUFFER_CMD_OP(SET_BACK_SURFACES) \ | 409 O3D_COMMAND_BUFFER_CMD_OP(SetBackSurfaces) /* 63 */ \ |
345 | 410 |
346 | 411 |
347 // GAPI commands. | 412 // GAPI commands. |
348 enum CommandId { | 413 enum CommandId { |
349 #define O3D_COMMAND_BUFFER_CMD_OP(name) name, | 414 #define O3D_COMMAND_BUFFER_CMD_OP(name) k ## name, |
350 | 415 |
351 O3D_COMMAND_BUFFER_CMDS | 416 O3D_COMMAND_BUFFER_CMDS |
352 | 417 |
353 #undef O3D_COMMAND_BUFFER_CMD_OP | 418 #undef O3D_COMMAND_BUFFER_CMD_OP |
354 }; | 419 }; |
355 | 420 |
356 namespace cmd { | 421 namespace cmd { |
357 | 422 |
358 // Make sure the compiler does not add extra padding to any of the command | 423 // Make sure the compiler does not add extra padding to any of the command |
359 // structures. | 424 // structures. |
360 O3D_PUSH_STRUCTURE_PACKING_1; | 425 O3D_PUSH_STRUCTURE_PACKING_1; |
361 | 426 |
| 427 // Gets the address of memory just after a structure in a typesafe way. This is |
| 428 // used for IMMEDIATE commands to get the address of the place to put the data. |
| 429 // Immediate command put their data direclty in the command buffer. |
| 430 // Parameters: |
| 431 // cmd: Address of command. |
| 432 template <typename T> |
| 433 void* ImmediateDataAddress(T* cmd) { |
| 434 COMPILE_ASSERT(T::kArgFlags == cmd::kAtLeastN, Cmd_kArgFlags_not_kAtLeastN); |
| 435 return reinterpret_cast<char*>(cmd) + sizeof(*cmd); |
| 436 } |
| 437 |
| 438 // Gets the address of the place to put the next command in a typesafe way. |
| 439 // This can only be used for fixed sized commands. |
| 440 template <typename T> |
| 441 // Parameters: |
| 442 // cmd: Address of command. |
| 443 void* NextCmdAddress(void* cmd) { |
| 444 COMPILE_ASSERT(T::kArgFlags == cmd::kFixed, Cmd_kArgFlags_not_kFixed); |
| 445 return reinterpret_cast<char*>(cmd) + sizeof(T); |
| 446 } |
| 447 |
| 448 // Gets the address of the place to put the next command in a typesafe way. |
| 449 // This can only be used for variable sized command like IMMEDIATE commands. |
| 450 // Parameters: |
| 451 // cmd: Address of command. |
| 452 // size_of_data_in_bytes: Size of the data for the command. |
| 453 template <typename T> |
| 454 void* NextImmediateCmdAddress(void* cmd, uint32 size_of_data_in_bytes) { |
| 455 COMPILE_ASSERT(T::kArgFlags == cmd::kAtLeastN, Cmd_kArgFlags_not_kAtLeastN); |
| 456 return reinterpret_cast<char*>(cmd) + sizeof(T) + // NOLINT |
| 457 RoundSizeToMultipleOfEntries(size_of_data_in_bytes); |
| 458 } |
| 459 |
362 enum ArgFlags { | 460 enum ArgFlags { |
363 kFixed = 0x0, | 461 kFixed = 0x0, |
364 kAtLeastN = 0x1, | 462 kAtLeastN = 0x1, |
365 }; | 463 }; |
366 | 464 |
367 struct SharedMemory { | 465 struct SharedMemory { |
| 466 void Init(uint32 _id, uint32 _offset) { |
| 467 id = _id; |
| 468 offset = _offset; |
| 469 } |
| 470 |
368 uint32 id; | 471 uint32 id; |
369 uint32 offset; | 472 uint32 offset; |
370 }; | 473 }; |
371 | 474 |
372 struct NOOP { | 475 COMPILE_ASSERT(offsetof(SharedMemory, id) == 0, |
373 static const CommandId kCmdId = command_buffer::NOOP; | 476 Offsetof_SharedMemory_id_not_0); |
| 477 COMPILE_ASSERT(offsetof(SharedMemory, offset) == 4, |
| 478 Offsetof_SharedMemory_offset_not_4); |
| 479 |
| 480 struct Noop { |
| 481 typedef Noop ValueType; |
| 482 static const CommandId kCmdId = command_buffer::kNoop; |
374 static const ArgFlags kArgFlags = kAtLeastN; | 483 static const ArgFlags kArgFlags = kAtLeastN; |
| 484 |
| 485 void SetHeader(uint32 skip_count) { |
| 486 header.Init(kCmdId, skip_count + 1); |
| 487 } |
| 488 |
| 489 void Init(uint32 skip_count) { |
| 490 SetHeader(skip_count); |
| 491 } |
| 492 |
| 493 static void* Set(void* cmd, uint32 skip_count) { |
| 494 static_cast<ValueType*>(cmd)->Init(skip_count); |
| 495 return NextImmediateCmdAddress<ValueType>( |
| 496 cmd, skip_count * sizeof(CommandBufferEntry)); // NOLINT |
| 497 } |
| 498 |
| 499 CommandHeader header; |
375 }; | 500 }; |
376 | 501 |
377 struct SET_TOKEN { | 502 COMPILE_ASSERT(sizeof(Noop) == 4, Sizeof_Noop_is_not_4); |
378 static const CommandId kCmdId = command_buffer::SET_TOKEN; | 503 COMPILE_ASSERT(offsetof(Noop, header) == 0, Offsetof_Noop_header_not_0); |
| 504 |
| 505 struct SetToken { |
| 506 typedef SetToken ValueType; |
| 507 static const CommandId kCmdId = command_buffer::kSetToken; |
379 static const ArgFlags kArgFlags = kFixed; | 508 static const ArgFlags kArgFlags = kFixed; |
| 509 |
| 510 void SetHeader() { |
| 511 header.SetCmd<ValueType>(); |
| 512 } |
| 513 |
| 514 void Init(uint32 _token) { |
| 515 SetHeader(); |
| 516 token = _token; |
| 517 } |
| 518 static void* Set(void* cmd, uint32 token) { |
| 519 static_cast<ValueType*>(cmd)->Init(token); |
| 520 return NextCmdAddress<ValueType>(cmd); |
| 521 } |
| 522 |
| 523 CommandHeader header; |
380 uint32 token; | 524 uint32 token; |
381 }; | 525 }; |
382 | 526 |
383 struct BEGIN_FRAME { | 527 COMPILE_ASSERT(sizeof(SetToken) == 8, Sizeof_SetToken_is_not_8); |
384 static const CommandId kCmdId = command_buffer::BEGIN_FRAME; | 528 COMPILE_ASSERT(offsetof(SetToken, header) == 0, |
| 529 Offsetof_SetToken_header_not_0); |
| 530 COMPILE_ASSERT(offsetof(SetToken, token) == 4, |
| 531 Offsetof_SetToken_token_not_4); |
| 532 |
| 533 struct BeginFrame { |
| 534 typedef BeginFrame ValueType; |
| 535 static const CommandId kCmdId = command_buffer::kBeginFrame; |
385 static const ArgFlags kArgFlags = kFixed; | 536 static const ArgFlags kArgFlags = kFixed; |
| 537 |
| 538 void SetHeader() { |
| 539 header.SetCmd<ValueType>(); |
| 540 } |
| 541 |
| 542 void Init() { |
| 543 SetHeader(); |
| 544 } |
| 545 static void* Set(void* cmd) { |
| 546 static_cast<ValueType*>(cmd)->Init(); |
| 547 return NextCmdAddress<ValueType>(cmd); |
| 548 } |
| 549 |
| 550 CommandHeader header; |
386 }; | 551 }; |
387 | 552 |
388 struct END_FRAME { | 553 COMPILE_ASSERT(sizeof(BeginFrame) == 4, Sizeof_BeginFrame_is_not_4); |
389 static const CommandId kCmdId = command_buffer::END_FRAME; | 554 COMPILE_ASSERT(offsetof(BeginFrame, header) == 0, |
| 555 OffsetOf_BeginFrame_header_not_0); |
| 556 |
| 557 struct EndFrame { |
| 558 typedef EndFrame ValueType; |
| 559 static const CommandId kCmdId = command_buffer::kEndFrame; |
390 static const ArgFlags kArgFlags = kFixed; | 560 static const ArgFlags kArgFlags = kFixed; |
| 561 |
| 562 void SetHeader() { |
| 563 header.SetCmd<ValueType>(); |
| 564 } |
| 565 |
| 566 void Init() { |
| 567 SetHeader(); |
| 568 } |
| 569 static void* Set(void* cmd) { |
| 570 static_cast<ValueType*>(cmd)->Init(); |
| 571 return NextCmdAddress<ValueType>(cmd); |
| 572 } |
| 573 |
| 574 CommandHeader header; |
391 }; | 575 }; |
392 | 576 |
393 struct CLEAR { | 577 COMPILE_ASSERT(sizeof(EndFrame) == 4, Sizeof_EndFrame_is_not_4); |
394 static const CommandId kCmdId = command_buffer::CLEAR; | 578 COMPILE_ASSERT(offsetof(EndFrame, header) == 0, |
| 579 OffsetOf_EndFrame_header_not_0); |
| 580 |
| 581 struct Clear { |
| 582 typedef Clear ValueType; |
| 583 static const CommandId kCmdId = command_buffer::kClear; |
395 static const ArgFlags kArgFlags = kFixed; | 584 static const ArgFlags kArgFlags = kFixed; |
| 585 |
| 586 void SetHeader() { |
| 587 header.SetCmd<ValueType>(); |
| 588 } |
| 589 |
| 590 void Init(uint32 _buffers, float _red, float _green, float _blue, |
| 591 float _alpha, float _depth, uint32 _stencil) { |
| 592 SetHeader(); |
| 593 buffers = _buffers; |
| 594 red = _red; |
| 595 green = _green; |
| 596 blue = _blue; |
| 597 alpha = _alpha; |
| 598 depth = _depth; |
| 599 stencil = _stencil; |
| 600 } |
| 601 |
| 602 static void* Set(void* cmd, uint32 buffers, |
| 603 float red, float green, float blue, float alpha, |
| 604 float depth, |
| 605 uint32 stencil) { |
| 606 static_cast<ValueType*>(cmd)->Init( |
| 607 buffers, red, green, blue, alpha, depth, stencil); |
| 608 return NextCmdAddress<ValueType>(cmd); |
| 609 } |
| 610 |
| 611 CommandHeader header; |
396 uint32 buffers; | 612 uint32 buffers; |
397 float red; | 613 float red; |
398 float green; | 614 float green; |
399 float blue; | 615 float blue; |
400 float alpha; | 616 float alpha; |
401 float depth; | 617 float depth; |
402 uint32 stencil; | 618 uint32 stencil; |
403 }; | 619 }; |
404 | 620 |
405 struct SET_VIEWPORT { | 621 COMPILE_ASSERT(sizeof(Clear) == 32, Sizeof_Clear_is_not_32); |
406 static const CommandId kCmdId = command_buffer::SET_VIEWPORT; | 622 COMPILE_ASSERT(offsetof(Clear, header) == 0, |
| 623 OffsetOf_Clear_header_not_0); |
| 624 COMPILE_ASSERT(offsetof(Clear, buffers) == 4, |
| 625 OffsetOf_Clear_buffers_not_4); |
| 626 COMPILE_ASSERT(offsetof(Clear, red) == 8, |
| 627 OffsetOf_Clear_red_not_8); |
| 628 COMPILE_ASSERT(offsetof(Clear, green) == 12, |
| 629 OffsetOf_Clear_green_not_12); |
| 630 COMPILE_ASSERT(offsetof(Clear, blue) == 16, |
| 631 OffsetOf_Clear_blue_not_16); |
| 632 COMPILE_ASSERT(offsetof(Clear, alpha) == 20, |
| 633 OffsetOf_Clear_alpha_not_20); |
| 634 COMPILE_ASSERT(offsetof(Clear, depth) == 24, |
| 635 OffsetOf_Clear_depth_not_24); |
| 636 COMPILE_ASSERT(offsetof(Clear, stencil) == 28, |
| 637 OffsetOf_Clear_stencil_not_28); |
| 638 |
| 639 struct SetViewport { |
| 640 typedef SetViewport ValueType; |
| 641 static const CommandId kCmdId = command_buffer::kSetViewport; |
407 static const ArgFlags kArgFlags = kFixed; | 642 static const ArgFlags kArgFlags = kFixed; |
| 643 |
| 644 void SetHeader() { |
| 645 header.SetCmd<ValueType>(); |
| 646 } |
| 647 |
| 648 void Init( |
| 649 uint32 _left, |
| 650 uint32 _top, |
| 651 uint32 _width, |
| 652 uint32 _height, |
| 653 float _z_min, |
| 654 float _z_max) { |
| 655 SetHeader(); |
| 656 left = _left; |
| 657 top = _top; |
| 658 width = _width; |
| 659 height = _height; |
| 660 z_min = _z_min; |
| 661 z_max = _z_max; |
| 662 } |
| 663 |
| 664 static void* Set(void* cmd, |
| 665 uint32 left, |
| 666 uint32 top, |
| 667 uint32 width, |
| 668 uint32 height, |
| 669 float z_min, |
| 670 float z_max) { |
| 671 static_cast<ValueType*>(cmd)->Init( |
| 672 left, |
| 673 top, |
| 674 width, |
| 675 height, |
| 676 z_min, |
| 677 z_max); |
| 678 return NextCmdAddress<ValueType>(cmd); |
| 679 } |
| 680 |
| 681 CommandHeader header; |
408 uint32 left; | 682 uint32 left; |
409 uint32 top; | 683 uint32 top; |
410 uint32 width; | 684 uint32 width; |
411 uint32 height; | 685 uint32 height; |
412 float z_min; | 686 float z_min; |
413 float z_max; | 687 float z_max; |
414 }; | 688 }; |
415 | 689 |
416 struct CREATE_VERTEX_BUFFER { | 690 COMPILE_ASSERT(sizeof(SetViewport) == 28, Sizeof_SetViewport_is_not_28); |
417 static const CommandId kCmdId = command_buffer::CREATE_VERTEX_BUFFER; | 691 COMPILE_ASSERT(offsetof(SetViewport, header) == 0, |
418 static const ArgFlags kArgFlags = kFixed; | 692 OffsetOf_SetViewport_header_not_0); |
| 693 COMPILE_ASSERT(offsetof(SetViewport, left) == 4, |
| 694 OffsetOf_SetViewport_left_not_4); |
| 695 COMPILE_ASSERT(offsetof(SetViewport, top) == 8, |
| 696 OffsetOf_SetViewport_top_not_8); |
| 697 COMPILE_ASSERT(offsetof(SetViewport, width) == 12, |
| 698 OffsetOf_SetViewport_width_not_12); |
| 699 COMPILE_ASSERT(offsetof(SetViewport, height) == 16, |
| 700 OffsetOf_SetViewport_height_not_16); |
| 701 COMPILE_ASSERT(offsetof(SetViewport, z_min) == 20, |
| 702 OffsetOf_SetViewport_z_min_not_20); |
| 703 COMPILE_ASSERT(offsetof(SetViewport, z_max) == 24, |
| 704 OffsetOf_SetViewport_z_max_not_24); |
| 705 |
| 706 struct CreateVertexBuffer { |
| 707 typedef CreateVertexBuffer ValueType; |
| 708 static const CommandId kCmdId = command_buffer::kCreateVertexBuffer; |
| 709 static const ArgFlags kArgFlags = kFixed; |
| 710 |
| 711 void SetHeader() { |
| 712 header.SetCmd<ValueType>(); |
| 713 } |
| 714 |
| 715 void Init(uint32 _id, uint32 _size, uint32 _flags) { |
| 716 SetHeader(); |
| 717 id = _id; |
| 718 size = _size; |
| 719 flags = _flags; |
| 720 } |
| 721 |
| 722 static void* Set(void* cmd, uint32 id, uint32 size, uint32 flags) { |
| 723 static_cast<ValueType*>(cmd)->Init(id, size, flags); |
| 724 return NextCmdAddress<ValueType>(cmd); |
| 725 } |
| 726 |
| 727 CommandHeader header; |
419 uint32 id; | 728 uint32 id; |
420 uint32 size; | 729 uint32 size; |
421 uint32 flags; | 730 uint32 flags; |
422 }; | 731 }; |
423 | 732 |
424 struct DESTROY_VERTEX_BUFFER { | 733 COMPILE_ASSERT(sizeof(CreateVertexBuffer) == 16, |
425 static const CommandId kCmdId = command_buffer::DESTROY_VERTEX_BUFFER; | 734 Sizeof_CreateVertexBuffer_is_not_16); |
426 static const ArgFlags kArgFlags = kFixed; | 735 COMPILE_ASSERT(offsetof(CreateVertexBuffer, header) == 0, |
427 uint32 id; | 736 OffsetOf_CreateVertexBuffer_header_not_0); |
428 }; | 737 COMPILE_ASSERT(offsetof(CreateVertexBuffer, id) == 4, |
429 | 738 OffsetOf_CreateVertexBuffer_id_not_4); |
430 struct SET_VERTEX_BUFFER_DATA_IMMEDIATE { | 739 COMPILE_ASSERT(offsetof(CreateVertexBuffer, size) == 8, |
431 static const CommandId kCmdId = command_buffer::SET_VERTEX_BUFFER_DATA_IMMEDIA
TE; | 740 OffsetOf_CreateVertexBuffer_size_not_8); |
| 741 COMPILE_ASSERT(offsetof(CreateVertexBuffer, flags) == 12, |
| 742 OffsetOf_CreateVertexBuffer_flags_not_12); |
| 743 |
| 744 struct DestroyVertexBuffer { |
| 745 typedef DestroyVertexBuffer ValueType; |
| 746 static const CommandId kCmdId = command_buffer::kDestroyVertexBuffer; |
| 747 static const ArgFlags kArgFlags = kFixed; |
| 748 |
| 749 void SetHeader() { |
| 750 header.SetCmd<ValueType>(); |
| 751 } |
| 752 |
| 753 void Init(uint32 _id) { |
| 754 SetHeader(); |
| 755 id = _id; |
| 756 } |
| 757 |
| 758 static void* Set(void* cmd, uint32 id) { |
| 759 static_cast<ValueType*>(cmd)->Init(id); |
| 760 return NextCmdAddress<ValueType>(cmd); |
| 761 } |
| 762 |
| 763 CommandHeader header; |
| 764 uint32 id; |
| 765 }; |
| 766 |
| 767 COMPILE_ASSERT(sizeof(DestroyVertexBuffer) == 8, |
| 768 Sizeof_DestroyVertexBuffer_is_not_8); |
| 769 COMPILE_ASSERT(offsetof(DestroyVertexBuffer, header) == 0, |
| 770 OffsetOf_DestroyVertexBuffer_header_not_0); |
| 771 COMPILE_ASSERT(offsetof(DestroyVertexBuffer, id) == 4, |
| 772 OffsetOf_DestroyVertexBuffer_id_not_4); |
| 773 |
| 774 struct SetVertexBufferDataImmediate { |
| 775 typedef SetVertexBufferDataImmediate ValueType; |
| 776 static const CommandId kCmdId = command_buffer::kSetVertexBufferDataImmediate; |
432 static const ArgFlags kArgFlags = kAtLeastN; | 777 static const ArgFlags kArgFlags = kAtLeastN; |
| 778 |
| 779 void SetHeader(uint32 size) { |
| 780 header.SetCmdBySize<ValueType>(size); |
| 781 } |
| 782 |
| 783 void Init(uint32 _id, uint32 _offset, const void* data, uint32 size) { |
| 784 SetHeader(size); |
| 785 id = _id; |
| 786 offset = _offset; |
| 787 memcpy(ImmediateDataAddress(this), data, size); |
| 788 } |
| 789 |
| 790 static void* Set(void* cmd, uint32 id, uint32 offset, |
| 791 const void* data, uint32 size) { |
| 792 static_cast<ValueType*>(cmd)->Init(id, offset, data, size); |
| 793 return NextImmediateCmdAddress<ValueType>(cmd, size); |
| 794 } |
| 795 |
| 796 CommandHeader header; |
433 uint32 id; | 797 uint32 id; |
434 uint32 offset; | 798 uint32 offset; |
435 }; | 799 }; |
436 | 800 |
437 struct SET_VERTEX_BUFFER_DATA { | 801 COMPILE_ASSERT(sizeof(SetVertexBufferDataImmediate) == 12, |
438 static const CommandId kCmdId = command_buffer::SET_VERTEX_BUFFER_DATA; | 802 Sizeof_SetVertexBufferDataImmediate_is_not_12); |
439 static const ArgFlags kArgFlags = kFixed; | 803 COMPILE_ASSERT(offsetof(SetVertexBufferDataImmediate, header) == 0, |
| 804 OffsetOf_SetVertexBufferDataImmediate_header_not_0); |
| 805 COMPILE_ASSERT(offsetof(SetVertexBufferDataImmediate, id) == 4, |
| 806 OffsetOf_SetVertexBufferDataImmediate_id_not_4); |
| 807 COMPILE_ASSERT(offsetof(SetVertexBufferDataImmediate, offset) == 8, |
| 808 OffsetOf_SetVertexBufferDataImmediate_offset_not_8); |
| 809 |
| 810 struct SetVertexBufferData { |
| 811 typedef SetVertexBufferData ValueType; |
| 812 static const CommandId kCmdId = command_buffer::kSetVertexBufferData; |
| 813 static const ArgFlags kArgFlags = kFixed; |
| 814 |
| 815 void SetHeader() { |
| 816 header.SetCmd<ValueType>(); |
| 817 } |
| 818 |
| 819 void Init(uint32 _id, uint32 _offset, uint32 _size, |
| 820 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 821 SetHeader(); |
| 822 id = _id; |
| 823 offset = _offset; |
| 824 size = _size; |
| 825 shared_memory.Init(shared_memory_id, shared_memory_offset); |
| 826 } |
| 827 |
| 828 static void* Set(void* cmd, uint32 id, uint32 offset, uint32 size, |
| 829 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 830 static_cast<ValueType*>(cmd)->Init(id, offset, size, |
| 831 shared_memory_id, shared_memory_offset); |
| 832 return NextCmdAddress<ValueType>(cmd); |
| 833 } |
| 834 |
| 835 CommandHeader header; |
440 uint32 id; | 836 uint32 id; |
441 uint32 offset; | 837 uint32 offset; |
442 uint32 size; | 838 uint32 size; |
443 SharedMemory shared_memory; | 839 SharedMemory shared_memory; |
444 }; | 840 }; |
445 | 841 |
446 struct GET_VERTEX_BUFFER_DATA { | 842 COMPILE_ASSERT(sizeof(SetVertexBufferData) == 24, |
447 static const CommandId kCmdId = command_buffer::GET_VERTEX_BUFFER_DATA; | 843 Sizeof_SetVertexBufferData_is_not_24); |
448 static const ArgFlags kArgFlags = kFixed; | 844 COMPILE_ASSERT(offsetof(SetVertexBufferData, header) == 0, |
| 845 OffsetOf_SetVertexBufferData_header_not_0); |
| 846 COMPILE_ASSERT(offsetof(SetVertexBufferData, id) == 4, |
| 847 OffsetOf_SetVertexBufferData_id_not_4); |
| 848 COMPILE_ASSERT(offsetof(SetVertexBufferData, offset) == 8, |
| 849 OffsetOf_SetVertexBufferData_offset_not_8); |
| 850 COMPILE_ASSERT(offsetof(SetVertexBufferData, size) == 12, |
| 851 OffsetOf_SetVertexBufferData_size_not_12); |
| 852 COMPILE_ASSERT(offsetof(SetVertexBufferData, shared_memory) == 16, |
| 853 OffsetOf_SetVertexBufferData_shared_memory_not_16); |
| 854 |
| 855 struct GetVertexBufferData { |
| 856 typedef GetVertexBufferData ValueType; |
| 857 static const CommandId kCmdId = command_buffer::kGetVertexBufferData; |
| 858 static const ArgFlags kArgFlags = kFixed; |
| 859 |
| 860 void SetHeader() { |
| 861 header.SetCmd<ValueType>(); |
| 862 } |
| 863 |
| 864 void Init(uint32 _id, uint32 _offset, uint32 _size, |
| 865 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 866 SetHeader(); |
| 867 id = _id; |
| 868 offset = _offset; |
| 869 size = _size; |
| 870 shared_memory.Init(shared_memory_id, shared_memory_offset); |
| 871 } |
| 872 |
| 873 static void* Set(void* cmd, uint32 id, uint32 offset, uint32 size, |
| 874 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 875 static_cast<ValueType*>(cmd)->Init(id, offset, size, |
| 876 shared_memory_id, shared_memory_offset); |
| 877 return NextCmdAddress<ValueType>(cmd); |
| 878 } |
| 879 |
| 880 CommandHeader header; |
449 uint32 id; | 881 uint32 id; |
450 uint32 offset; | 882 uint32 offset; |
451 uint32 size; | 883 uint32 size; |
452 SharedMemory shared_memory; | 884 SharedMemory shared_memory; |
453 }; | 885 }; |
454 | 886 |
455 struct CREATE_INDEX_BUFFER { | 887 COMPILE_ASSERT(sizeof(GetVertexBufferData) == 24, |
456 static const CommandId kCmdId = command_buffer::CREATE_INDEX_BUFFER; | 888 Sizeof_GetVertexBufferData_is_not_24); |
457 static const ArgFlags kArgFlags = kFixed; | 889 COMPILE_ASSERT(offsetof(GetVertexBufferData, header) == 0, |
| 890 OffsetOf_GetVertexBufferData_header_not_0); |
| 891 COMPILE_ASSERT(offsetof(GetVertexBufferData, id) == 4, |
| 892 OffsetOf_GetVertexBufferData_id_not_4); |
| 893 COMPILE_ASSERT(offsetof(GetVertexBufferData, offset) == 8, |
| 894 OffsetOf_GetVertexBufferData_offset_not_8); |
| 895 COMPILE_ASSERT(offsetof(GetVertexBufferData, size) == 12, |
| 896 OffsetOf_GetVertexBufferData_size_not_12); |
| 897 COMPILE_ASSERT(offsetof(GetVertexBufferData, shared_memory) == 16, |
| 898 OffsetOf_GetVertexBufferData_shared_memory_not_16); |
| 899 |
| 900 struct CreateIndexBuffer { |
| 901 typedef CreateIndexBuffer ValueType; |
| 902 static const CommandId kCmdId = command_buffer::kCreateIndexBuffer; |
| 903 static const ArgFlags kArgFlags = kFixed; |
| 904 |
| 905 void SetHeader() { |
| 906 header.SetCmd<ValueType>(); |
| 907 } |
| 908 |
| 909 void Init(uint32 _id, uint32 _size, uint32 _flags) { |
| 910 SetHeader(); |
| 911 id = _id; |
| 912 size = _size; |
| 913 flags = _flags; |
| 914 } |
| 915 |
| 916 static void* Set(void* cmd, uint32 id, uint32 size, uint32 flags) { |
| 917 static_cast<ValueType*>(cmd)->Init(id, size, flags); |
| 918 return NextCmdAddress<ValueType>(cmd); |
| 919 } |
| 920 |
| 921 CommandHeader header; |
458 uint32 id; | 922 uint32 id; |
459 uint32 size; | 923 uint32 size; |
460 uint32 flags; | 924 uint32 flags; |
461 }; | 925 }; |
462 | 926 |
463 struct DESTROY_INDEX_BUFFER { | 927 COMPILE_ASSERT(sizeof(CreateIndexBuffer) == 16, |
464 static const CommandId kCmdId = command_buffer::DESTROY_INDEX_BUFFER; | 928 Sizeof_CreateIndexBuffer_is_not_16); |
465 static const ArgFlags kArgFlags = kFixed; | 929 COMPILE_ASSERT(offsetof(CreateIndexBuffer, header) == 0, |
466 uint32 id; | 930 OffsetOf_CreateIndexBuffer_header_not_0); |
467 }; | 931 COMPILE_ASSERT(offsetof(CreateIndexBuffer, id) == 4, |
468 | 932 OffsetOf_CreateIndexBuffer_id_not_4); |
469 struct SET_INDEX_BUFFER_DATA_IMMEDIATE { | 933 COMPILE_ASSERT(offsetof(CreateIndexBuffer, size) == 8, |
470 static const CommandId kCmdId = command_buffer::SET_INDEX_BUFFER_DATA_IMMEDIAT
E; | 934 OffsetOf_CreateIndexBuffer_size_not_8); |
| 935 COMPILE_ASSERT(offsetof(CreateIndexBuffer, flags) == 12, |
| 936 OffsetOf_CreateIndexBuffer_flags_not_12); |
| 937 |
| 938 struct DestroyIndexBuffer { |
| 939 typedef DestroyIndexBuffer ValueType; |
| 940 static const CommandId kCmdId = command_buffer::kDestroyIndexBuffer; |
| 941 static const ArgFlags kArgFlags = kFixed; |
| 942 |
| 943 void SetHeader() { |
| 944 header.SetCmd<ValueType>(); |
| 945 } |
| 946 |
| 947 void Init(uint32 _id) { |
| 948 SetHeader(); |
| 949 id = _id; |
| 950 } |
| 951 |
| 952 static void* Set(void* cmd, uint32 id) { |
| 953 static_cast<ValueType*>(cmd)->Init(id); |
| 954 return NextCmdAddress<ValueType>(cmd); |
| 955 } |
| 956 |
| 957 CommandHeader header; |
| 958 uint32 id; |
| 959 }; |
| 960 |
| 961 COMPILE_ASSERT(sizeof(DestroyIndexBuffer) == 8, |
| 962 Sizeof_DestroyIndexBuffer_is_not_8); |
| 963 COMPILE_ASSERT(offsetof(DestroyIndexBuffer, header) == 0, |
| 964 OffsetOf_DestroyIndexBuffer_header_not_0); |
| 965 COMPILE_ASSERT(offsetof(DestroyIndexBuffer, id) == 4, |
| 966 OffsetOf_DestroyIndexBuffer_id_not_4); |
| 967 |
| 968 struct SetIndexBufferDataImmediate { |
| 969 typedef SetIndexBufferDataImmediate ValueType; |
| 970 static const CommandId kCmdId = command_buffer::kSetIndexBufferDataImmediate; |
471 static const ArgFlags kArgFlags = kAtLeastN; | 971 static const ArgFlags kArgFlags = kAtLeastN; |
| 972 |
| 973 void SetHeader(uint32 size) { |
| 974 header.SetCmdBySize<ValueType>(size); |
| 975 } |
| 976 |
| 977 void Init(uint32 _id, uint32 _offset, const void* data, uint32 size) { |
| 978 SetHeader(size); |
| 979 id = _id; |
| 980 offset = _offset; |
| 981 memcpy(ImmediateDataAddress(this), data, size); |
| 982 } |
| 983 |
| 984 static void* Set(void* cmd, uint32 id, uint32 offset, const void* data, |
| 985 uint32 size) { |
| 986 static_cast<ValueType*>(cmd)->Init(id, offset, data, size); |
| 987 return NextImmediateCmdAddress<ValueType>(cmd, size); |
| 988 } |
| 989 |
| 990 CommandHeader header; |
472 uint32 id; | 991 uint32 id; |
473 uint32 offset; | 992 uint32 offset; |
474 }; | 993 }; |
475 | 994 |
476 struct SET_INDEX_BUFFER_DATA { | 995 COMPILE_ASSERT(sizeof(SetIndexBufferDataImmediate) == 12, |
477 static const CommandId kCmdId = command_buffer::SET_INDEX_BUFFER_DATA; | 996 Sizeof_SetIndexBufferDataImmediate_is_not_12); |
478 static const ArgFlags kArgFlags = kFixed; | 997 COMPILE_ASSERT(offsetof(SetIndexBufferDataImmediate, header) == 0, |
| 998 OffsetOf_SetIndexBufferDataImmediate_header_not_0); |
| 999 COMPILE_ASSERT(offsetof(SetIndexBufferDataImmediate, id) == 4, |
| 1000 OffsetOf_SetIndexBufferDataImmediate_id_not_4); |
| 1001 COMPILE_ASSERT(offsetof(SetIndexBufferDataImmediate, offset) == 8, |
| 1002 OffsetOf_SetIndexBufferDataImmediate_offset_not_8); |
| 1003 |
| 1004 struct SetIndexBufferData { |
| 1005 typedef SetIndexBufferData ValueType; |
| 1006 static const CommandId kCmdId = command_buffer::kSetIndexBufferData; |
| 1007 static const ArgFlags kArgFlags = kFixed; |
| 1008 |
| 1009 void SetHeader() { |
| 1010 header.SetCmd<ValueType>(); |
| 1011 } |
| 1012 |
| 1013 void Init(uint32 _id, uint32 _offset, uint32 _size, |
| 1014 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 1015 SetHeader(); |
| 1016 id = _id; |
| 1017 offset = _offset; |
| 1018 size = _size; |
| 1019 shared_memory.Init(shared_memory_id, shared_memory_offset); |
| 1020 } |
| 1021 |
| 1022 static void* Set(void* cmd, uint32 id, uint32 offset, uint32 size, |
| 1023 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 1024 static_cast<ValueType*>(cmd)->Init(id, offset, size, |
| 1025 shared_memory_id, shared_memory_offset); |
| 1026 return NextCmdAddress<ValueType>(cmd); |
| 1027 } |
| 1028 |
| 1029 CommandHeader header; |
479 uint32 id; | 1030 uint32 id; |
480 uint32 offset; | 1031 uint32 offset; |
481 uint32 size; | 1032 uint32 size; |
482 SharedMemory shared_memory; | 1033 SharedMemory shared_memory; |
483 }; | 1034 }; |
484 | 1035 |
485 struct GET_INDEX_BUFFER_DATA { | 1036 COMPILE_ASSERT(sizeof(SetIndexBufferData) == 24, |
486 static const CommandId kCmdId = command_buffer::GET_INDEX_BUFFER_DATA; | 1037 Sizeof_SetIndexBufferData_is_not_24); |
487 static const ArgFlags kArgFlags = kFixed; | 1038 COMPILE_ASSERT(offsetof(SetIndexBufferData, header) == 0, |
| 1039 OffsetOf_SetIndexBufferData_header_not_0); |
| 1040 COMPILE_ASSERT(offsetof(SetIndexBufferData, id) == 4, |
| 1041 OffsetOf_SetIndexBufferData_id_not_4); |
| 1042 COMPILE_ASSERT(offsetof(SetIndexBufferData, offset) == 8, |
| 1043 OffsetOf_SetIndexBufferData_offset_not_8); |
| 1044 COMPILE_ASSERT(offsetof(SetIndexBufferData, size) == 12, |
| 1045 OffsetOf_SetIndexBufferData_size_not_12); |
| 1046 COMPILE_ASSERT(offsetof(SetIndexBufferData, shared_memory) == 16, |
| 1047 OffsetOf_SetIndexBufferData_shared_memory_not_16); |
| 1048 |
| 1049 struct GetIndexBufferData { |
| 1050 typedef GetIndexBufferData ValueType; |
| 1051 static const CommandId kCmdId = command_buffer::kGetIndexBufferData; |
| 1052 static const ArgFlags kArgFlags = kFixed; |
| 1053 |
| 1054 void SetHeader() { |
| 1055 header.SetCmd<ValueType>(); |
| 1056 } |
| 1057 |
| 1058 void Init(uint32 _id, uint32 _offset, uint32 _size, |
| 1059 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 1060 SetHeader(); |
| 1061 id = _id; |
| 1062 offset = _offset; |
| 1063 size = _size; |
| 1064 shared_memory.Init(shared_memory_id, shared_memory_offset); |
| 1065 } |
| 1066 |
| 1067 static void* Set(void* cmd, uint32 id, uint32 offset, uint32 size, |
| 1068 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 1069 static_cast<ValueType*>(cmd)->Init(id, offset, size, |
| 1070 shared_memory_id, shared_memory_offset); |
| 1071 return NextCmdAddress<ValueType>(cmd); |
| 1072 } |
| 1073 |
| 1074 CommandHeader header; |
488 uint32 id; | 1075 uint32 id; |
489 uint32 offset; | 1076 uint32 offset; |
490 uint32 size; | 1077 uint32 size; |
491 SharedMemory shared_memory; | 1078 SharedMemory shared_memory; |
492 }; | 1079 }; |
493 | 1080 |
494 struct CREATE_VERTEX_STRUCT { | 1081 COMPILE_ASSERT(sizeof(GetIndexBufferData) == 24, |
495 static const CommandId kCmdId = command_buffer::CREATE_VERTEX_STRUCT; | 1082 Sizeof_GetIndexBufferData_is_not_24); |
496 static const ArgFlags kArgFlags = kFixed; | 1083 COMPILE_ASSERT(offsetof(GetIndexBufferData, header) == 0, |
| 1084 OffsetOf_GetIndexBufferData_header_not_0); |
| 1085 COMPILE_ASSERT(offsetof(GetIndexBufferData, id) == 4, |
| 1086 OffsetOf_GetIndexBufferData_id_not_4); |
| 1087 COMPILE_ASSERT(offsetof(GetIndexBufferData, offset) == 8, |
| 1088 OffsetOf_GetIndexBufferData_offset_not_8); |
| 1089 COMPILE_ASSERT(offsetof(GetIndexBufferData, size) == 12, |
| 1090 OffsetOf_GetIndexBufferData_size_not_12); |
| 1091 COMPILE_ASSERT(offsetof(GetIndexBufferData, shared_memory) == 16, |
| 1092 OffsetOf_GetIndexBufferData_shared_memory_not_16); |
| 1093 |
| 1094 struct CreateVertexStruct { |
| 1095 typedef CreateVertexStruct ValueType; |
| 1096 static const CommandId kCmdId = command_buffer::kCreateVertexStruct; |
| 1097 static const ArgFlags kArgFlags = kFixed; |
| 1098 |
| 1099 void SetHeader() { |
| 1100 header.SetCmd<ValueType>(); |
| 1101 } |
| 1102 |
| 1103 void Init(uint32 _id, uint32 _input_count) { |
| 1104 SetHeader(); |
| 1105 id = _id; |
| 1106 input_count = _input_count; |
| 1107 } |
| 1108 |
| 1109 static void* Set(void* cmd, uint32 id, uint32 input_count) { |
| 1110 static_cast<ValueType*>(cmd)->Init(id, input_count); |
| 1111 return NextCmdAddress<ValueType>(cmd); |
| 1112 } |
| 1113 |
| 1114 CommandHeader header; |
497 uint32 id; | 1115 uint32 id; |
498 uint32 input_count; | 1116 uint32 input_count; |
499 }; | 1117 }; |
500 | 1118 |
501 struct DESTROY_VERTEX_STRUCT { | 1119 COMPILE_ASSERT(sizeof(CreateVertexStruct) == 12, |
502 static const CommandId kCmdId = command_buffer::DESTROY_VERTEX_STRUCT; | 1120 Sizeof_CreateVertexStruct_is_not_12); |
503 static const ArgFlags kArgFlags = kFixed; | 1121 COMPILE_ASSERT(offsetof(CreateVertexStruct, header) == 0, |
504 uint32 id; | 1122 OffsetOf_CreateVertexStruct_header_not_0); |
505 }; | 1123 COMPILE_ASSERT(offsetof(CreateVertexStruct, id) == 4, |
506 | 1124 OffsetOf_CreateVertexStruct_id_not_4); |
507 struct SET_VERTEX_INPUT { | 1125 COMPILE_ASSERT(offsetof(CreateVertexStruct, input_count) == 8, |
508 static const CommandId kCmdId = command_buffer::SET_VERTEX_INPUT; | 1126 OffsetOf_CreateVertexStruct_input_count_not_8); |
509 static const ArgFlags kArgFlags = kAtLeastN; | 1127 |
510 }; | 1128 struct DestroyVertexStruct { |
511 | 1129 typedef DestroyVertexStruct ValueType; |
512 struct SET_VERTEX_STRUCT { | 1130 static const CommandId kCmdId = command_buffer::kDestroyVertexStruct; |
513 static const CommandId kCmdId = command_buffer::SET_VERTEX_STRUCT; | 1131 static const ArgFlags kArgFlags = kFixed; |
514 static const ArgFlags kArgFlags = kFixed; | 1132 |
515 uint32 id; | 1133 void SetHeader() { |
516 }; | 1134 header.SetCmd<ValueType>(); |
517 | 1135 } |
518 struct DRAW { | 1136 |
519 static const CommandId kCmdId = command_buffer::DRAW; | 1137 void Init(uint32 _id) { |
520 static const ArgFlags kArgFlags = kFixed; | 1138 SetHeader(); |
| 1139 id = _id; |
| 1140 } |
| 1141 |
| 1142 static void* Set(void* cmd, uint32 id) { |
| 1143 static_cast<ValueType*>(cmd)->Init(id); |
| 1144 return NextCmdAddress<ValueType>(cmd); |
| 1145 } |
| 1146 |
| 1147 CommandHeader header; |
| 1148 uint32 id; |
| 1149 }; |
| 1150 |
| 1151 COMPILE_ASSERT(sizeof(DestroyVertexStruct) == 8, |
| 1152 Sizeof_DestroyVertexStruct_is_not_8); |
| 1153 COMPILE_ASSERT(offsetof(DestroyVertexStruct, header) == 0, |
| 1154 OffsetOf_DestroyVertexStruct_header_not_0); |
| 1155 COMPILE_ASSERT(offsetof(DestroyVertexStruct, id) == 4, |
| 1156 OffsetOf_DestroyVertexStruct_id_not_4); |
| 1157 |
| 1158 struct SetVertexInput { |
| 1159 typedef SetVertexInput ValueType; |
| 1160 static const CommandId kCmdId = command_buffer::kSetVertexInput; |
| 1161 static const ArgFlags kArgFlags = kFixed; |
| 1162 |
| 1163 void SetHeader() { |
| 1164 header.SetCmd<ValueType>(); |
| 1165 } |
| 1166 |
| 1167 void Init(uint32 _vertex_struct_id, |
| 1168 uint32 _input_index, |
| 1169 uint32 _vertex_buffer_id, |
| 1170 uint32 _offset, |
| 1171 uint8 _semantic, |
| 1172 uint32 _semantic_index, |
| 1173 uint8 _type, |
| 1174 uint32 _stride) { |
| 1175 SetHeader(); |
| 1176 vertex_struct_id = _vertex_struct_id; |
| 1177 input_index = _input_index; |
| 1178 vertex_buffer_id = _vertex_buffer_id; |
| 1179 offset = _offset; |
| 1180 fixme4 = |
| 1181 set_vertex_input_cmd::Semantic::MakeValue(_semantic) | |
| 1182 set_vertex_input_cmd::SemanticIndex::MakeValue(_semantic_index) | |
| 1183 set_vertex_input_cmd::Type::MakeValue(_type) | |
| 1184 set_vertex_input_cmd::Stride::MakeValue(_stride); |
| 1185 } |
| 1186 |
| 1187 static void* Set( |
| 1188 void* cmd, |
| 1189 uint32 vertex_struct_id, |
| 1190 uint32 input_index, |
| 1191 uint32 vertex_buffer_id, |
| 1192 uint32 offset, |
| 1193 uint8 semantic, |
| 1194 uint32 semantic_index, |
| 1195 uint8 type, |
| 1196 uint32 stride) { |
| 1197 static_cast<ValueType*>(cmd)->Init( |
| 1198 vertex_struct_id, |
| 1199 input_index, |
| 1200 vertex_buffer_id, |
| 1201 offset, |
| 1202 semantic, |
| 1203 semantic_index, |
| 1204 type, |
| 1205 stride); |
| 1206 return NextCmdAddress<ValueType>(cmd); |
| 1207 } |
| 1208 |
| 1209 CommandHeader header; |
| 1210 uint32 vertex_struct_id; |
| 1211 uint32 input_index; |
| 1212 uint32 vertex_buffer_id; |
| 1213 uint32 offset; |
| 1214 uint32 fixme4; |
| 1215 }; |
| 1216 |
| 1217 COMPILE_ASSERT(sizeof(SetVertexInput) == 24, |
| 1218 Sizeof_SetVertexInput_is_not_24); |
| 1219 COMPILE_ASSERT(offsetof(SetVertexInput, header) == 0, |
| 1220 OffsetOf_SetVertexInput_header_not_0); |
| 1221 COMPILE_ASSERT(offsetof(SetVertexInput, vertex_struct_id) == 4, |
| 1222 OffsetOf_SetVertexInput_vertex_struct_id_not_4); |
| 1223 COMPILE_ASSERT(offsetof(SetVertexInput, input_index) == 8, |
| 1224 OffsetOf_SetVertexInput_input_index_not_8); |
| 1225 COMPILE_ASSERT(offsetof(SetVertexInput, vertex_buffer_id) == 12, |
| 1226 OffsetOf_SetVertexInput_vertex_buffer_id_not_12); |
| 1227 COMPILE_ASSERT(offsetof(SetVertexInput, offset) == 16, |
| 1228 OffsetOf_SetVertexInput_offset_not_16); |
| 1229 COMPILE_ASSERT(offsetof(SetVertexInput, fixme4) == 20, |
| 1230 OffsetOf_SetVertexInput_fixme4_not_20); |
| 1231 |
| 1232 struct SetVertexStruct { |
| 1233 typedef SetVertexStruct ValueType; |
| 1234 static const CommandId kCmdId = command_buffer::kSetVertexStruct; |
| 1235 static const ArgFlags kArgFlags = kFixed; |
| 1236 |
| 1237 void SetHeader() { |
| 1238 header.SetCmd<ValueType>(); |
| 1239 } |
| 1240 |
| 1241 void Init(uint32 _id) { |
| 1242 SetHeader(); |
| 1243 id = _id; |
| 1244 } |
| 1245 |
| 1246 static void* Set(void* cmd, uint32 id) { |
| 1247 static_cast<ValueType*>(cmd)->Init(id); |
| 1248 return NextCmdAddress<ValueType>(cmd); |
| 1249 } |
| 1250 |
| 1251 CommandHeader header; |
| 1252 uint32 id; |
| 1253 }; |
| 1254 |
| 1255 COMPILE_ASSERT(sizeof(SetVertexStruct) == 8, |
| 1256 Sizeof_SetVertexStruct_is_not_8); |
| 1257 COMPILE_ASSERT(offsetof(SetVertexStruct, header) == 0, |
| 1258 OffsetOf_SetVertexStruct_header_not_0); |
| 1259 COMPILE_ASSERT(offsetof(SetVertexStruct, id) == 4, |
| 1260 OffsetOf_SetVertexStruct_id_not_4); |
| 1261 |
| 1262 struct Draw { |
| 1263 typedef Draw ValueType; |
| 1264 static const CommandId kCmdId = command_buffer::kDraw; |
| 1265 static const ArgFlags kArgFlags = kFixed; |
| 1266 |
| 1267 void SetHeader() { |
| 1268 header.SetCmd<ValueType>(); |
| 1269 } |
| 1270 |
| 1271 void Init(uint32 _primitive_type, uint32 _first, uint32 _count) { |
| 1272 SetHeader(); |
| 1273 primitive_type = _primitive_type; |
| 1274 first = _first; |
| 1275 count = _count; |
| 1276 } |
| 1277 |
| 1278 static void* Set(void* cmd, uint32 primitive_type, uint32 first, |
| 1279 uint32 count) { |
| 1280 static_cast<ValueType*>(cmd)->Init(primitive_type, first, count); |
| 1281 return NextCmdAddress<ValueType>(cmd); |
| 1282 } |
| 1283 |
| 1284 CommandHeader header; |
521 uint32 primitive_type; | 1285 uint32 primitive_type; |
522 uint32 first; | 1286 uint32 first; |
523 uint32 count; | 1287 uint32 count; |
524 }; | 1288 }; |
525 | 1289 |
526 struct DRAW_INDEXED { | 1290 COMPILE_ASSERT(sizeof(Draw) == 16, Sizeof_DRAW_is_not_16); |
527 static const CommandId kCmdId = command_buffer::DRAW_INDEXED; | 1291 COMPILE_ASSERT(offsetof(Draw, header) == 0, |
528 static const ArgFlags kArgFlags = kFixed; | 1292 OffsetOf_Draw_header_not_0); |
| 1293 COMPILE_ASSERT(offsetof(Draw, primitive_type) == 4, |
| 1294 OffsetOf_Draw_primitive_type_not_4); |
| 1295 COMPILE_ASSERT(offsetof(Draw, first) == 8, |
| 1296 OffsetOf_Draw_first_not_8); |
| 1297 COMPILE_ASSERT(offsetof(Draw, count) == 12, |
| 1298 OffsetOf_Draw_count_not_12); |
| 1299 |
| 1300 struct DrawIndexed { |
| 1301 typedef DrawIndexed ValueType; |
| 1302 static const CommandId kCmdId = command_buffer::kDrawIndexed; |
| 1303 static const ArgFlags kArgFlags = kFixed; |
| 1304 |
| 1305 void SetHeader() { |
| 1306 header.SetCmd<ValueType>(); |
| 1307 } |
| 1308 |
| 1309 void Init( |
| 1310 uint32 _primitive_type, |
| 1311 uint32 _index_buffer_id, |
| 1312 uint32 _first, |
| 1313 uint32 _count, |
| 1314 uint32 _min_index, |
| 1315 uint32 _max_index) { |
| 1316 SetHeader(); |
| 1317 primitive_type = _primitive_type; |
| 1318 index_buffer_id = _index_buffer_id; |
| 1319 first = _first; |
| 1320 count = _count; |
| 1321 min_index = _min_index; |
| 1322 max_index = _max_index; |
| 1323 } |
| 1324 |
| 1325 static void* Set(void* cmd, |
| 1326 uint32 primitive_type, |
| 1327 uint32 index_buffer_id, |
| 1328 uint32 first, |
| 1329 uint32 count, |
| 1330 uint32 min_index, |
| 1331 uint32 max_index) { |
| 1332 static_cast<ValueType*>(cmd)->Init( |
| 1333 primitive_type, |
| 1334 index_buffer_id, |
| 1335 first, |
| 1336 count, |
| 1337 min_index, |
| 1338 max_index); |
| 1339 return NextCmdAddress<ValueType>(cmd); |
| 1340 } |
| 1341 |
| 1342 CommandHeader header; |
529 uint32 primitive_type; | 1343 uint32 primitive_type; |
530 uint32 index_buffer_id; | 1344 uint32 index_buffer_id; |
531 uint32 first; | 1345 uint32 first; |
532 uint32 count; | 1346 uint32 count; |
533 uint32 min_index; | 1347 uint32 min_index; |
534 uint32 max_index; | 1348 uint32 max_index; |
535 }; | 1349 }; |
536 | 1350 |
537 struct CREATE_EFFECT { | 1351 COMPILE_ASSERT(sizeof(DrawIndexed) == 28, Sizeof_DrawIndexed_is_not_28); |
538 static const CommandId kCmdId = command_buffer::CREATE_EFFECT; | 1352 COMPILE_ASSERT(offsetof(DrawIndexed, header) == 0, |
539 static const ArgFlags kArgFlags = kFixed; | 1353 OffsetOf_DrawIndexed_header_not_0); |
| 1354 COMPILE_ASSERT(offsetof(DrawIndexed, primitive_type) == 4, |
| 1355 OffsetOf_DrawIndexed_primitive_type_not_4); |
| 1356 COMPILE_ASSERT(offsetof(DrawIndexed, index_buffer_id) == 8, |
| 1357 OffsetOf_DrawIndexed_index_buffer_id_not_8); |
| 1358 COMPILE_ASSERT(offsetof(DrawIndexed, first) == 12, |
| 1359 OffsetOf_DrawIndexed_first_not_12); |
| 1360 COMPILE_ASSERT(offsetof(DrawIndexed, count) == 16, |
| 1361 OffsetOf_DrawIndexed_count_not_16); |
| 1362 COMPILE_ASSERT(offsetof(DrawIndexed, min_index) == 20, |
| 1363 OffsetOf_DrawIndexed_min_index_not_20); |
| 1364 COMPILE_ASSERT(offsetof(DrawIndexed, max_index) == 24, |
| 1365 OffsetOf_DrawIndexed_max_index_not_24); |
| 1366 |
| 1367 struct CreateEffect { |
| 1368 typedef CreateEffect ValueType; |
| 1369 static const CommandId kCmdId = command_buffer::kCreateEffect; |
| 1370 static const ArgFlags kArgFlags = kFixed; |
| 1371 |
| 1372 void SetHeader() { |
| 1373 header.SetCmd<ValueType>(); |
| 1374 } |
| 1375 |
| 1376 void Init(uint32 _id, uint32 _size, |
| 1377 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 1378 SetHeader(); |
| 1379 id = _id; |
| 1380 size = _size; |
| 1381 shared_memory.Init(shared_memory_id, shared_memory_offset); |
| 1382 } |
| 1383 |
| 1384 static void* Set(void* cmd, uint32 id, uint32 size, |
| 1385 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 1386 static_cast<ValueType*>(cmd)->Init(id, size, |
| 1387 shared_memory_id, shared_memory_offset); |
| 1388 return NextCmdAddress<ValueType>(cmd); |
| 1389 } |
| 1390 |
| 1391 CommandHeader header; |
540 uint32 id; | 1392 uint32 id; |
541 uint32 size; | 1393 uint32 size; |
542 SharedMemory shared_memory; | 1394 SharedMemory shared_memory; |
543 }; | 1395 }; |
544 | 1396 |
545 struct CREATE_EFFECT_IMMEDIATE { | 1397 COMPILE_ASSERT(sizeof(CreateEffect) == 20, Sizeof_CreateEffect_is_not_20); |
546 static const CommandId kCmdId = command_buffer::CREATE_EFFECT_IMMEDIATE; | 1398 COMPILE_ASSERT(offsetof(CreateEffect, header) == 0, |
| 1399 OffsetOf_CreateEffect_header_not_0); |
| 1400 COMPILE_ASSERT(offsetof(CreateEffect, id) == 4, |
| 1401 OffsetOf_CreateEffect_id_not_4); |
| 1402 COMPILE_ASSERT(offsetof(CreateEffect, size) == 8, |
| 1403 OffsetOf_CreateEffect_size_not_8); |
| 1404 COMPILE_ASSERT(offsetof(CreateEffect, shared_memory) == 12, |
| 1405 OffsetOf_CreateEffect_shared_memory_not_12); |
| 1406 |
| 1407 struct CreateEffectImmediate { |
| 1408 typedef CreateEffectImmediate ValueType; |
| 1409 static const CommandId kCmdId = command_buffer::kCreateEffectImmediate; |
547 static const ArgFlags kArgFlags = kAtLeastN; | 1410 static const ArgFlags kArgFlags = kAtLeastN; |
| 1411 |
| 1412 void SetHeader(uint32 size) { |
| 1413 header.SetCmdBySize<ValueType>(size); |
| 1414 } |
| 1415 |
| 1416 void Init(uint32 _id, uint32 _size, const void* data) { |
| 1417 SetHeader(_size); |
| 1418 id = _id; |
| 1419 size = _size; |
| 1420 } |
| 1421 |
| 1422 static void* Set(void* cmd, uint32 id, uint32 size, const void* data) { |
| 1423 static_cast<ValueType*>(cmd)->Init(id, size, data); |
| 1424 return NextImmediateCmdAddress<ValueType>(cmd, size); |
| 1425 } |
| 1426 |
| 1427 CommandHeader header; |
548 uint32 id; | 1428 uint32 id; |
549 uint32 size; | 1429 uint32 size; |
550 }; | 1430 }; |
551 | 1431 |
552 struct DESTROY_EFFECT { | 1432 COMPILE_ASSERT(sizeof(CreateEffectImmediate) == 12, |
553 static const CommandId kCmdId = command_buffer::DESTROY_EFFECT; | 1433 Sizeof_CreateEffectImmediate_is_not_12); |
554 static const ArgFlags kArgFlags = kFixed; | 1434 COMPILE_ASSERT(offsetof(CreateEffectImmediate, header) == 0, |
555 uint32 id; | 1435 OffsetOf_CreateEffectImmediate_header_not_0); |
556 }; | 1436 COMPILE_ASSERT(offsetof(CreateEffectImmediate, id) == 4, |
557 | 1437 OffsetOf_CreateEffectImmediate_id_not_4); |
558 struct SET_EFFECT { | 1438 COMPILE_ASSERT(offsetof(CreateEffectImmediate, size) == 8, |
559 static const CommandId kCmdId = command_buffer::SET_EFFECT; | 1439 OffsetOf_CreateEffectImmediate_size_not_8); |
560 static const ArgFlags kArgFlags = kFixed; | 1440 |
561 uint32 id; | 1441 struct DestroyEffect { |
562 }; | 1442 typedef DestroyEffect ValueType; |
563 | 1443 static const CommandId kCmdId = command_buffer::kDestroyEffect; |
564 struct GET_PARAM_COUNT { | 1444 static const ArgFlags kArgFlags = kFixed; |
565 static const CommandId kCmdId = command_buffer::GET_PARAM_COUNT; | 1445 |
566 static const ArgFlags kArgFlags = kFixed; | 1446 void SetHeader() { |
| 1447 header.SetCmd<ValueType>(); |
| 1448 } |
| 1449 |
| 1450 void Init(uint32 _id) { |
| 1451 SetHeader(); |
| 1452 id = _id; |
| 1453 } |
| 1454 |
| 1455 static void* Set(void* cmd, uint32 id) { |
| 1456 static_cast<ValueType*>(cmd)->Init(id); |
| 1457 return NextCmdAddress<ValueType>(cmd); |
| 1458 } |
| 1459 |
| 1460 CommandHeader header; |
| 1461 uint32 id; |
| 1462 }; |
| 1463 |
| 1464 COMPILE_ASSERT(sizeof(DestroyEffect) == 8, Sizeof_DestroyEffect_is_not_8); |
| 1465 COMPILE_ASSERT(offsetof(DestroyEffect, header) == 0, |
| 1466 OffsetOf_DestroyEffect_header_not_0); |
| 1467 COMPILE_ASSERT(offsetof(DestroyEffect, id) == 4, |
| 1468 OffsetOf_DestroyEffect_id_not_4); |
| 1469 |
| 1470 struct SetEffect { |
| 1471 typedef SetEffect ValueType; |
| 1472 static const CommandId kCmdId = command_buffer::kSetEffect; |
| 1473 static const ArgFlags kArgFlags = kFixed; |
| 1474 |
| 1475 void SetHeader() { |
| 1476 header.SetCmd<ValueType>(); |
| 1477 } |
| 1478 |
| 1479 void Init(uint32 _id) { |
| 1480 SetHeader(); |
| 1481 id = _id; |
| 1482 } |
| 1483 |
| 1484 static void* Set(void* cmd, uint32 id) { |
| 1485 static_cast<ValueType*>(cmd)->Init(id); |
| 1486 return NextCmdAddress<ValueType>(cmd); |
| 1487 } |
| 1488 |
| 1489 CommandHeader header; |
| 1490 uint32 id; |
| 1491 }; |
| 1492 |
| 1493 COMPILE_ASSERT(sizeof(SetEffect) == 8, Sizeof_SetEffect_is_not_8); |
| 1494 COMPILE_ASSERT(offsetof(SetEffect, header) == 0, |
| 1495 OffsetOf_SetEffect_header_not_0); |
| 1496 COMPILE_ASSERT(offsetof(SetEffect, id) == 4, |
| 1497 OffsetOf_SetEffect_id_not_4); |
| 1498 |
| 1499 struct GetParamCount { |
| 1500 typedef GetParamCount ValueType; |
| 1501 static const CommandId kCmdId = command_buffer::kGetParamCount; |
| 1502 static const ArgFlags kArgFlags = kFixed; |
| 1503 |
| 1504 void SetHeader() { |
| 1505 header.SetCmd<ValueType>(); |
| 1506 } |
| 1507 |
| 1508 void Init(uint32 _id, uint32 _size, |
| 1509 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 1510 SetHeader(); |
| 1511 id = _id; |
| 1512 size = _size; |
| 1513 shared_memory.Init(shared_memory_id, shared_memory_offset); |
| 1514 } |
| 1515 |
| 1516 static void* Set(void* cmd, uint32 id, uint32 size, |
| 1517 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 1518 static_cast<ValueType*>(cmd)->Init(id, size, |
| 1519 shared_memory_id, shared_memory_offset); |
| 1520 return NextCmdAddress<ValueType>(cmd); |
| 1521 } |
| 1522 |
| 1523 CommandHeader header; |
567 uint32 id; | 1524 uint32 id; |
568 uint32 size; | 1525 uint32 size; |
569 SharedMemory shared_memory; | 1526 SharedMemory shared_memory; |
570 }; | 1527 }; |
571 | 1528 |
572 struct CREATE_PARAM { | 1529 COMPILE_ASSERT(sizeof(GetParamCount) == 20, Sizeof_GetParamCount_is_not_20); |
573 static const CommandId kCmdId = command_buffer::CREATE_PARAM; | 1530 COMPILE_ASSERT(offsetof(GetParamCount, header) == 0, |
574 static const ArgFlags kArgFlags = kFixed; | 1531 OffsetOf_GetParamCount_header_not_0); |
| 1532 COMPILE_ASSERT(offsetof(GetParamCount, id) == 4, |
| 1533 OffsetOf_GetParamCount_id_not_4); |
| 1534 COMPILE_ASSERT(offsetof(GetParamCount, size) == 8, |
| 1535 OffsetOf_GetParamCount_size_not_8); |
| 1536 COMPILE_ASSERT(offsetof(GetParamCount, shared_memory) == 12, |
| 1537 OffsetOf_GetParamCount_shared_memory_not_12); |
| 1538 |
| 1539 struct CreateParam { |
| 1540 typedef CreateParam ValueType; |
| 1541 static const CommandId kCmdId = command_buffer::kCreateParam; |
| 1542 static const ArgFlags kArgFlags = kFixed; |
| 1543 |
| 1544 void SetHeader() { |
| 1545 header.SetCmd<ValueType>(); |
| 1546 } |
| 1547 |
| 1548 void Init(uint32 _param_id, uint32 _effect_id, uint32 _index) { |
| 1549 SetHeader(); |
| 1550 param_id = _param_id; |
| 1551 effect_id = _effect_id; |
| 1552 index = _index; |
| 1553 } |
| 1554 |
| 1555 static void* Set(void* cmd, |
| 1556 uint32 param_id, uint32 effect_id, uint32 index) { |
| 1557 static_cast<ValueType*>(cmd)->Init(param_id, effect_id, index); |
| 1558 return NextCmdAddress<ValueType>(cmd); |
| 1559 } |
| 1560 |
| 1561 CommandHeader header; |
575 uint32 param_id; | 1562 uint32 param_id; |
576 uint32 effect_id; | 1563 uint32 effect_id; |
577 uint32 index; | 1564 uint32 index; |
578 }; | 1565 }; |
579 | 1566 |
580 struct CREATE_PARAM_BY_NAME { | 1567 COMPILE_ASSERT(sizeof(CreateParam) == 16, Sizeof_CreateParam_is_not_16); |
581 static const CommandId kCmdId = command_buffer::CREATE_PARAM_BY_NAME; | 1568 COMPILE_ASSERT(offsetof(CreateParam, header) == 0, |
582 static const ArgFlags kArgFlags = kFixed; | 1569 OffsetOf_CreateParam_header_not_0); |
| 1570 COMPILE_ASSERT(offsetof(CreateParam, param_id) == 4, |
| 1571 OffsetOf_CreateParam_param_id_not_4); |
| 1572 COMPILE_ASSERT(offsetof(CreateParam, effect_id) == 8, |
| 1573 OffsetOf_CreateParam_effect_id_not_8); |
| 1574 COMPILE_ASSERT(offsetof(CreateParam, index) == 12, |
| 1575 OffsetOf_CreateParam_index_not_12); |
| 1576 |
| 1577 struct CreateParamByName { |
| 1578 typedef CreateParamByName ValueType; |
| 1579 static const CommandId kCmdId = command_buffer::kCreateParamByName; |
| 1580 static const ArgFlags kArgFlags = kFixed; |
| 1581 |
| 1582 void SetHeader() { |
| 1583 header.SetCmd<ValueType>(); |
| 1584 } |
| 1585 |
| 1586 void Init(uint32 _param_id, uint32 _effect_id, uint32 _size, |
| 1587 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 1588 SetHeader(); |
| 1589 param_id = _param_id; |
| 1590 effect_id = _effect_id; |
| 1591 size = _size; |
| 1592 shared_memory.Init(shared_memory_id, shared_memory_offset); |
| 1593 } |
| 1594 |
| 1595 static void* Set(void* cmd, uint32 param_id, uint32 effect_id, uint32 size, |
| 1596 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 1597 static_cast<ValueType*>(cmd)->Init(param_id, effect_id, size, |
| 1598 shared_memory_id, shared_memory_offset); |
| 1599 return NextCmdAddress<ValueType>(cmd); |
| 1600 } |
| 1601 |
| 1602 CommandHeader header; |
583 uint32 param_id; | 1603 uint32 param_id; |
584 uint32 effect_id; | 1604 uint32 effect_id; |
585 uint32 size; | 1605 uint32 size; |
586 SharedMemory shared_memory; | 1606 SharedMemory shared_memory; |
587 }; | 1607 }; |
588 | 1608 |
589 struct CREATE_PARAM_BY_NAME_IMMEDIATE { | 1609 COMPILE_ASSERT(sizeof(CreateParamByName) == 24, |
590 static const CommandId kCmdId = command_buffer::CREATE_PARAM_BY_NAME_IMMEDIATE
; | 1610 Sizeof_CreateParamByName_is_not_24); |
| 1611 COMPILE_ASSERT(offsetof(CreateParamByName, header) == 0, |
| 1612 OffsetOf_CreateParamByName_header_not_0); |
| 1613 COMPILE_ASSERT(offsetof(CreateParamByName, param_id) == 4, |
| 1614 OffsetOf_CreateParamByName_param_id_not_4); |
| 1615 COMPILE_ASSERT(offsetof(CreateParamByName, effect_id) == 8, |
| 1616 OffsetOf_CreateParamByName_effect_id_not_8); |
| 1617 COMPILE_ASSERT(offsetof(CreateParamByName, size) == 12, |
| 1618 OffsetOf_CreateParamByName_size_not_12); |
| 1619 COMPILE_ASSERT(offsetof(CreateParamByName, shared_memory) == 16, |
| 1620 OffsetOf_CreateParamByName_shared_memory_not_16); |
| 1621 |
| 1622 struct CreateParamByNameImmediate { |
| 1623 typedef CreateParamByNameImmediate ValueType; |
| 1624 static const CommandId kCmdId = command_buffer::kCreateParamByNameImmediate; |
591 static const ArgFlags kArgFlags = kAtLeastN; | 1625 static const ArgFlags kArgFlags = kAtLeastN; |
| 1626 |
| 1627 void SetHeader(uint32 size) { |
| 1628 header.SetCmdBySize<ValueType>(size); |
| 1629 } |
| 1630 |
| 1631 void Init(uint32 _param_id, uint32 _effect_id, uint32 _size, |
| 1632 const void* data) { |
| 1633 SetHeader(_size); |
| 1634 param_id = _param_id; |
| 1635 effect_id = _effect_id; |
| 1636 size = _size; |
| 1637 memcpy(ImmediateDataAddress(this), data, _size); |
| 1638 } |
| 1639 |
| 1640 static void* Set(void* cmd, uint32 param_id, uint32 effect_id, uint32 size, |
| 1641 const void* data) { |
| 1642 static_cast<ValueType*>(cmd)->Init(param_id, effect_id, size, data); |
| 1643 return NextImmediateCmdAddress<ValueType>(cmd, size); |
| 1644 } |
| 1645 |
| 1646 CommandHeader header; |
592 uint32 param_id; | 1647 uint32 param_id; |
593 uint32 effect_id; | 1648 uint32 effect_id; |
594 uint32 size; | 1649 uint32 size; |
595 }; | 1650 }; |
596 | 1651 |
597 struct DESTROY_PARAM { | 1652 COMPILE_ASSERT(sizeof(CreateParamByNameImmediate) == 16, |
598 static const CommandId kCmdId = command_buffer::DESTROY_PARAM; | 1653 Sizeof_CreateParamByNameImmediate_is_not_16); |
599 static const ArgFlags kArgFlags = kFixed; | 1654 COMPILE_ASSERT(offsetof(CreateParamByNameImmediate, header) == 0, |
600 uint32 id; | 1655 OffsetOf_CreateParamByNameImmediate_header_not_0); |
601 }; | 1656 COMPILE_ASSERT(offsetof(CreateParamByNameImmediate, param_id) == 4, |
602 | 1657 OffsetOf_CreateParamByNameImmediate_param_id_not_4); |
603 struct SET_PARAM_DATA { | 1658 COMPILE_ASSERT(offsetof(CreateParamByNameImmediate, effect_id) == 8, |
604 static const CommandId kCmdId = command_buffer::SET_PARAM_DATA; | 1659 OffsetOf_CreateParamByNameImmediate_effect_id_not_8); |
605 static const ArgFlags kArgFlags = kFixed; | 1660 COMPILE_ASSERT(offsetof(CreateParamByNameImmediate, size) == 12, |
| 1661 OffsetOf_CreateParamByNameImmediate_size_not_12); |
| 1662 |
| 1663 struct DestroyParam { |
| 1664 typedef DestroyParam ValueType; |
| 1665 static const CommandId kCmdId = command_buffer::kDestroyParam; |
| 1666 static const ArgFlags kArgFlags = kFixed; |
| 1667 |
| 1668 void SetHeader() { |
| 1669 header.SetCmd<ValueType>(); |
| 1670 } |
| 1671 |
| 1672 void Init(uint32 _id) { |
| 1673 SetHeader(); |
| 1674 id = _id; |
| 1675 } |
| 1676 |
| 1677 static void* Set(void* cmd, uint32 id) { |
| 1678 static_cast<ValueType*>(cmd)->Init(id); |
| 1679 return NextCmdAddress<ValueType>(cmd); |
| 1680 } |
| 1681 |
| 1682 CommandHeader header; |
| 1683 uint32 id; |
| 1684 }; |
| 1685 |
| 1686 COMPILE_ASSERT(sizeof(DestroyParam) == 8, Sizeof_DestroyParam_is_not_8); |
| 1687 COMPILE_ASSERT(offsetof(DestroyParam, header) == 0, |
| 1688 OffsetOf_DestroyParam_header_not_0); |
| 1689 COMPILE_ASSERT(offsetof(DestroyParam, id) == 4, |
| 1690 OffsetOf_DestroyParam_id_not_4); |
| 1691 |
| 1692 struct SetParamData { |
| 1693 typedef SetParamData ValueType; |
| 1694 static const CommandId kCmdId = command_buffer::kSetParamData; |
| 1695 static const ArgFlags kArgFlags = kFixed; |
| 1696 |
| 1697 void SetHeader() { |
| 1698 header.SetCmd<ValueType>(); |
| 1699 } |
| 1700 |
| 1701 void Init(uint32 _id, uint32 _size, |
| 1702 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 1703 SetHeader(); |
| 1704 id = _id; |
| 1705 size = _size; |
| 1706 shared_memory.Init(shared_memory_id, shared_memory_offset); |
| 1707 } |
| 1708 |
| 1709 static void* Set(void* cmd, uint32 id, uint32 size, |
| 1710 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 1711 static_cast<ValueType*>(cmd)->Init(id, size, |
| 1712 shared_memory_id, shared_memory_offset); |
| 1713 return NextCmdAddress<ValueType>(cmd); |
| 1714 } |
| 1715 |
| 1716 CommandHeader header; |
606 uint32 id; | 1717 uint32 id; |
607 uint32 size; | 1718 uint32 size; |
608 SharedMemory shared_memory; | 1719 SharedMemory shared_memory; |
609 }; | 1720 }; |
610 | 1721 |
611 struct SET_PARAM_DATA_IMMEDIATE { | 1722 COMPILE_ASSERT(sizeof(SetParamData) == 20, Sizeof_SetParamData_is_not_20); |
612 static const CommandId kCmdId = command_buffer::SET_PARAM_DATA_IMMEDIATE; | 1723 COMPILE_ASSERT(offsetof(SetParamData, header) == 0, |
| 1724 OffsetOf_SetParamData_header_not_0); |
| 1725 COMPILE_ASSERT(offsetof(SetParamData, id) == 4, |
| 1726 OffsetOf_SetParamData_id_not_4); |
| 1727 COMPILE_ASSERT(offsetof(SetParamData, size) == 8, |
| 1728 OffsetOf_SetParamData_size_not_8); |
| 1729 COMPILE_ASSERT(offsetof(SetParamData, shared_memory) == 12, |
| 1730 OffsetOf_SetParamData_shared_memory_not_12); |
| 1731 |
| 1732 struct SetParamDataImmediate { |
| 1733 typedef SetParamDataImmediate ValueType; |
| 1734 static const CommandId kCmdId = command_buffer::kSetParamDataImmediate; |
613 static const ArgFlags kArgFlags = kAtLeastN; | 1735 static const ArgFlags kArgFlags = kAtLeastN; |
| 1736 |
| 1737 void SetHeader(uint32 size) { |
| 1738 header.SetCmdBySize<ValueType>(size); |
| 1739 } |
| 1740 |
| 1741 void Init(uint32 _id, uint32 _size, const void* data) { |
| 1742 SetHeader(_size); |
| 1743 id = _id; |
| 1744 size = _size; |
| 1745 memcpy(ImmediateDataAddress(this), data, _size); |
| 1746 } |
| 1747 |
| 1748 static void* Set(void* cmd, uint32 id, uint32 size, const void* data) { |
| 1749 static_cast<ValueType*>(cmd)->Init(id, size, data); |
| 1750 return NextImmediateCmdAddress<ValueType>(cmd, size); |
| 1751 } |
| 1752 |
| 1753 CommandHeader header; |
614 uint32 id; | 1754 uint32 id; |
615 uint32 size; | 1755 uint32 size; |
616 }; | 1756 }; |
617 | 1757 |
618 struct GET_PARAM_DESC { | 1758 COMPILE_ASSERT(sizeof(SetParamDataImmediate) == 12, |
619 static const CommandId kCmdId = command_buffer::GET_PARAM_DESC; | 1759 Sizeof_SetParamDataImmediate_is_not_12); |
620 static const ArgFlags kArgFlags = kFixed; | 1760 COMPILE_ASSERT(offsetof(SetParamDataImmediate, header) == 0, |
| 1761 OffsetOf_SetParamDataImmediate_header_not_0); |
| 1762 COMPILE_ASSERT(offsetof(SetParamDataImmediate, id) == 4, |
| 1763 OffsetOf_SetParamDataImmediate_id_not_4); |
| 1764 COMPILE_ASSERT(offsetof(SetParamDataImmediate, size) == 8, |
| 1765 OffsetOf_SetParamDataImmediate_size_not_8); |
| 1766 |
| 1767 struct GetParamDesc { |
| 1768 typedef GetParamDesc ValueType; |
| 1769 static const CommandId kCmdId = command_buffer::kGetParamDesc; |
| 1770 static const ArgFlags kArgFlags = kFixed; |
| 1771 |
| 1772 void SetHeader() { |
| 1773 header.SetCmd<ValueType>(); |
| 1774 } |
| 1775 |
| 1776 void Init(uint32 _id, uint32 _size, |
| 1777 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 1778 SetHeader(); |
| 1779 id = _id; |
| 1780 size = _size; |
| 1781 shared_memory.Init(shared_memory_id, shared_memory_offset); |
| 1782 } |
| 1783 |
| 1784 static void* Set(void* cmd, uint32 id, uint32 size, |
| 1785 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 1786 static_cast<ValueType*>(cmd)->Init(id, size, |
| 1787 shared_memory_id, shared_memory_offset); |
| 1788 return NextCmdAddress<ValueType>(cmd); |
| 1789 } |
| 1790 |
| 1791 CommandHeader header; |
621 uint32 id; | 1792 uint32 id; |
622 uint32 size; | 1793 uint32 size; |
623 SharedMemory shared_memory; | 1794 SharedMemory shared_memory; |
624 }; | 1795 }; |
625 | 1796 |
626 struct GET_STREAM_COUNT { | 1797 COMPILE_ASSERT(sizeof(GetParamDesc) == 20, Sizeof_GetParamDesc_is_not_20); |
627 static const CommandId kCmdId = command_buffer::GET_STREAM_COUNT; | 1798 COMPILE_ASSERT(offsetof(GetParamDesc, header) == 0, |
628 static const ArgFlags kArgFlags = kFixed; | 1799 OffsetOf_GetParamDesc_header_not_0); |
| 1800 COMPILE_ASSERT(offsetof(GetParamDesc, id) == 4, |
| 1801 OffsetOf_GetParamDesc_id_not_4); |
| 1802 COMPILE_ASSERT(offsetof(GetParamDesc, size) == 8, |
| 1803 OffsetOf_GetParamDesc_size_not_8); |
| 1804 COMPILE_ASSERT(offsetof(GetParamDesc, shared_memory) == 12, |
| 1805 OffsetOf_GetParamDesc_shared_memory_not_12); |
| 1806 |
| 1807 struct GetStreamCount { |
| 1808 typedef GetStreamCount ValueType; |
| 1809 static const CommandId kCmdId = command_buffer::kGetStreamCount; |
| 1810 static const ArgFlags kArgFlags = kFixed; |
| 1811 |
| 1812 void SetHeader() { |
| 1813 header.SetCmd<ValueType>(); |
| 1814 } |
| 1815 |
| 1816 void Init(uint32 _id, uint32 _size, |
| 1817 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 1818 SetHeader(); |
| 1819 id = _id; |
| 1820 size = _size; |
| 1821 shared_memory.Init(shared_memory_id, shared_memory_offset); |
| 1822 } |
| 1823 |
| 1824 static void* Set(void* cmd, uint32 id, uint32 size, |
| 1825 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 1826 static_cast<ValueType*>(cmd)->Init(id, size, |
| 1827 shared_memory_id, shared_memory_offset); |
| 1828 return NextCmdAddress<ValueType>(cmd); |
| 1829 } |
| 1830 |
| 1831 CommandHeader header; |
629 uint32 id; | 1832 uint32 id; |
630 uint32 size; | 1833 uint32 size; |
631 SharedMemory shared_memory; | 1834 SharedMemory shared_memory; |
632 }; | 1835 }; |
633 | 1836 |
634 struct GET_STREAM_DESC { | 1837 COMPILE_ASSERT(sizeof(GetStreamCount) == 20, |
635 static const CommandId kCmdId = command_buffer::GET_STREAM_DESC; | 1838 Sizeof_GetStreamCount_is_not_20); |
636 static const ArgFlags kArgFlags = kFixed; | 1839 COMPILE_ASSERT(offsetof(GetStreamCount, header) == 0, |
| 1840 OffsetOf_GetStreamCount_header_not_0); |
| 1841 COMPILE_ASSERT(offsetof(GetStreamCount, id) == 4, |
| 1842 OffsetOf_GetStreamCount_id_not_4); |
| 1843 COMPILE_ASSERT(offsetof(GetStreamCount, size) == 8, |
| 1844 OffsetOf_GetStreamCount_size_not_8); |
| 1845 COMPILE_ASSERT(offsetof(GetStreamCount, shared_memory) == 12, |
| 1846 OffsetOf_GetStreamCount_shared_memory_not_12); |
| 1847 |
| 1848 struct GetStreamDesc { |
| 1849 typedef GetStreamDesc ValueType; |
| 1850 static const CommandId kCmdId = command_buffer::kGetStreamDesc; |
| 1851 static const ArgFlags kArgFlags = kFixed; |
| 1852 |
| 1853 void SetHeader() { |
| 1854 header.SetCmd<ValueType>(); |
| 1855 } |
| 1856 |
| 1857 void Init(uint32 _id, uint32 _index, uint32 _size, |
| 1858 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 1859 SetHeader(); |
| 1860 id = _id; |
| 1861 index = _index; |
| 1862 size = _size; |
| 1863 shared_memory.Init(shared_memory_id, shared_memory_offset); |
| 1864 } |
| 1865 |
| 1866 static void* Set(void* cmd, uint32 id, uint32 index, uint32 size, |
| 1867 uint32 shared_memory_id, uint32 shared_memory_offset) { |
| 1868 static_cast<ValueType*>(cmd)->Init(id, index, size, |
| 1869 shared_memory_id, shared_memory_offset); |
| 1870 return NextCmdAddress<ValueType>(cmd); |
| 1871 } |
| 1872 |
| 1873 CommandHeader header; |
637 uint32 id; | 1874 uint32 id; |
638 uint32 index; | 1875 uint32 index; |
639 uint32 size; | 1876 uint32 size; |
640 SharedMemory shared_memory; | 1877 SharedMemory shared_memory; |
641 }; | 1878 }; |
642 | 1879 |
643 struct DESTROY_TEXTURE { | 1880 COMPILE_ASSERT(sizeof(GetStreamDesc) == 24, Sizeof_GetStreamDesc_is_not_24); |
644 static const CommandId kCmdId = command_buffer::DESTROY_TEXTURE; | 1881 COMPILE_ASSERT(offsetof(GetStreamDesc, header) == 0, |
645 static const ArgFlags kArgFlags = kFixed; | 1882 OffsetOf_GetStreamDesc_header_not_0); |
646 uint32 id; | 1883 COMPILE_ASSERT(offsetof(GetStreamDesc, id) ==4 , |
647 }; | 1884 OffsetOf_GetStreamDesc_id_not_4); |
648 | 1885 COMPILE_ASSERT(offsetof(GetStreamDesc, index) == 8, |
649 struct CREATE_TEXTURE_2D { | 1886 OffsetOf_GetStreamDesc_index_not_8); |
650 static const CommandId kCmdId = command_buffer::CREATE_TEXTURE_2D; | 1887 COMPILE_ASSERT(offsetof(GetStreamDesc, size) == 12, |
| 1888 OffsetOf_GetStreamDesc_size_not_12); |
| 1889 COMPILE_ASSERT(offsetof(GetStreamDesc, shared_memory) == 16, |
| 1890 OffsetOf_GetStreamDesc_shared_memory_not_16); |
| 1891 |
| 1892 struct DestroyTexture { |
| 1893 typedef DestroyTexture ValueType; |
| 1894 static const CommandId kCmdId = command_buffer::kDestroyTexture; |
| 1895 static const ArgFlags kArgFlags = kFixed; |
| 1896 |
| 1897 void SetHeader() { |
| 1898 header.SetCmd<ValueType>(); |
| 1899 } |
| 1900 |
| 1901 void Init(uint32 _id) { |
| 1902 SetHeader(); |
| 1903 id = _id; |
| 1904 } |
| 1905 |
| 1906 static void* Set(void* cmd, uint32 id) { |
| 1907 static_cast<ValueType*>(cmd)->Init(id); |
| 1908 return NextCmdAddress<ValueType>(cmd); |
| 1909 } |
| 1910 |
| 1911 CommandHeader header; |
| 1912 uint32 id; |
| 1913 }; |
| 1914 |
| 1915 COMPILE_ASSERT(sizeof(DestroyTexture) == 8, Sizeof_DestroyTexture_is_not_8); |
| 1916 COMPILE_ASSERT(offsetof(DestroyTexture, header) == 0, |
| 1917 OffsetOf_DestroyTexture_header_not_0); |
| 1918 COMPILE_ASSERT(offsetof(DestroyTexture, id) == 4, |
| 1919 OffsetOf_DestroyTexture_id_not_4); |
| 1920 |
| 1921 struct CreateTexture2d { |
| 1922 typedef CreateTexture2d ValueType; |
| 1923 static const CommandId kCmdId = command_buffer::kCreateTexture2d; |
| 1924 static const ArgFlags kArgFlags = kFixed; |
| 1925 |
| 1926 void SetHeader() { |
| 1927 header.SetCmd<ValueType>(); |
| 1928 } |
| 1929 |
| 1930 void Init(uint32 _texture_id, |
| 1931 uint32 _width, uint32 _height, uint32 _levels, uint32 _format, |
| 1932 uint32 _enable_render_surfaces) { |
| 1933 SetHeader(); |
| 1934 texture_id = _texture_id; |
| 1935 fixme1 = |
| 1936 create_texture_2d_cmd::Width::MakeValue(_width) | |
| 1937 create_texture_2d_cmd::Height::MakeValue(_height); |
| 1938 fixme2 = |
| 1939 create_texture_2d_cmd::Levels::MakeValue(_levels) | |
| 1940 create_texture_2d_cmd::Format::MakeValue(_format) | |
| 1941 create_texture_2d_cmd::Flags::MakeValue(_enable_render_surfaces); |
| 1942 } |
| 1943 |
| 1944 static void* Set(void* cmd, uint32 texture_id, |
| 1945 uint32 width, uint32 height, uint32 levels, uint32 format, |
| 1946 uint32 enable_render_surfaces) { |
| 1947 static_cast<ValueType*>(cmd)->Init(texture_id, |
| 1948 width, height, levels, format, |
| 1949 enable_render_surfaces); |
| 1950 return NextCmdAddress<ValueType>(cmd); |
| 1951 } |
| 1952 |
| 1953 // TODO(gman): fix this to not use obfusticated fields. |
| 1954 CommandHeader header; |
| 1955 uint32 texture_id; |
| 1956 uint32 fixme1; |
| 1957 uint32 fixme2; |
| 1958 }; |
| 1959 |
| 1960 COMPILE_ASSERT(sizeof(CreateTexture2d) == 16, |
| 1961 Sizeof_CreateTexture2d_is_not_16); |
| 1962 COMPILE_ASSERT(offsetof(CreateTexture2d, header) == 0, |
| 1963 OffsetOf_CreateTexture2d_header_not_0); |
| 1964 COMPILE_ASSERT(offsetof(CreateTexture2d, texture_id) == 4, |
| 1965 OffsetOf_CreateTexture2d_texture_id_not_4); |
| 1966 COMPILE_ASSERT(offsetof(CreateTexture2d, fixme1) == 8, |
| 1967 OffsetOf_CreateTexture2d_fixme1_not_8); |
| 1968 COMPILE_ASSERT(offsetof(CreateTexture2d, fixme2) == 12, |
| 1969 OffsetOf_CreateTexture2d_fixme2_not_12); |
| 1970 |
| 1971 struct CreateTexture3d { |
| 1972 typedef CreateTexture3d ValueType; |
| 1973 static const CommandId kCmdId = command_buffer::kCreateTexture3d; |
| 1974 static const ArgFlags kArgFlags = kFixed; |
| 1975 |
| 1976 void SetHeader() { |
| 1977 header.SetCmd<ValueType>(); |
| 1978 } |
| 1979 |
| 1980 void Init(uint32 _texture_id, |
| 1981 uint32 _width, uint32 _height, uint32 _depth, |
| 1982 uint32 _levels, uint32 _format, |
| 1983 uint32 _enable_render_surfaces) { |
| 1984 SetHeader(); |
| 1985 texture_id = _texture_id; |
| 1986 fixme1 = |
| 1987 create_texture_3d_cmd::Width::MakeValue(_width) | |
| 1988 create_texture_3d_cmd::Height::MakeValue(_height); |
| 1989 fixme2 = |
| 1990 create_texture_3d_cmd::Depth::MakeValue(_depth); |
| 1991 fixme3 = |
| 1992 create_texture_3d_cmd::Levels::MakeValue(_levels) | |
| 1993 create_texture_3d_cmd::Format::MakeValue(_format) | |
| 1994 create_texture_3d_cmd::Flags::MakeValue(_enable_render_surfaces); |
| 1995 } |
| 1996 |
| 1997 static void* Set(void* cmd, uint32 texture_id, |
| 1998 uint32 width, uint32 height, uint32 depth, |
| 1999 uint32 levels, uint32 format, |
| 2000 uint32 enable_render_surfaces) { |
| 2001 static_cast<ValueType*>(cmd)->Init(texture_id, |
| 2002 width, height, depth, |
| 2003 levels, format, |
| 2004 enable_render_surfaces); |
| 2005 return NextCmdAddress<ValueType>(cmd); |
| 2006 } |
| 2007 |
| 2008 // TODO(gman): fix this to not use obfusticated fields. |
| 2009 CommandHeader header; |
| 2010 uint32 texture_id; |
| 2011 uint32 fixme1; |
| 2012 uint32 fixme2; |
| 2013 uint32 fixme3; |
| 2014 }; |
| 2015 |
| 2016 COMPILE_ASSERT(sizeof(CreateTexture3d) == 20, |
| 2017 Sizeof_CreateTexture3d_is_not_20); |
| 2018 COMPILE_ASSERT(offsetof(CreateTexture3d, header) == 0, |
| 2019 OffsetOf_CreateTexture3d_header_not_0); |
| 2020 COMPILE_ASSERT(offsetof(CreateTexture3d, texture_id) == 4, |
| 2021 OffsetOf_CreateTexture3d_texture_id_not_4); |
| 2022 COMPILE_ASSERT(offsetof(CreateTexture3d, fixme1) == 8, |
| 2023 OffsetOf_CreateTexture3d_fixme1_not_8); |
| 2024 COMPILE_ASSERT(offsetof(CreateTexture3d, fixme2) == 12, |
| 2025 OffsetOf_CreateTexture3d_fixme2_not_12); |
| 2026 COMPILE_ASSERT(offsetof(CreateTexture3d, fixme3) == 16, |
| 2027 OffsetOf_CreateTexture3d_fixme3_not_16); |
| 2028 |
| 2029 struct CreateTextureCube { |
| 2030 typedef CreateTextureCube ValueType; |
| 2031 static const CommandId kCmdId = command_buffer::kCreateTextureCube; |
| 2032 static const ArgFlags kArgFlags = kFixed; |
| 2033 |
| 2034 void SetHeader() { |
| 2035 header.SetCmd<ValueType>(); |
| 2036 } |
| 2037 |
| 2038 void Init(uint32 _texture_id, |
| 2039 uint32 _edge_length, uint32 _levels, uint32 _format, |
| 2040 uint32 _enable_render_surfaces) { |
| 2041 SetHeader(); |
| 2042 texture_id = _texture_id; |
| 2043 edge_length = _edge_length; |
| 2044 fixme2 = |
| 2045 create_texture_2d_cmd::Levels::MakeValue(_levels) | |
| 2046 create_texture_2d_cmd::Format::MakeValue(_format) | |
| 2047 create_texture_2d_cmd::Flags::MakeValue(_enable_render_surfaces); |
| 2048 } |
| 2049 |
| 2050 static void* Set(void* cmd, uint32 texture_id, |
| 2051 uint32 edge_length, uint32 levels, uint32 format, |
| 2052 uint32 enable_render_surfaces) { |
| 2053 static_cast<ValueType*>(cmd)->Init(texture_id, |
| 2054 edge_length, levels, format, |
| 2055 enable_render_surfaces); |
| 2056 return NextCmdAddress<ValueType>(cmd); |
| 2057 } |
| 2058 |
| 2059 // TODO(gman): fix this to not use obfusticated fields. |
| 2060 CommandHeader header; |
| 2061 uint32 texture_id; |
| 2062 uint32 edge_length; |
| 2063 uint32 fixme2; |
| 2064 }; |
| 2065 |
| 2066 COMPILE_ASSERT(sizeof(CreateTextureCube) == 16, |
| 2067 Sizeof_CreateTextureCube_is_not_16); |
| 2068 COMPILE_ASSERT(offsetof(CreateTextureCube, header) == 0, |
| 2069 OffsetOf_CreateTextureCube_header_not_0); |
| 2070 COMPILE_ASSERT(offsetof(CreateTextureCube, texture_id) == 4, |
| 2071 OffsetOf_CreateTextureCube_texture_id_not_4); |
| 2072 COMPILE_ASSERT(offsetof(CreateTextureCube, edge_length) == 8, |
| 2073 OffsetOf_CreateTextureCube_edge_length_not_8); |
| 2074 COMPILE_ASSERT(offsetof(CreateTextureCube, fixme2) == 12, |
| 2075 OffsetOf_CreateTextureCube_fixme2_not_12); |
| 2076 |
| 2077 struct SetTextureData { |
| 2078 typedef SetTextureData ValueType; |
| 2079 static const CommandId kCmdId = command_buffer::kSetTextureData; |
| 2080 static const ArgFlags kArgFlags = kFixed; |
| 2081 |
| 2082 void SetHeader() { |
| 2083 header.SetCmd<ValueType>(); |
| 2084 } |
| 2085 |
| 2086 void Init( |
| 2087 uint32 _texture_id, |
| 2088 uint32 _x, |
| 2089 uint32 _y, |
| 2090 uint32 _z, |
| 2091 uint32 _width, |
| 2092 uint32 _height, |
| 2093 uint32 _depth, |
| 2094 uint32 _level, |
| 2095 uint32 _face, |
| 2096 uint32 _row_pitch, |
| 2097 uint32 _slice_pitch, |
| 2098 uint32 _size, |
| 2099 uint32 shared_memory_id, |
| 2100 uint32 shared_memory_offset) { |
| 2101 SetHeader(); |
| 2102 texture_id = _texture_id; |
| 2103 fixme1 = |
| 2104 set_texture_data_cmd::X::MakeValue(_x) | |
| 2105 set_texture_data_cmd::Y::MakeValue(_y); |
| 2106 fixme2 = |
| 2107 set_texture_data_cmd::Width::MakeValue(_width) | |
| 2108 set_texture_data_cmd::Height::MakeValue(_height); |
| 2109 fixme3 = |
| 2110 set_texture_data_cmd::Z::MakeValue(_z) | |
| 2111 set_texture_data_cmd::Depth::MakeValue(_depth); |
| 2112 fixme4 = |
| 2113 set_texture_data_cmd::Level::MakeValue(_level) | |
| 2114 set_texture_data_cmd::Face::MakeValue(_face); |
| 2115 row_pitch = _row_pitch; |
| 2116 slice_pitch = _slice_pitch; |
| 2117 size = _size; |
| 2118 shared_memory.Init(shared_memory_id, shared_memory_offset); |
| 2119 } |
| 2120 |
| 2121 static void* Set( |
| 2122 void* cmd, |
| 2123 uint32 texture_id, |
| 2124 uint32 x, |
| 2125 uint32 y, |
| 2126 uint32 z, |
| 2127 uint32 width, |
| 2128 uint32 height, |
| 2129 uint32 depth, |
| 2130 uint32 level, |
| 2131 uint32 face, |
| 2132 uint32 row_pitch, |
| 2133 uint32 slice_pitch, |
| 2134 uint32 size, |
| 2135 uint32 shared_memory_id, |
| 2136 uint32 shared_memory_offset) { |
| 2137 static_cast<ValueType*>(cmd)->Init( |
| 2138 texture_id, |
| 2139 x, |
| 2140 y, |
| 2141 z, |
| 2142 width, |
| 2143 height, |
| 2144 depth, |
| 2145 level, |
| 2146 face, |
| 2147 row_pitch, |
| 2148 slice_pitch, |
| 2149 size, |
| 2150 shared_memory_id, |
| 2151 shared_memory_offset); |
| 2152 return NextCmdAddress<ValueType>(cmd); |
| 2153 } |
| 2154 |
| 2155 // TODO(gman): fix this to not use obfusticated fields. |
| 2156 CommandHeader header; |
| 2157 uint32 texture_id; |
| 2158 uint32 fixme1; |
| 2159 uint32 fixme2; |
| 2160 uint32 fixme3; |
| 2161 uint32 fixme4; |
| 2162 uint32 row_pitch; |
| 2163 uint32 slice_pitch; |
| 2164 uint32 size; |
| 2165 SharedMemory shared_memory; |
| 2166 }; |
| 2167 |
| 2168 COMPILE_ASSERT(sizeof(SetTextureData) == 44, |
| 2169 Sizeof_SetTextureData_is_not_44); |
| 2170 COMPILE_ASSERT(offsetof(SetTextureData, header) == 0, |
| 2171 OffsetOf_SetTextureData_header_not_0); |
| 2172 COMPILE_ASSERT(offsetof(SetTextureData, texture_id) == 4, |
| 2173 OffsetOf_SetTextureData_texture_id_not_4); |
| 2174 COMPILE_ASSERT(offsetof(SetTextureData, fixme1) == 8, |
| 2175 OffsetOf_SetTextureData_fixme1_not_8); |
| 2176 COMPILE_ASSERT(offsetof(SetTextureData, fixme2) == 12, |
| 2177 OffsetOf_SetTextureData_fixme2_not_12); |
| 2178 COMPILE_ASSERT(offsetof(SetTextureData, fixme3) == 16, |
| 2179 OffsetOf_SetTextureData_fixme3_not_16); |
| 2180 COMPILE_ASSERT(offsetof(SetTextureData, fixme4) == 20, |
| 2181 OffsetOf_SetTextureData_fixme4_not_20); |
| 2182 COMPILE_ASSERT(offsetof(SetTextureData, row_pitch) == 24, |
| 2183 OffsetOf_SetTextureData_row_pitch_not_24); |
| 2184 COMPILE_ASSERT(offsetof(SetTextureData, slice_pitch) == 28, |
| 2185 OffsetOf_SetTextureData_slice_pitch_not_28); |
| 2186 COMPILE_ASSERT(offsetof(SetTextureData, size) == 32, |
| 2187 OffsetOf_SetTextureData_size_not_32); |
| 2188 COMPILE_ASSERT(offsetof(SetTextureData, shared_memory) == 36, |
| 2189 OffsetOf_SetTextureData_shared_memory_not_36); |
| 2190 |
| 2191 struct SetTextureDataImmediate { |
| 2192 typedef SetTextureDataImmediate ValueType; |
| 2193 static const CommandId kCmdId = command_buffer::kSetTextureDataImmediate; |
651 static const ArgFlags kArgFlags = kAtLeastN; | 2194 static const ArgFlags kArgFlags = kAtLeastN; |
| 2195 |
| 2196 void SetHeader(uint32 size) { |
| 2197 header.SetCmdBySize<ValueType>(size); |
| 2198 } |
| 2199 |
| 2200 void Init( |
| 2201 uint32 _texture_id, |
| 2202 uint32 _x, |
| 2203 uint32 _y, |
| 2204 uint32 _z, |
| 2205 uint32 _width, |
| 2206 uint32 _height, |
| 2207 uint32 _depth, |
| 2208 uint32 _level, |
| 2209 uint32 _face, |
| 2210 uint32 _row_pitch, |
| 2211 uint32 _slice_pitch, |
| 2212 uint32 _size, |
| 2213 const void* data) { |
| 2214 SetHeader(_size); |
| 2215 texture_id = _texture_id; |
| 2216 fixme1 = |
| 2217 set_texture_data_cmd::X::MakeValue(_x) | |
| 2218 set_texture_data_cmd::Y::MakeValue(_y); |
| 2219 fixme2 = |
| 2220 set_texture_data_cmd::Width::MakeValue(_width) | |
| 2221 set_texture_data_cmd::Height::MakeValue(_height); |
| 2222 fixme3 = |
| 2223 set_texture_data_cmd::Z::MakeValue(_z) | |
| 2224 set_texture_data_cmd::Depth::MakeValue(_depth); |
| 2225 fixme4 = |
| 2226 set_texture_data_cmd::Level::MakeValue(_level) | |
| 2227 set_texture_data_cmd::Face::MakeValue(_face); |
| 2228 row_pitch = _row_pitch; |
| 2229 slice_pitch = _slice_pitch; |
| 2230 size = _size; |
| 2231 memcpy(ImmediateDataAddress(this), data, _size); |
| 2232 } |
| 2233 |
| 2234 static void* Set( |
| 2235 void* cmd, |
| 2236 uint32 texture_id, |
| 2237 uint32 x, |
| 2238 uint32 y, |
| 2239 uint32 z, |
| 2240 uint32 width, |
| 2241 uint32 height, |
| 2242 uint32 depth, |
| 2243 uint32 level, |
| 2244 uint32 face, |
| 2245 uint32 row_pitch, |
| 2246 uint32 slice_pitch, |
| 2247 uint32 size, |
| 2248 const void* data) { |
| 2249 static_cast<ValueType*>(cmd)->Init( |
| 2250 texture_id, |
| 2251 x, |
| 2252 y, |
| 2253 z, |
| 2254 width, |
| 2255 height, |
| 2256 depth, |
| 2257 level, |
| 2258 face, |
| 2259 row_pitch, |
| 2260 slice_pitch, |
| 2261 size, |
| 2262 data); |
| 2263 return NextImmediateCmdAddress<ValueType>(cmd, size); |
| 2264 } |
| 2265 |
652 // TODO(gman): fix this to not use obfusticated fields. | 2266 // TODO(gman): fix this to not use obfusticated fields. |
653 }; | 2267 CommandHeader header; |
654 | 2268 uint32 texture_id; |
655 struct CREATE_TEXTURE_3D { | 2269 uint32 fixme1; |
656 static const CommandId kCmdId = command_buffer::CREATE_TEXTURE_3D; | 2270 uint32 fixme2; |
657 static const ArgFlags kArgFlags = kAtLeastN; | 2271 uint32 fixme3; |
| 2272 uint32 fixme4; |
| 2273 uint32 row_pitch; |
| 2274 uint32 slice_pitch; |
| 2275 uint32 size; |
| 2276 }; |
| 2277 |
| 2278 COMPILE_ASSERT(sizeof(SetTextureDataImmediate) == 36, |
| 2279 Sizeof_SetTextureDataImmediate_is_not_36); |
| 2280 COMPILE_ASSERT(offsetof(SetTextureDataImmediate, header) == 0, |
| 2281 OffsetOf_SetTextureDataImmediate_header_not_0); |
| 2282 COMPILE_ASSERT(offsetof(SetTextureDataImmediate, texture_id) == 4, |
| 2283 OffsetOf_SetTextureDataImmediate_texture_id_not_4); |
| 2284 COMPILE_ASSERT(offsetof(SetTextureDataImmediate, fixme1) == 8, |
| 2285 OffsetOf_SetTextureDataImmediate_fixme1_not_8); |
| 2286 COMPILE_ASSERT(offsetof(SetTextureDataImmediate, fixme2) == 12, |
| 2287 OffsetOf_SetTextureDataImmediate_fixme2_not_12); |
| 2288 COMPILE_ASSERT(offsetof(SetTextureDataImmediate, fixme3) == 16, |
| 2289 OffsetOf_SetTextureDataImmediate_fixme3_not_16); |
| 2290 COMPILE_ASSERT(offsetof(SetTextureDataImmediate, fixme4) == 20, |
| 2291 OffsetOf_SetTextureDataImmediate_fixme4_not_20); |
| 2292 COMPILE_ASSERT(offsetof(SetTextureDataImmediate, row_pitch) == 24, |
| 2293 OffsetOf_SetTextureDataImmediate_row_pitch_not_24); |
| 2294 COMPILE_ASSERT(offsetof(SetTextureDataImmediate, slice_pitch) == 28, |
| 2295 OffsetOf_SetTextureDataImmediate_slice_pitch_not_28); |
| 2296 COMPILE_ASSERT(offsetof(SetTextureDataImmediate, size) == 32, |
| 2297 OffsetOf_SetTextureDataImmediate_size_not_32); |
| 2298 |
| 2299 struct GetTextureData { |
| 2300 typedef GetTextureData ValueType; |
| 2301 static const CommandId kCmdId = command_buffer::kGetTextureData; |
| 2302 static const ArgFlags kArgFlags = kFixed; |
| 2303 |
| 2304 void SetHeader() { |
| 2305 header.SetCmd<ValueType>(); |
| 2306 } |
| 2307 |
| 2308 void Init( |
| 2309 uint32 _texture_id, |
| 2310 uint32 _x, |
| 2311 uint32 _y, |
| 2312 uint32 _z, |
| 2313 uint32 _width, |
| 2314 uint32 _height, |
| 2315 uint32 _depth, |
| 2316 uint32 _level, |
| 2317 uint32 _face, |
| 2318 uint32 _row_pitch, |
| 2319 uint32 _slice_pitch, |
| 2320 uint32 _size, |
| 2321 uint32 shared_memory_id, |
| 2322 uint32 shared_memory_offset) { |
| 2323 SetHeader(); |
| 2324 texture_id = _texture_id; |
| 2325 fixme1 = |
| 2326 set_texture_data_cmd::X::MakeValue(_x) | |
| 2327 set_texture_data_cmd::Y::MakeValue(_y); |
| 2328 fixme2 = |
| 2329 set_texture_data_cmd::Width::MakeValue(_width) | |
| 2330 set_texture_data_cmd::Height::MakeValue(_height); |
| 2331 fixme3 = |
| 2332 set_texture_data_cmd::Z::MakeValue(_z) | |
| 2333 set_texture_data_cmd::Depth::MakeValue(_depth); |
| 2334 fixme4 = |
| 2335 set_texture_data_cmd::Level::MakeValue(_level) | |
| 2336 set_texture_data_cmd::Face::MakeValue(_face); |
| 2337 row_pitch = _row_pitch; |
| 2338 slice_pitch = _slice_pitch; |
| 2339 size = _size; |
| 2340 shared_memory.Init(shared_memory_id, shared_memory_offset); |
| 2341 } |
| 2342 |
| 2343 static void* Set( |
| 2344 void* cmd, |
| 2345 uint32 texture_id, |
| 2346 uint32 x, |
| 2347 uint32 y, |
| 2348 uint32 z, |
| 2349 uint32 width, |
| 2350 uint32 height, |
| 2351 uint32 depth, |
| 2352 uint32 level, |
| 2353 uint32 face, |
| 2354 uint32 row_pitch, |
| 2355 uint32 slice_pitch, |
| 2356 uint32 size, |
| 2357 uint32 shared_memory_id, |
| 2358 uint32 shared_memory_offset) { |
| 2359 static_cast<ValueType*>(cmd)->Init( |
| 2360 texture_id, |
| 2361 x, |
| 2362 y, |
| 2363 z, |
| 2364 width, |
| 2365 height, |
| 2366 depth, |
| 2367 level, |
| 2368 face, |
| 2369 row_pitch, |
| 2370 slice_pitch, |
| 2371 size, |
| 2372 shared_memory_id, |
| 2373 shared_memory_offset); |
| 2374 return NextCmdAddress<ValueType>(cmd); |
| 2375 } |
| 2376 |
658 // TODO(gman): fix this to not use obfusticated fields. | 2377 // TODO(gman): fix this to not use obfusticated fields. |
659 }; | 2378 CommandHeader header; |
660 | 2379 uint32 texture_id; |
661 struct CREATE_TEXTURE_CUBE { | 2380 uint32 fixme1; |
662 static const CommandId kCmdId = command_buffer::CREATE_TEXTURE_CUBE; | 2381 uint32 fixme2; |
663 static const ArgFlags kArgFlags = kAtLeastN; | 2382 uint32 fixme3; |
| 2383 uint32 fixme4; |
| 2384 uint32 row_pitch; |
| 2385 uint32 slice_pitch; |
| 2386 uint32 size; |
| 2387 SharedMemory shared_memory; |
| 2388 }; |
| 2389 |
| 2390 COMPILE_ASSERT(sizeof(GetTextureData) == 44, |
| 2391 Sizeof_GetTextureData_is_not_44); |
| 2392 COMPILE_ASSERT(offsetof(GetTextureData, header) == 0, |
| 2393 OffsetOf_GetTextureData_header_not_0); |
| 2394 COMPILE_ASSERT(offsetof(GetTextureData, texture_id) == 4, |
| 2395 OffsetOf_GetTextureData_texture_id_not_4); |
| 2396 COMPILE_ASSERT(offsetof(GetTextureData, fixme1) == 8, |
| 2397 OffsetOf_GetTextureData_fixme1_not_8); |
| 2398 COMPILE_ASSERT(offsetof(GetTextureData, fixme2) == 12, |
| 2399 OffsetOf_GetTextureData_fixme2_not_12); |
| 2400 COMPILE_ASSERT(offsetof(GetTextureData, fixme3) == 16, |
| 2401 OffsetOf_GetTextureData_fixme3_not_16); |
| 2402 COMPILE_ASSERT(offsetof(GetTextureData, fixme4) == 20, |
| 2403 OffsetOf_GetTextureData_fixme4_not_20); |
| 2404 COMPILE_ASSERT(offsetof(GetTextureData, row_pitch) == 24, |
| 2405 OffsetOf_GetTextureData_row_pitch_not_24); |
| 2406 COMPILE_ASSERT(offsetof(GetTextureData, slice_pitch) == 28, |
| 2407 OffsetOf_GetTextureData_slice_pitch_not_28); |
| 2408 COMPILE_ASSERT(offsetof(GetTextureData, size) == 32, |
| 2409 OffsetOf_GetTextureData_size_not_32); |
| 2410 COMPILE_ASSERT(offsetof(GetTextureData, shared_memory) == 36, |
| 2411 OffsetOf_GetTextureData_shared_memory_not_36); |
| 2412 |
| 2413 struct CreateSampler { |
| 2414 typedef CreateSampler ValueType; |
| 2415 static const CommandId kCmdId = command_buffer::kCreateSampler; |
| 2416 static const ArgFlags kArgFlags = kFixed; |
| 2417 |
| 2418 void SetHeader() { |
| 2419 header.SetCmd<ValueType>(); |
| 2420 } |
| 2421 |
| 2422 void Init(uint32 _id) { |
| 2423 SetHeader(); |
| 2424 id = _id; |
| 2425 } |
| 2426 |
| 2427 static void* Set(void* cmd, uint32 id) { |
| 2428 static_cast<ValueType*>(cmd)->Init(id); |
| 2429 return NextCmdAddress<ValueType>(cmd); |
| 2430 } |
| 2431 |
| 2432 CommandHeader header; |
| 2433 uint32 id; |
| 2434 }; |
| 2435 |
| 2436 COMPILE_ASSERT(sizeof(CreateSampler) == 8, Sizeof_CreateSampler_is_not_8); |
| 2437 COMPILE_ASSERT(offsetof(CreateSampler, header) == 0, |
| 2438 OffsetOf_CreateSampler_header_not_0); |
| 2439 COMPILE_ASSERT(offsetof(CreateSampler, id) == 4, |
| 2440 OffsetOf_CreateSampler_id_not_4); |
| 2441 |
| 2442 struct DestroySampler { |
| 2443 typedef DestroySampler ValueType; |
| 2444 static const CommandId kCmdId = command_buffer::kDestroySampler; |
| 2445 static const ArgFlags kArgFlags = kFixed; |
| 2446 |
| 2447 void SetHeader() { |
| 2448 header.SetCmd<ValueType>(); |
| 2449 } |
| 2450 |
| 2451 void Init(uint32 _id) { |
| 2452 SetHeader(); |
| 2453 id = _id; |
| 2454 } |
| 2455 |
| 2456 static void* Set(void* cmd, uint32 id) { |
| 2457 static_cast<ValueType*>(cmd)->Init(id); |
| 2458 return NextCmdAddress<ValueType>(cmd); |
| 2459 } |
| 2460 |
| 2461 CommandHeader header; |
| 2462 uint32 id; |
| 2463 }; |
| 2464 |
| 2465 COMPILE_ASSERT(sizeof(DestroySampler) == 8, Sizeof_DestroySampler_is_not_8); |
| 2466 COMPILE_ASSERT(offsetof(DestroySampler, header) == 0, |
| 2467 OffsetOf_DestroySampler_header_not_0); |
| 2468 COMPILE_ASSERT(offsetof(DestroySampler, id) == 4, |
| 2469 OffsetOf_DestroySampler_id_not_4); |
| 2470 |
| 2471 struct SetSamplerStates { |
| 2472 typedef SetSamplerStates ValueType; |
| 2473 static const CommandId kCmdId = command_buffer::kSetSamplerStates; |
| 2474 static const ArgFlags kArgFlags = kFixed; |
| 2475 |
| 2476 void SetHeader() { |
| 2477 header.SetCmd<ValueType>(); |
| 2478 } |
| 2479 |
| 2480 void Init( |
| 2481 uint32 _id, |
| 2482 uint32 _address_u_value, |
| 2483 uint32 _address_v_value, |
| 2484 uint32 _address_w_value, |
| 2485 uint32 _mag_filter_value, |
| 2486 uint32 _min_filter_value, |
| 2487 uint32 _mip_filter_value, |
| 2488 uint32 _max_anisotropy) { |
| 2489 SetHeader(); |
| 2490 id = _id; |
| 2491 fixme1 = |
| 2492 set_sampler_states::AddressingU::MakeValue(_address_u_value) | |
| 2493 set_sampler_states::AddressingV::MakeValue(_address_v_value) | |
| 2494 set_sampler_states::AddressingW::MakeValue(_address_w_value) | |
| 2495 set_sampler_states::MagFilter::MakeValue(_mag_filter_value) | |
| 2496 set_sampler_states::MinFilter::MakeValue(_min_filter_value) | |
| 2497 set_sampler_states::MipFilter::MakeValue(_mip_filter_value) | |
| 2498 set_sampler_states::MaxAnisotropy::MakeValue(_max_anisotropy); |
| 2499 } |
| 2500 |
| 2501 static void* Set(void* cmd, |
| 2502 uint32 id, |
| 2503 uint32 address_u_value, |
| 2504 uint32 address_v_value, |
| 2505 uint32 address_w_value, |
| 2506 uint32 mag_filter_value, |
| 2507 uint32 min_filter_value, |
| 2508 uint32 mip_filter_value, |
| 2509 uint32 max_anisotropy) { |
| 2510 static_cast<ValueType*>(cmd)->Init( |
| 2511 id, |
| 2512 address_u_value, |
| 2513 address_v_value, |
| 2514 address_w_value, |
| 2515 mag_filter_value, |
| 2516 min_filter_value, |
| 2517 mip_filter_value, |
| 2518 max_anisotropy); |
| 2519 return NextCmdAddress<ValueType>(cmd); |
| 2520 } |
| 2521 |
664 // TODO(gman): fix this to not use obfusticated fields. | 2522 // TODO(gman): fix this to not use obfusticated fields. |
665 }; | 2523 CommandHeader header; |
666 | 2524 uint32 id; |
667 struct SET_TEXTURE_DATA { | 2525 uint32 fixme1; |
668 static const CommandId kCmdId = command_buffer::SET_TEXTURE_DATA; | 2526 }; |
669 static const ArgFlags kArgFlags = kAtLeastN; | 2527 |
670 // TODO(gman): fix this to not use obfusticated fields. | 2528 COMPILE_ASSERT(sizeof(SetSamplerStates) == 12, |
671 }; | 2529 Sizeof_SetSamplerStates_is_not_12); |
672 | 2530 COMPILE_ASSERT(offsetof(SetSamplerStates, header) == 0, |
673 struct SET_TEXTURE_DATA_IMMEDIATE { | 2531 OffsetOf_SetSamplerStates_header_not_0); |
674 static const CommandId kCmdId = command_buffer::SET_TEXTURE_DATA_IMMEDIATE; | 2532 COMPILE_ASSERT(offsetof(SetSamplerStates, id) == 4, |
675 static const ArgFlags kArgFlags = kAtLeastN; | 2533 OffsetOf_SetSamplerStates_id_not_4); |
676 // TODO(gman): fix this to not use obfusticated fields. | 2534 COMPILE_ASSERT(offsetof(SetSamplerStates, fixme1) == 8, |
677 }; | 2535 OffsetOf_SetSamplerStates_fixme1_not_8); |
678 | 2536 |
679 struct GET_TEXTURE_DATA { | 2537 struct SetSamplerBorderColor { |
680 static const CommandId kCmdId = command_buffer::GET_TEXTURE_DATA; | 2538 typedef SetSamplerBorderColor ValueType; |
681 static const ArgFlags kArgFlags = kAtLeastN; | 2539 static const CommandId kCmdId = command_buffer::kSetSamplerBorderColor; |
682 // TODO(gman): fix this to not use obfusticated fields. | 2540 static const ArgFlags kArgFlags = kFixed; |
683 }; | 2541 |
684 | 2542 void SetHeader() { |
685 struct CREATE_SAMPLER { | 2543 header.SetCmd<ValueType>(); |
686 static const CommandId kCmdId = command_buffer::CREATE_SAMPLER; | 2544 } |
687 static const ArgFlags kArgFlags = kFixed; | 2545 |
688 uint32 id; | 2546 void Init(uint32 _id, |
689 }; | 2547 float _red, float _green, float _blue, float _alpha) { |
690 | 2548 SetHeader(); |
691 struct DESTROY_SAMPLER { | 2549 id = _id; |
692 static const CommandId kCmdId = command_buffer::DESTROY_SAMPLER; | 2550 red = _red; |
693 static const ArgFlags kArgFlags = kFixed; | 2551 green = _green; |
694 uint32 id; | 2552 blue = _blue; |
695 }; | 2553 alpha = _alpha; |
696 | 2554 } |
697 struct SET_SAMPLER_STATES { | 2555 |
698 static const CommandId kCmdId = command_buffer::SET_SAMPLER_STATES; | 2556 static void* Set(void* cmd, uint32 id, |
699 static const ArgFlags kArgFlags = kAtLeastN; | 2557 float red, float green, float blue, float alpha) { |
700 // TODO(gman): fix this to not use obfusticated fields. | 2558 static_cast<ValueType*>(cmd)->Init(id, red, green, blue, alpha); |
701 }; | 2559 return NextCmdAddress<ValueType>(cmd); |
702 | 2560 } |
703 struct SET_SAMPLER_BORDER_COLOR { | 2561 |
704 static const CommandId kCmdId = command_buffer::SET_SAMPLER_BORDER_COLOR; | 2562 CommandHeader header; |
705 static const ArgFlags kArgFlags = kFixed; | |
706 uint32 id; | 2563 uint32 id; |
707 float red; | 2564 float red; |
708 float blue; | 2565 float blue; |
709 float green; | 2566 float green; |
710 float alpha; | 2567 float alpha; |
711 }; | 2568 }; |
712 | 2569 |
713 struct SET_SAMPLER_TEXTURE { | 2570 COMPILE_ASSERT(sizeof(SetSamplerBorderColor) == 24, |
714 static const CommandId kCmdId = command_buffer::SET_SAMPLER_TEXTURE; | 2571 Sizeof_SetSamplerBorderColor_is_not_24); |
715 static const ArgFlags kArgFlags = kFixed; | 2572 COMPILE_ASSERT(offsetof(SetSamplerBorderColor, header) == 0, |
| 2573 OffsetOf_SetSamplerBorderColor_header_not_0); |
| 2574 COMPILE_ASSERT(offsetof(SetSamplerBorderColor, id) == 4, |
| 2575 OffsetOf_SetSamplerBorderColor_id_not_4); |
| 2576 COMPILE_ASSERT(offsetof(SetSamplerBorderColor, red) == 8, |
| 2577 OffsetOf_SetSamplerBorderColor_red_not_8); |
| 2578 COMPILE_ASSERT(offsetof(SetSamplerBorderColor, blue) == 12, |
| 2579 OffsetOf_SetSamplerBorderColor_blue_not_12); |
| 2580 COMPILE_ASSERT(offsetof(SetSamplerBorderColor, green) == 16, |
| 2581 OffsetOf_SetSamplerBorderColor_green_not_16); |
| 2582 COMPILE_ASSERT(offsetof(SetSamplerBorderColor, alpha) == 20, |
| 2583 OffsetOf_SetSamplerBorderColor_alpha_not_20); |
| 2584 |
| 2585 struct SetSamplerTexture { |
| 2586 typedef SetSamplerTexture ValueType; |
| 2587 static const CommandId kCmdId = command_buffer::kSetSamplerTexture; |
| 2588 static const ArgFlags kArgFlags = kFixed; |
| 2589 |
| 2590 void SetHeader() { |
| 2591 header.SetCmd<ValueType>(); |
| 2592 } |
| 2593 |
| 2594 void Init(uint32 _id, uint32 _texture_id) { |
| 2595 SetHeader(); |
| 2596 id = _id; |
| 2597 texture_id = _texture_id; |
| 2598 } |
| 2599 |
| 2600 static void* Set(void* cmd, uint32 id, uint32 texture_id) { |
| 2601 static_cast<ValueType*>(cmd)->Init(id, texture_id); |
| 2602 return NextCmdAddress<ValueType>(cmd); |
| 2603 } |
| 2604 |
| 2605 CommandHeader header; |
716 uint32 id; | 2606 uint32 id; |
717 uint32 texture_id; | 2607 uint32 texture_id; |
718 }; | 2608 }; |
719 | 2609 |
720 struct SET_SCISSOR { | 2610 COMPILE_ASSERT(sizeof(SetSamplerTexture) == 12, |
721 static const CommandId kCmdId = command_buffer::SET_SCISSOR; | 2611 Sizeof_SetSamplerTexture_is_not_12); |
722 static const ArgFlags kArgFlags = kFixed; | 2612 COMPILE_ASSERT(offsetof(SetSamplerTexture, header) == 0, |
723 // TODO(gman): fix this to not use obfusticated fields. | 2613 OffsetOf_SetSamplerTexture_header_not_0); |
| 2614 COMPILE_ASSERT(offsetof(SetSamplerTexture, id) == 4, |
| 2615 OffsetOf_SetSamplerTexture_id_not_4); |
| 2616 COMPILE_ASSERT(offsetof(SetSamplerTexture, texture_id) == 8, |
| 2617 OffsetOf_SetSamplerTexture_texture_id_not_8); |
| 2618 |
| 2619 struct SetScissor { |
| 2620 typedef SetScissor ValueType; |
| 2621 static const CommandId kCmdId = command_buffer::kSetScissor; |
| 2622 static const ArgFlags kArgFlags = kFixed; |
| 2623 |
| 2624 void SetHeader() { |
| 2625 header.SetCmd<ValueType>(); |
| 2626 } |
| 2627 |
| 2628 void Init(uint32 _x, |
| 2629 uint32 _y, |
| 2630 uint32 _width, |
| 2631 uint32 _height, |
| 2632 bool _enable) { |
| 2633 SetHeader(); |
| 2634 fixme0 = |
| 2635 set_scissor::X::MakeValue(_x) | |
| 2636 set_scissor::Y::MakeValue(_y) | |
| 2637 set_scissor::Enable::MakeValue(_enable ? 1 : 0); |
| 2638 fixme1 = |
| 2639 set_scissor::Width::MakeValue(_width) | |
| 2640 set_scissor::Height::MakeValue(_height); |
| 2641 } |
| 2642 |
| 2643 static void* Set( |
| 2644 void* cmd, |
| 2645 uint32 x, |
| 2646 uint32 y, |
| 2647 uint32 width, |
| 2648 uint32 height, |
| 2649 bool enable) { |
| 2650 static_cast<ValueType*>(cmd)->Init( |
| 2651 x, |
| 2652 y, |
| 2653 width, |
| 2654 height, |
| 2655 enable); |
| 2656 return NextCmdAddress<ValueType>(cmd); |
| 2657 } |
| 2658 |
| 2659 // TODO(gman): fix this to not use obfusticated fields. |
| 2660 CommandHeader header; |
724 uint32 fixme0; | 2661 uint32 fixme0; |
725 uint32 fixme1; | 2662 uint32 fixme1; |
726 }; | 2663 }; |
727 | 2664 |
728 struct SET_POLYGON_OFFSET { | 2665 COMPILE_ASSERT(sizeof(SetScissor) == 12, Sizeof_SetScissor_is_not_12); |
729 static const CommandId kCmdId = command_buffer::SET_POLYGON_OFFSET; | 2666 COMPILE_ASSERT(offsetof(SetScissor, header) == 0, |
730 static const ArgFlags kArgFlags = kFixed; | 2667 OffsetOf_SetScissor_header_not_0); |
| 2668 COMPILE_ASSERT(offsetof(SetScissor, fixme0) == 4, |
| 2669 OffsetOf_SetScissor_fixme0_not_4); |
| 2670 COMPILE_ASSERT(offsetof(SetScissor, fixme1) == 8, |
| 2671 OffsetOf_SetScissor_fixme1_not_8); |
| 2672 |
| 2673 struct SetPolygonOffset { |
| 2674 typedef SetPolygonOffset ValueType; |
| 2675 static const CommandId kCmdId = command_buffer::kSetPolygonOffset; |
| 2676 static const ArgFlags kArgFlags = kFixed; |
| 2677 |
| 2678 void SetHeader() { |
| 2679 header.SetCmd<ValueType>(); |
| 2680 } |
| 2681 |
| 2682 void Init(float _slope_factor, float _units) { |
| 2683 SetHeader(); |
| 2684 slope_factor = _slope_factor; |
| 2685 units = _units; |
| 2686 } |
| 2687 |
| 2688 static void* Set(void* cmd, float slope_factor, float units) { |
| 2689 static_cast<ValueType*>(cmd)->Init(slope_factor, units); |
| 2690 return NextCmdAddress<ValueType>(cmd); |
| 2691 } |
| 2692 |
| 2693 CommandHeader header; |
731 float slope_factor; | 2694 float slope_factor; |
732 float units; | 2695 float units; |
733 }; | 2696 }; |
734 | 2697 |
735 struct SET_POINT_LINE_RASTER { | 2698 COMPILE_ASSERT(sizeof(SetPolygonOffset) == 12, |
736 static const CommandId kCmdId = command_buffer::SET_POINT_LINE_RASTER; | 2699 Sizeof_SetPolygonOffset_is_not_12); |
737 static const ArgFlags kArgFlags = kFixed; | 2700 COMPILE_ASSERT(offsetof(SetPolygonOffset, header) == 0, |
738 // TODO(gman): fix this to not use obfusticated fields. | 2701 OffsetOf_SetPolygonOffset_header_not_0); |
| 2702 COMPILE_ASSERT(offsetof(SetPolygonOffset, slope_factor) == 4, |
| 2703 OffsetOf_SetPolygonOffset_slope_factor_not_4); |
| 2704 COMPILE_ASSERT(offsetof(SetPolygonOffset, units) == 8, |
| 2705 OffsetOf_SetPolygonOffset_units_not_8); |
| 2706 |
| 2707 struct SetPointLineRaster { |
| 2708 typedef SetPointLineRaster ValueType; |
| 2709 static const CommandId kCmdId = command_buffer::kSetPointLineRaster; |
| 2710 static const ArgFlags kArgFlags = kFixed; |
| 2711 |
| 2712 void SetHeader() { |
| 2713 header.SetCmd<ValueType>(); |
| 2714 } |
| 2715 |
| 2716 void Init(bool _line_smooth_enable, bool _point_sprite_enable, |
| 2717 float _point_size) { |
| 2718 SetHeader(); |
| 2719 fixme0 = |
| 2720 set_point_line_raster::LineSmoothEnable::MakeValue( |
| 2721 _line_smooth_enable ? 1 : 0) | |
| 2722 set_point_line_raster::PointSpriteEnable::MakeValue( |
| 2723 _point_sprite_enable ? 1 : 0); |
| 2724 point_size = _point_size; |
| 2725 } |
| 2726 |
| 2727 static void* Set(void* cmd, bool line_smooth_enable, bool point_sprite_enable, |
| 2728 float point_size) { |
| 2729 static_cast<ValueType*>(cmd)->Init(line_smooth_enable, point_sprite_enable, |
| 2730 point_size); |
| 2731 return NextCmdAddress<ValueType>(cmd); |
| 2732 } |
| 2733 |
| 2734 // TODO(gman): fix this to not use obfusticated fields. |
| 2735 CommandHeader header; |
739 uint32 fixme0; | 2736 uint32 fixme0; |
740 float point_size; | 2737 float point_size; |
741 }; | 2738 }; |
742 | 2739 |
743 struct SET_POLYGON_RASTER { | 2740 COMPILE_ASSERT(sizeof(SetPointLineRaster) == 12, |
744 static const CommandId kCmdId = command_buffer::SET_POLYGON_RASTER; | 2741 Sizeof_SetPointLineRaster_is_not_12); |
745 static const ArgFlags kArgFlags = kFixed; | 2742 COMPILE_ASSERT(offsetof(SetPointLineRaster, header) == 0, |
746 // TODO(gman): fix this to not use obfusticated fields. | 2743 OffsetOf_SetPointLineRaster_header_not_0); |
| 2744 COMPILE_ASSERT(offsetof(SetPointLineRaster, fixme0) == 4, |
| 2745 OffsetOf_SetPointLineRaster_fixme0_not_4); |
| 2746 COMPILE_ASSERT(offsetof(SetPointLineRaster, point_size) == 8, |
| 2747 OffsetOf_SetPointLineRaster_point_size_not_8); |
| 2748 |
| 2749 struct SetPolygonRaster { |
| 2750 typedef SetPolygonRaster ValueType; |
| 2751 static const CommandId kCmdId = command_buffer::kSetPolygonRaster; |
| 2752 static const ArgFlags kArgFlags = kFixed; |
| 2753 |
| 2754 void SetHeader() { |
| 2755 header.SetCmd<ValueType>(); |
| 2756 } |
| 2757 |
| 2758 void Init(uint32 _fill_mode, uint32 _cull_mode) { |
| 2759 SetHeader(); |
| 2760 fixme0 = |
| 2761 set_polygon_raster::FillMode::MakeValue(_fill_mode) | |
| 2762 set_polygon_raster::CullMode::MakeValue(_cull_mode); |
| 2763 } |
| 2764 |
| 2765 static void* Set(void* cmd, uint32 fill_mode, uint32 cull_mode) { |
| 2766 static_cast<ValueType*>(cmd)->Init(fill_mode, cull_mode); |
| 2767 return NextCmdAddress<ValueType>(cmd); |
| 2768 } |
| 2769 |
| 2770 // TODO(gman): fix this to not use obfusticated fields. |
| 2771 CommandHeader header; |
747 uint32 fixme0; | 2772 uint32 fixme0; |
748 }; | 2773 }; |
749 | 2774 |
750 struct SET_ALPHA_TEST { | 2775 COMPILE_ASSERT(sizeof(SetPolygonRaster) == 8, |
751 static const CommandId kCmdId = command_buffer::SET_ALPHA_TEST; | 2776 Sizeof_SetPolygonRaster_is_not_8); |
752 static const ArgFlags kArgFlags = kFixed; | 2777 COMPILE_ASSERT(offsetof(SetPolygonRaster, header) == 0, |
753 // TODO(gman): fix this to not use obfusticated fields. | 2778 OffsetOf_SetPolygonRaster_header_not_0); |
| 2779 COMPILE_ASSERT(offsetof(SetPolygonRaster, fixme0) == 4, |
| 2780 OffsetOf_SetPolygonRaster_fixme0_not_4); |
| 2781 |
| 2782 struct SetAlphaTest { |
| 2783 typedef SetAlphaTest ValueType; |
| 2784 static const CommandId kCmdId = command_buffer::kSetAlphaTest; |
| 2785 static const ArgFlags kArgFlags = kFixed; |
| 2786 |
| 2787 void SetHeader() { |
| 2788 header.SetCmd<ValueType>(); |
| 2789 } |
| 2790 |
| 2791 void Init(uint32 _func, bool _enable, float _value) { |
| 2792 SetHeader(); |
| 2793 fixme0 = |
| 2794 set_alpha_test::Func::MakeValue(_func) | |
| 2795 set_alpha_test::Enable::MakeValue(_enable ? 1 : 0); |
| 2796 value = _value; |
| 2797 } |
| 2798 |
| 2799 static void* Set(void* cmd, uint32 func, bool enable, float value) { |
| 2800 static_cast<ValueType*>(cmd)->Init(func, enable, value); |
| 2801 return NextCmdAddress<ValueType>(cmd); |
| 2802 } |
| 2803 |
| 2804 // TODO(gman): fix this to not use obfusticated fields. |
| 2805 CommandHeader header; |
754 uint32 fixme0; | 2806 uint32 fixme0; |
755 float value; | 2807 float value; |
756 }; | 2808 }; |
757 | 2809 |
758 struct SET_DEPTH_TEST { | 2810 COMPILE_ASSERT(sizeof(SetAlphaTest) == 12, Sizeof_SetAlphaTest_is_not_12); |
759 static const CommandId kCmdId = command_buffer::SET_DEPTH_TEST; | 2811 COMPILE_ASSERT(offsetof(SetAlphaTest, header) == 0, |
760 static const ArgFlags kArgFlags = kFixed; | 2812 OffsetOf_SetAlphaTest_header_not_0); |
761 // TODO(gman): fix this to not use obfusticated fields. | 2813 COMPILE_ASSERT(offsetof(SetAlphaTest, fixme0) == 4, |
| 2814 OffsetOf_SetAlphaTest_fixme0_not_4); |
| 2815 COMPILE_ASSERT(offsetof(SetAlphaTest, value) == 8, |
| 2816 OffsetOf_SetAlphaTest_value_not_8); |
| 2817 |
| 2818 struct SetDepthTest { |
| 2819 typedef SetDepthTest ValueType; |
| 2820 static const CommandId kCmdId = command_buffer::kSetDepthTest; |
| 2821 static const ArgFlags kArgFlags = kFixed; |
| 2822 |
| 2823 void SetHeader() { |
| 2824 header.SetCmd<ValueType>(); |
| 2825 } |
| 2826 |
| 2827 void Init(uint32 _func, bool _write_enable, bool _enable) { |
| 2828 SetHeader(); |
| 2829 fixme0 = |
| 2830 set_depth_test::Func::MakeValue(_func) | |
| 2831 set_depth_test::WriteEnable::MakeValue(_write_enable ? 1 : 0) | |
| 2832 set_depth_test::Enable::MakeValue(_enable ? 1 : 0); |
| 2833 } |
| 2834 |
| 2835 static void* Set(void* cmd, uint32 func, bool write_enable, bool enable) { |
| 2836 static_cast<ValueType*>(cmd)->Init(func, write_enable, enable); |
| 2837 return NextCmdAddress<ValueType>(cmd); |
| 2838 } |
| 2839 |
| 2840 // TODO(gman): fix this to not use obfusticated fields. |
| 2841 CommandHeader header; |
762 uint32 fixme0; | 2842 uint32 fixme0; |
763 }; | 2843 }; |
764 | 2844 |
765 struct SET_STENCIL_TEST { | 2845 COMPILE_ASSERT(sizeof(SetDepthTest) == 8, Sizeof_SetDepthTest_is_not_8); |
766 static const CommandId kCmdId = command_buffer::SET_STENCIL_TEST; | 2846 COMPILE_ASSERT(offsetof(SetDepthTest, header) == 0, |
767 static const ArgFlags kArgFlags = kAtLeastN; | 2847 OffsetOf_SetDepthTest_header_not_0); |
768 // TODO(gman): fix this to not use obfusticated fields. | 2848 COMPILE_ASSERT(offsetof(SetDepthTest, fixme0) == 4, |
769 }; | 2849 OffsetOf_SetDepthTest_fixme0_not_4); |
770 | 2850 |
771 struct SET_COLOR_WRITE { | 2851 struct SetStencilTest { |
772 static const CommandId kCmdId = command_buffer::SET_COLOR_WRITE; | 2852 typedef SetStencilTest ValueType; |
773 static const ArgFlags kArgFlags = kFixed; | 2853 static const CommandId kCmdId = command_buffer::kSetStencilTest; |
| 2854 static const ArgFlags kArgFlags = kFixed; |
| 2855 |
| 2856 void SetHeader() { |
| 2857 header.SetCmd<ValueType>(); |
| 2858 } |
| 2859 |
| 2860 void Init(uint8 _write_mask, |
| 2861 uint8 _compare_mask, |
| 2862 uint8 _reference_value, |
| 2863 bool _separate_ccw, |
| 2864 bool _enable, |
| 2865 uint8 _cw_func, |
| 2866 uint8 _cw_pass_op, |
| 2867 uint8 _cw_fail_op, |
| 2868 uint8 _cw_z_fail_op, |
| 2869 uint8 _ccw_func, |
| 2870 uint8 _ccw_pass_op, |
| 2871 uint8 _ccw_fail_op, |
| 2872 uint8 _ccw_z_fail_op) { |
| 2873 SetHeader(); |
| 2874 fixme0 = |
| 2875 set_stencil_test::WriteMask::MakeValue(_write_mask) | |
| 2876 set_stencil_test::CompareMask::MakeValue(_compare_mask) | |
| 2877 set_stencil_test::ReferenceValue::MakeValue(_reference_value) | |
| 2878 set_stencil_test::SeparateCCW::MakeValue(_separate_ccw ? 1 : 0) | |
| 2879 set_stencil_test::Enable::MakeValue(_enable ? 1 : 0); |
| 2880 fixme1 = |
| 2881 set_stencil_test::CWFunc::MakeValue(_cw_func) | |
| 2882 set_stencil_test::CWPassOp::MakeValue(_cw_pass_op) | |
| 2883 set_stencil_test::CWFailOp::MakeValue(_cw_fail_op) | |
| 2884 set_stencil_test::CWZFailOp::MakeValue(_cw_z_fail_op) | |
| 2885 set_stencil_test::CCWFunc::MakeValue(_ccw_func) | |
| 2886 set_stencil_test::CCWPassOp::MakeValue(_ccw_pass_op) | |
| 2887 set_stencil_test::CCWFailOp::MakeValue(_ccw_fail_op) | |
| 2888 set_stencil_test::CCWZFailOp::MakeValue(_ccw_z_fail_op); |
| 2889 } |
| 2890 |
| 2891 static void* Set( |
| 2892 void* cmd, |
| 2893 uint8 write_mask, |
| 2894 uint8 compare_mask, |
| 2895 uint8 reference_value, |
| 2896 bool separate_ccw, |
| 2897 bool enable, |
| 2898 uint8 cw_func, |
| 2899 uint8 cw_pass_op, |
| 2900 uint8 cw_fail_op, |
| 2901 uint8 cw_z_fail_op, |
| 2902 uint8 ccw_func, |
| 2903 uint8 ccw_pass_op, |
| 2904 uint8 ccw_fail_op, |
| 2905 uint8 ccw_z_fail_op) { |
| 2906 static_cast<ValueType*>(cmd)->Init( |
| 2907 write_mask, |
| 2908 compare_mask, |
| 2909 reference_value, |
| 2910 separate_ccw, |
| 2911 enable, |
| 2912 cw_func, |
| 2913 cw_pass_op, |
| 2914 cw_fail_op, |
| 2915 cw_z_fail_op, |
| 2916 ccw_func, |
| 2917 ccw_pass_op, |
| 2918 ccw_fail_op, |
| 2919 ccw_z_fail_op); |
| 2920 return NextCmdAddress<ValueType>(cmd); |
| 2921 } |
| 2922 |
| 2923 // TODO(gman): fix this to not use obfusticated fields. |
| 2924 CommandHeader header; |
| 2925 uint32 fixme0; |
| 2926 uint32 fixme1; |
| 2927 }; |
| 2928 |
| 2929 COMPILE_ASSERT(sizeof(SetStencilTest) == 12, |
| 2930 Sizeof_SetStencilTest_is_not_12); |
| 2931 COMPILE_ASSERT(offsetof(SetStencilTest, header) == 0, |
| 2932 OffsetOf_SetStencilTest_header_not_0); |
| 2933 COMPILE_ASSERT(offsetof(SetStencilTest, fixme0) == 4, |
| 2934 OffsetOf_SetStencilTest_fixme0_not_4); |
| 2935 COMPILE_ASSERT(offsetof(SetStencilTest, fixme1) == 8, |
| 2936 OffsetOf_SetStencilTest_fixme1_not_8); |
| 2937 |
| 2938 struct SetColorWrite { |
| 2939 typedef SetColorWrite ValueType; |
| 2940 static const CommandId kCmdId = command_buffer::kSetColorWrite; |
| 2941 static const ArgFlags kArgFlags = kFixed; |
| 2942 |
| 2943 void SetHeader() { |
| 2944 header.SetCmd<ValueType>(); |
| 2945 } |
| 2946 |
| 2947 void Init(uint8 _mask, bool _dither_enable) { |
| 2948 SetHeader(); |
| 2949 flags = |
| 2950 set_color_write::RedMask::MakeValue((_mask | 0x01) != 0 ? 1 : 0) | |
| 2951 set_color_write::GreenMask::MakeValue((_mask | 0x02) != 0 ? 1 : 0) | |
| 2952 set_color_write::BlueMask::MakeValue((_mask | 0x02) != 0 ? 1 : 0) | |
| 2953 set_color_write::AlphaMask::MakeValue((_mask | 0x02) != 0 ? 1 : 0) | |
| 2954 set_color_write::DitherEnable::MakeValue(_dither_enable ? 1 : 0); |
| 2955 } |
| 2956 |
| 2957 static void* Set(void* cmd, uint8 mask, bool dither_enable) { |
| 2958 static_cast<ValueType*>(cmd)->Init(mask, dither_enable); |
| 2959 return NextCmdAddress<ValueType>(cmd); |
| 2960 } |
| 2961 |
| 2962 CommandHeader header; |
774 uint32 flags; | 2963 uint32 flags; |
775 }; | 2964 }; |
776 | 2965 |
777 struct SET_BLENDING { | 2966 COMPILE_ASSERT(sizeof(SetColorWrite) == 8, Sizeof_SetColorWrite_is_not_8); |
778 static const CommandId kCmdId = command_buffer::SET_BLENDING; | 2967 COMPILE_ASSERT(offsetof(SetColorWrite, header) == 0, |
779 static const ArgFlags kArgFlags = kAtLeastN; | 2968 OffsetOf_SetColorWrite_header_not_0); |
780 // TODO(gman): fix this to not use obfusticated fields. | 2969 COMPILE_ASSERT(offsetof(SetColorWrite, flags) == 4, |
781 }; | 2970 OffsetOf_SetColorWrite_flags_not_4); |
782 | 2971 |
783 struct SET_BLENDING_COLOR { | 2972 struct SetBlending { |
784 static const CommandId kCmdId = command_buffer::SET_BLENDING_COLOR; | 2973 typedef SetBlending ValueType; |
785 static const ArgFlags kArgFlags = kFixed; | 2974 static const CommandId kCmdId = command_buffer::kSetBlending; |
| 2975 static const ArgFlags kArgFlags = kFixed; |
| 2976 |
| 2977 void SetHeader() { |
| 2978 header.SetCmd<ValueType>(); |
| 2979 } |
| 2980 |
| 2981 void Init( |
| 2982 uint8 _color_src_func, |
| 2983 uint8 _color_dst_func, |
| 2984 uint8 _color_eq, |
| 2985 uint8 _alpha_src_func, |
| 2986 uint8 _alpha_dst_func, |
| 2987 uint8 _alpha_eq, |
| 2988 bool _separate_alpha, |
| 2989 bool _enable) { |
| 2990 SetHeader(); |
| 2991 fixme0 = |
| 2992 set_blending::ColorSrcFunc::MakeValue(_color_src_func) | |
| 2993 set_blending::ColorDstFunc::MakeValue(_color_dst_func) | |
| 2994 set_blending::ColorEq::MakeValue(_color_eq) | |
| 2995 set_blending::AlphaSrcFunc::MakeValue(_alpha_src_func) | |
| 2996 set_blending::AlphaDstFunc::MakeValue(_alpha_dst_func) | |
| 2997 set_blending::AlphaEq::MakeValue(_alpha_eq) | |
| 2998 set_blending::SeparateAlpha::MakeValue(_separate_alpha ? 1 : 0) | |
| 2999 set_blending::Enable::MakeValue(_enable ? 1 : 0); |
| 3000 } |
| 3001 |
| 3002 static void* Set( |
| 3003 void* cmd, |
| 3004 uint8 color_src_func, |
| 3005 uint8 color_dst_func, |
| 3006 uint8 color_eq, |
| 3007 uint8 alpha_src_func, |
| 3008 uint8 alpha_dst_func, |
| 3009 uint8 alpha_eq, |
| 3010 bool separate_alpha, |
| 3011 bool enable) { |
| 3012 static_cast<ValueType*>(cmd)->Init( |
| 3013 color_src_func, |
| 3014 color_dst_func, |
| 3015 color_eq, |
| 3016 alpha_src_func, |
| 3017 alpha_dst_func, |
| 3018 alpha_eq, |
| 3019 separate_alpha, |
| 3020 enable); |
| 3021 return NextCmdAddress<ValueType>(cmd); |
| 3022 } |
| 3023 |
| 3024 // TODO(gman): fix this to not use obfusticated fields. |
| 3025 CommandHeader header; |
| 3026 uint32 fixme0; |
| 3027 }; |
| 3028 |
| 3029 COMPILE_ASSERT(sizeof(SetBlending) == 8, Sizeof_SetBlending_is_not_8); |
| 3030 COMPILE_ASSERT(offsetof(SetBlending, header) == 0, |
| 3031 OffsetOf_SetBlending_header_not_0); |
| 3032 COMPILE_ASSERT(offsetof(SetBlending, fixme0) == 4, |
| 3033 OffsetOf_SetBlending_fixme0_not_4); |
| 3034 |
| 3035 struct SetBlendingColor { |
| 3036 typedef SetBlendingColor ValueType; |
| 3037 static const CommandId kCmdId = command_buffer::kSetBlendingColor; |
| 3038 static const ArgFlags kArgFlags = kFixed; |
| 3039 |
| 3040 void SetHeader() { |
| 3041 header.SetCmd<ValueType>(); |
| 3042 } |
| 3043 |
| 3044 void Init(float _red, float _green, float _blue, float _alpha) { |
| 3045 SetHeader(); |
| 3046 red = _red; |
| 3047 green = _green; |
| 3048 blue = _blue; |
| 3049 alpha = _alpha; |
| 3050 } |
| 3051 |
| 3052 static void* Set(void* cmd, |
| 3053 float red, float green, float blue, float alpha) { |
| 3054 static_cast<ValueType*>(cmd)->Init(red, green, blue, alpha); |
| 3055 return NextCmdAddress<ValueType>(cmd); |
| 3056 } |
| 3057 |
| 3058 CommandHeader header; |
786 float red; | 3059 float red; |
787 float blue; | 3060 float blue; |
788 float green; | 3061 float green; |
789 float alpha; | 3062 float alpha; |
790 }; | 3063 }; |
791 | 3064 |
792 struct CREATE_RENDER_SURFACE { | 3065 COMPILE_ASSERT(sizeof(SetBlendingColor) == 20, |
793 static const CommandId kCmdId = command_buffer::CREATE_RENDER_SURFACE; | 3066 Sizeof_SetBlendingColor_is_not_20); |
794 static const ArgFlags kArgFlags = kFixed; | 3067 COMPILE_ASSERT(offsetof(SetBlendingColor, header) == 0, |
795 // TODO(gman): fix this to not use obfusticated fields. | 3068 OffsetOf_SetBlendingColor_header_not_0); |
| 3069 COMPILE_ASSERT(offsetof(SetBlendingColor, red) == 4, |
| 3070 OffsetOf_SetBlendingColor_red_not_4); |
| 3071 COMPILE_ASSERT(offsetof(SetBlendingColor, blue) == 8, |
| 3072 OffsetOf_SetBlendingColor_blue_not_8); |
| 3073 COMPILE_ASSERT(offsetof(SetBlendingColor, green) == 12, |
| 3074 OffsetOf_SetBlendingColor_green_not_12); |
| 3075 COMPILE_ASSERT(offsetof(SetBlendingColor, alpha) == 16, |
| 3076 OffsetOf_SetBlendingColor_alpha_not_16); |
| 3077 |
| 3078 struct CreateRenderSurface { |
| 3079 typedef CreateRenderSurface ValueType; |
| 3080 static const CommandId kCmdId = command_buffer::kCreateRenderSurface; |
| 3081 static const ArgFlags kArgFlags = kFixed; |
| 3082 |
| 3083 void SetHeader() { |
| 3084 header.SetCmd<ValueType>(); |
| 3085 } |
| 3086 |
| 3087 void Init(uint32 _id, uint32 _texture_id, uint32 _width, uint32 _height, |
| 3088 uint32 _level, uint32 _side) { |
| 3089 SetHeader(); |
| 3090 id = _id; |
| 3091 // TODO(gman): Why does this need a width and height. It's inherited from |
| 3092 // the texture isn't it? |
| 3093 fixme1 = |
| 3094 create_render_surface_cmd::Width::MakeValue(_width) | |
| 3095 create_render_surface_cmd::Height::MakeValue(_height); |
| 3096 fixme2 = |
| 3097 create_render_surface_cmd::Levels::MakeValue(_level) | |
| 3098 create_render_surface_cmd::Side::MakeValue(_side); |
| 3099 texture_id = _texture_id; |
| 3100 } |
| 3101 |
| 3102 static void* Set(void* cmd, uint32 id, uint32 texture_id, |
| 3103 uint32 width, uint32 height, |
| 3104 uint32 level, uint32 side) { |
| 3105 static_cast<ValueType*>(cmd)->Init(id, texture_id, width, height, |
| 3106 level, side); |
| 3107 return NextCmdAddress<ValueType>(cmd); |
| 3108 } |
| 3109 |
| 3110 // TODO(gman): fix this to not use obfusticated fields. |
| 3111 CommandHeader header; |
796 uint32 id; | 3112 uint32 id; |
797 uint32 fixme1; | 3113 uint32 fixme1; |
798 uint32 fixme2; | 3114 uint32 fixme2; |
799 uint32 texture_id; | 3115 uint32 texture_id; |
800 }; | 3116 }; |
801 | 3117 |
802 struct DESTROY_RENDER_SURFACE { | 3118 COMPILE_ASSERT(sizeof(CreateRenderSurface) == 20, |
803 static const CommandId kCmdId = command_buffer::DESTROY_RENDER_SURFACE; | 3119 Sizeof_CreateRenderSurface_is_not_20); |
804 static const ArgFlags kArgFlags = kFixed; | 3120 COMPILE_ASSERT(offsetof(CreateRenderSurface, header) == 0, |
| 3121 OffsetOf_CreateRenderSurface_header_not_0); |
| 3122 COMPILE_ASSERT(offsetof(CreateRenderSurface, id) == 4, |
| 3123 OffsetOf_CreateRenderSurface_id_not_4); |
| 3124 COMPILE_ASSERT(offsetof(CreateRenderSurface, fixme1) == 8, |
| 3125 OffsetOf_CreateRenderSurface_fixme1_not_8); |
| 3126 COMPILE_ASSERT(offsetof(CreateRenderSurface, fixme2) == 12, |
| 3127 OffsetOf_CreateRenderSurface_fixme2_not_12); |
| 3128 COMPILE_ASSERT(offsetof(CreateRenderSurface, texture_id) == 16, |
| 3129 OffsetOf_CreateRenderSurface_texture_id_not_16); |
| 3130 |
| 3131 struct DestroyRenderSurface { |
| 3132 typedef DestroyRenderSurface ValueType; |
| 3133 static const CommandId kCmdId = command_buffer::kDestroyRenderSurface; |
| 3134 static const ArgFlags kArgFlags = kFixed; |
| 3135 |
| 3136 void SetHeader() { |
| 3137 header.SetCmd<ValueType>(); |
| 3138 } |
| 3139 |
| 3140 void Init(uint32 _id) { |
| 3141 SetHeader(); |
| 3142 id = _id; |
| 3143 } |
| 3144 |
| 3145 static void* Set(void* cmd, uint32 id) { |
| 3146 static_cast<ValueType*>(cmd)->Init(id); |
| 3147 return NextCmdAddress<ValueType>(cmd); |
| 3148 } |
| 3149 |
| 3150 CommandHeader header; |
805 uint32 id; | 3151 uint32 id; |
806 }; | 3152 }; |
807 | 3153 |
808 struct CREATE_DEPTH_SURFACE { | 3154 COMPILE_ASSERT(sizeof(DestroyRenderSurface) == 8, |
809 static const CommandId kCmdId = command_buffer::CREATE_DEPTH_SURFACE; | 3155 Sizeof_DestroyRenderSurface_is_not_8); |
810 static const ArgFlags kArgFlags = kFixed; | 3156 COMPILE_ASSERT(offsetof(DestroyRenderSurface, header) == 0, |
811 // TODO(gman): fix this to not use obfusticated fields. | 3157 OffsetOf_DestroyRenderSurface_header_not_0); |
| 3158 COMPILE_ASSERT(offsetof(DestroyRenderSurface, id) == 4, |
| 3159 OffsetOf_DestroyRenderSurface_id_not_4); |
| 3160 |
| 3161 struct CreateDepthSurface { |
| 3162 typedef CreateDepthSurface ValueType; |
| 3163 static const CommandId kCmdId = command_buffer::kCreateDepthSurface; |
| 3164 static const ArgFlags kArgFlags = kFixed; |
| 3165 |
| 3166 void SetHeader() { |
| 3167 header.SetCmd<ValueType>(); |
| 3168 } |
| 3169 |
| 3170 void Init(uint32 _id, uint32 _width, uint32 _height) { |
| 3171 SetHeader(); |
| 3172 id = _id; |
| 3173 fixme1 = |
| 3174 create_depth_surface_cmd::Width::MakeValue(_width) | |
| 3175 create_depth_surface_cmd::Height::MakeValue(_height); |
| 3176 } |
| 3177 |
| 3178 static void* Set(void* cmd, uint32 id, uint32 width, uint32 height) { |
| 3179 static_cast<ValueType*>(cmd)->Init(id, width, height); |
| 3180 return NextCmdAddress<ValueType>(cmd); |
| 3181 } |
| 3182 |
| 3183 // TODO(gman): fix this to not use obfusticated fields. |
| 3184 CommandHeader header; |
812 uint32 id; | 3185 uint32 id; |
813 uint32 fixme1; | 3186 uint32 fixme1; |
814 }; | 3187 }; |
815 | 3188 |
816 struct DESTROY_DEPTH_SURFACE { | 3189 COMPILE_ASSERT(sizeof(CreateDepthSurface) == 12, |
817 static const CommandId kCmdId = command_buffer::DESTROY_DEPTH_SURFACE; | 3190 Sizeof_CreateDepthSurface_is_not_12); |
818 static const ArgFlags kArgFlags = kFixed; | 3191 COMPILE_ASSERT(offsetof(CreateDepthSurface, header) == 0, |
| 3192 OffsetOf_CreateDepthSurface_header_not_0); |
| 3193 COMPILE_ASSERT(offsetof(CreateDepthSurface, id) == 4, |
| 3194 OffsetOf_CreateDepthSurface_id_not_4); |
| 3195 COMPILE_ASSERT(offsetof(CreateDepthSurface, fixme1) == 8, |
| 3196 OffsetOf_CreateDepthSurface_fixme1_not_8); |
| 3197 |
| 3198 struct DestroyDepthSurface { |
| 3199 typedef DestroyDepthSurface ValueType; |
| 3200 static const CommandId kCmdId = command_buffer::kDestroyDepthSurface; |
| 3201 static const ArgFlags kArgFlags = kFixed; |
| 3202 |
| 3203 void SetHeader() { |
| 3204 header.SetCmd<ValueType>(); |
| 3205 } |
| 3206 |
| 3207 void Init(uint32 _id) { |
| 3208 SetHeader(); |
| 3209 id = _id; |
| 3210 } |
| 3211 |
| 3212 static void* Set(void* cmd, uint32 id) { |
| 3213 static_cast<ValueType*>(cmd)->Init(id); |
| 3214 return NextCmdAddress<ValueType>(cmd); |
| 3215 } |
| 3216 |
| 3217 CommandHeader header; |
819 uint32 id; | 3218 uint32 id; |
820 }; | 3219 }; |
821 | 3220 |
822 struct SET_RENDER_SURFACE { | 3221 COMPILE_ASSERT(sizeof(DestroyDepthSurface) == 8, |
823 static const CommandId kCmdId = command_buffer::SET_RENDER_SURFACE; | 3222 Sizeof_DestroyDepthSurface_is_not_8); |
824 static const ArgFlags kArgFlags = kFixed; | 3223 COMPILE_ASSERT(offsetof(DestroyDepthSurface, header) == 0, |
| 3224 OffsetOf_DestroyDepthSurface_header_not_0); |
| 3225 COMPILE_ASSERT(offsetof(DestroyDepthSurface, id) == 4, |
| 3226 OffsetOf_DestroyDepthSurface_id_not_4); |
| 3227 |
| 3228 struct SetRenderSurface { |
| 3229 typedef SetRenderSurface ValueType; |
| 3230 static const CommandId kCmdId = command_buffer::kSetRenderSurface; |
| 3231 static const ArgFlags kArgFlags = kFixed; |
| 3232 |
| 3233 void SetHeader() { |
| 3234 header.SetCmd<ValueType>(); |
| 3235 } |
| 3236 |
| 3237 void Init(uint32 _render_surface_id, uint32 _depth_surface_id) { |
| 3238 SetHeader(); |
| 3239 render_surface_id = _render_surface_id; |
| 3240 depth_surface_id = _depth_surface_id; |
| 3241 } |
| 3242 |
| 3243 static void* Set(void* cmd, |
| 3244 uint32 render_surface_id, uint32 depth_surface_id) { |
| 3245 static_cast<ValueType*>(cmd)->Init(render_surface_id, depth_surface_id); |
| 3246 return NextCmdAddress<ValueType>(cmd); |
| 3247 } |
| 3248 |
| 3249 CommandHeader header; |
825 uint32 render_surface_id; | 3250 uint32 render_surface_id; |
826 uint32 depth_surface_id; | 3251 uint32 depth_surface_id; |
827 }; | 3252 }; |
828 | 3253 |
829 struct SET_BACK_SURFACES { | 3254 COMPILE_ASSERT(sizeof(SetRenderSurface) == 12, |
830 static const CommandId kCmdId = command_buffer::SET_BACK_SURFACES; | 3255 Sizeof_SetRenderSurface_is_not_12); |
831 static const ArgFlags kArgFlags = kFixed; | 3256 COMPILE_ASSERT(offsetof(SetRenderSurface, header) == 0, |
832 }; | 3257 OffsetOf_SetRenderSurface_header_not_0); |
| 3258 COMPILE_ASSERT(offsetof(SetRenderSurface, render_surface_id) == 4, |
| 3259 OffsetOf_SetRenderSurface_render_surface_id_not_4); |
| 3260 COMPILE_ASSERT(offsetof(SetRenderSurface, depth_surface_id) == 8, |
| 3261 OffsetOf_SetRenderSurface_depth_surface_id_not_8); |
| 3262 |
| 3263 struct SetBackSurfaces { |
| 3264 typedef SetBackSurfaces ValueType; |
| 3265 static const CommandId kCmdId = command_buffer::kSetBackSurfaces; |
| 3266 static const ArgFlags kArgFlags = kFixed; |
| 3267 |
| 3268 void SetHeader() { |
| 3269 header.SetCmd<ValueType>(); |
| 3270 } |
| 3271 |
| 3272 void Init() { |
| 3273 SetHeader(); |
| 3274 } |
| 3275 |
| 3276 static void* Set(void* cmd) { |
| 3277 static_cast<ValueType*>(cmd)->Init(); |
| 3278 return NextCmdAddress<ValueType>(cmd); |
| 3279 } |
| 3280 |
| 3281 CommandHeader header; |
| 3282 }; |
| 3283 |
| 3284 COMPILE_ASSERT(sizeof(SetBackSurfaces) == 4, |
| 3285 Sizeof_SetBackSurfaces_is_not_4); |
| 3286 COMPILE_ASSERT(offsetof(SetBackSurfaces, header) == 0, |
| 3287 OffsetOf_SetBackSurfaces_header_not_0); |
833 | 3288 |
834 O3D_POP_STRUCTURE_PACKING; | 3289 O3D_POP_STRUCTURE_PACKING; |
835 | 3290 |
836 } // namespace cmd | 3291 } // namespace cmd |
837 | 3292 |
838 } // namespace command_buffer | 3293 } // namespace command_buffer |
839 } // namespace o3d | 3294 } // namespace o3d |
840 | 3295 |
841 #endif // O3D_COMMAND_BUFFER_COMMON_CROSS_CMD_BUFFER_FORMAT_H_ | 3296 #endif // O3D_COMMAND_BUFFER_COMMON_CROSS_CMD_BUFFER_FORMAT_H_ |
OLD | NEW |