| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file defines the GLES2 command buffer commands. | 5 // This file defines the GLES2 command buffer commands. |
| 6 | 6 |
| 7 #ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_ | 7 #ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_ |
| 8 #define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_ | 8 #define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_ |
| 9 | 9 |
| 10 | 10 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 OffsetOf_ProgramInfoHeader_num_attribs_not_4); | 192 OffsetOf_ProgramInfoHeader_num_attribs_not_4); |
| 193 COMPILE_ASSERT(offsetof(ProgramInfoHeader, num_uniforms) == 8, | 193 COMPILE_ASSERT(offsetof(ProgramInfoHeader, num_uniforms) == 8, |
| 194 OffsetOf_ProgramInfoHeader_num_uniforms_not_8); | 194 OffsetOf_ProgramInfoHeader_num_uniforms_not_8); |
| 195 | 195 |
| 196 namespace cmds { | 196 namespace cmds { |
| 197 | 197 |
| 198 #include "../common/gles2_cmd_format_autogen.h" | 198 #include "../common/gles2_cmd_format_autogen.h" |
| 199 | 199 |
| 200 // These are hand written commands. | 200 // These are hand written commands. |
| 201 // TODO(gman): Attempt to make these auto-generated. | 201 // TODO(gman): Attempt to make these auto-generated. |
| 202 struct GetAttribLocation { | |
| 203 typedef GetAttribLocation ValueType; | |
| 204 static const CommandId kCmdId = kGetAttribLocation; | |
| 205 static const cmd::ArgFlags kArgFlags = cmd::kFixed; | |
| 206 static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3); | |
| 207 | |
| 208 typedef GLint Result; | |
| 209 | |
| 210 static uint32 ComputeSize() { | |
| 211 return static_cast<uint32>(sizeof(ValueType)); // NOLINT | |
| 212 } | |
| 213 | |
| 214 void SetHeader() { | |
| 215 header.SetCmd<ValueType>(); | |
| 216 } | |
| 217 | |
| 218 void Init( | |
| 219 GLuint _program, uint32 _name_bucket_id, | |
| 220 uint32 _location_shm_id, uint32 _location_shm_offset) { | |
| 221 SetHeader(); | |
| 222 program = _program; | |
| 223 name_bucket_id = _name_bucket_id; | |
| 224 location_shm_id = _location_shm_id; | |
| 225 location_shm_offset = _location_shm_offset; | |
| 226 } | |
| 227 | |
| 228 void* Set( | |
| 229 void* cmd, GLuint _program, uint32 _name_bucket_id, | |
| 230 uint32 _location_shm_id, uint32 _location_shm_offset) { | |
| 231 static_cast<ValueType*>( | |
| 232 cmd)->Init( | |
| 233 _program, _name_bucket_id, _location_shm_id, | |
| 234 _location_shm_offset); | |
| 235 return NextCmdAddress<ValueType>(cmd); | |
| 236 } | |
| 237 | |
| 238 CommandHeader header; | |
| 239 uint32 program; | |
| 240 uint32 name_bucket_id; | |
| 241 uint32 location_shm_id; | |
| 242 uint32 location_shm_offset; | |
| 243 }; | |
| 244 | |
| 245 COMPILE_ASSERT(sizeof(GetAttribLocation) == 20, | |
| 246 Sizeof_GetAttribLocation_is_not_24); | |
| 247 COMPILE_ASSERT(offsetof(GetAttribLocation, header) == 0, | |
| 248 OffsetOf_GetAttribLocation_header_not_0); | |
| 249 COMPILE_ASSERT(offsetof(GetAttribLocation, program) == 4, | |
| 250 OffsetOf_GetAttribLocation_program_not_4); | |
| 251 COMPILE_ASSERT(offsetof(GetAttribLocation, name_bucket_id) == 8, | |
| 252 OffsetOf_GetAttribLocation_name_bucket_id_not_8); | |
| 253 COMPILE_ASSERT(offsetof(GetAttribLocation, location_shm_id) == 12, | |
| 254 OffsetOf_GetAttribLocation_location_shm_id_not_12); | |
| 255 COMPILE_ASSERT(offsetof(GetAttribLocation, location_shm_offset) == 16, | |
| 256 OffsetOf_GetAttribLocation_location_shm_offset_not_16); | |
| 257 | |
| 258 struct GetUniformLocation { | |
| 259 typedef GetUniformLocation ValueType; | |
| 260 static const CommandId kCmdId = kGetUniformLocation; | |
| 261 static const cmd::ArgFlags kArgFlags = cmd::kFixed; | |
| 262 static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3); | |
| 263 | |
| 264 typedef GLint Result; | |
| 265 | |
| 266 static uint32 ComputeSize() { | |
| 267 return static_cast<uint32>(sizeof(ValueType)); // NOLINT | |
| 268 } | |
| 269 | |
| 270 void SetHeader() { | |
| 271 header.SetCmd<ValueType>(); | |
| 272 } | |
| 273 | |
| 274 void Init( | |
| 275 GLuint _program, uint32 _name_bucket_id, | |
| 276 uint32 _location_shm_id, uint32 _location_shm_offset) { | |
| 277 SetHeader(); | |
| 278 program = _program; | |
| 279 name_bucket_id = _name_bucket_id; | |
| 280 location_shm_id = _location_shm_id; | |
| 281 location_shm_offset = _location_shm_offset; | |
| 282 } | |
| 283 | |
| 284 void* Set( | |
| 285 void* cmd, GLuint _program, uint32 _name_bucket_id, | |
| 286 uint32 _location_shm_id, uint32 _location_shm_offset) { | |
| 287 static_cast<ValueType*>( | |
| 288 cmd)->Init( | |
| 289 _program, _name_bucket_id, _location_shm_id, | |
| 290 _location_shm_offset); | |
| 291 return NextCmdAddress<ValueType>(cmd); | |
| 292 } | |
| 293 | |
| 294 CommandHeader header; | |
| 295 uint32 program; | |
| 296 uint32 name_bucket_id; | |
| 297 uint32 location_shm_id; | |
| 298 uint32 location_shm_offset; | |
| 299 }; | |
| 300 | |
| 301 COMPILE_ASSERT(sizeof(GetUniformLocation) == 20, | |
| 302 Sizeof_GetUniformLocation_is_not_24); | |
| 303 COMPILE_ASSERT(offsetof(GetUniformLocation, header) == 0, | |
| 304 OffsetOf_GetUniformLocation_header_not_0); | |
| 305 COMPILE_ASSERT(offsetof(GetUniformLocation, program) == 4, | |
| 306 OffsetOf_GetUniformLocation_program_not_4); | |
| 307 COMPILE_ASSERT(offsetof(GetUniformLocation, name_bucket_id) == 8, | |
| 308 OffsetOf_GetUniformLocation_name_bucket_id_not_8); | |
| 309 COMPILE_ASSERT(offsetof(GetUniformLocation, location_shm_id) == 12, | |
| 310 OffsetOf_GetUniformLocation_location_shm_id_not_12); | |
| 311 COMPILE_ASSERT(offsetof(GetUniformLocation, location_shm_offset) == 16, | |
| 312 OffsetOf_GetUniformLocation_location_shm_offset_not_16); | |
| 313 | 202 |
| 314 struct GenMailboxCHROMIUM { | 203 struct GenMailboxCHROMIUM { |
| 315 typedef GenMailboxCHROMIUM ValueType; | 204 typedef GenMailboxCHROMIUM ValueType; |
| 316 static const CommandId kCmdId = kGenMailboxCHROMIUM; | 205 static const CommandId kCmdId = kGenMailboxCHROMIUM; |
| 317 static const cmd::ArgFlags kArgFlags = cmd::kFixed; | 206 static const cmd::ArgFlags kArgFlags = cmd::kFixed; |
| 318 static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3); | 207 static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3); |
| 319 CommandHeader header; | 208 CommandHeader header; |
| 320 }; | 209 }; |
| 321 | 210 |
| 322 struct InsertSyncPointCHROMIUM { | 211 struct InsertSyncPointCHROMIUM { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 OffsetOf_CreateAndConsumeTextureCHROMIUMImmediate_client_id_not_8); | 267 OffsetOf_CreateAndConsumeTextureCHROMIUMImmediate_client_id_not_8); |
| 379 | 268 |
| 380 | 269 |
| 381 #pragma pack(pop) | 270 #pragma pack(pop) |
| 382 | 271 |
| 383 } // namespace cmd | 272 } // namespace cmd |
| 384 } // namespace gles2 | 273 } // namespace gles2 |
| 385 } // namespace gpu | 274 } // namespace gpu |
| 386 | 275 |
| 387 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_ | 276 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_ |
| OLD | NEW |