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