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

Side by Side Diff: gpu/command_buffer/common/gles2_cmd_format.h

Issue 282253002: Remove unneeded shm versions of bucket functions from command buffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no-shm-for-immediate-commands
Patch Set: rebase (1 new added hunk) Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
203 struct GetAttribLocation { 202 struct GetAttribLocation {
204 typedef GetAttribLocation ValueType; 203 typedef GetAttribLocation ValueType;
205 static const CommandId kCmdId = kGetAttribLocation; 204 static const CommandId kCmdId = kGetAttribLocation;
206 static const cmd::ArgFlags kArgFlags = cmd::kFixed; 205 static const cmd::ArgFlags kArgFlags = cmd::kFixed;
207 static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3); 206 static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3);
208 207
209 typedef GLint Result; 208 typedef GLint Result;
210 209
211 static uint32 ComputeSize() { 210 static uint32 ComputeSize() {
212 return static_cast<uint32>(sizeof(ValueType)); // NOLINT 211 return static_cast<uint32>(sizeof(ValueType)); // NOLINT
213 } 212 }
214 213
215 void SetHeader() { 214 void SetHeader() {
216 header.SetCmd<ValueType>(); 215 header.SetCmd<ValueType>();
217 } 216 }
218 217
219 void Init( 218 void Init(
220 GLuint _program, uint32 _name_shm_id, uint32 _name_shm_offset,
221 uint32 _location_shm_id, uint32 _location_shm_offset,
222 uint32 _data_size) {
223 SetHeader();
224 program = _program;
225 name_shm_id = _name_shm_id;
226 name_shm_offset = _name_shm_offset;
227 location_shm_id = _location_shm_id;
228 location_shm_offset = _location_shm_offset;
229 data_size = _data_size;
230 }
231
232 void* Set(
233 void* cmd, GLuint _program, uint32 _name_shm_id, uint32 _name_shm_offset,
234 uint32 _location_shm_id, uint32 _location_shm_offset,
235 uint32 _data_size) {
236 static_cast<ValueType*>(
237 cmd)->Init(
238 _program, _name_shm_id, _name_shm_offset, _location_shm_id,
239 _location_shm_offset, _data_size);
240 return NextCmdAddress<ValueType>(cmd);
241 }
242
243 CommandHeader header;
244 uint32 program;
245 uint32 name_shm_id;
246 uint32 name_shm_offset;
247 uint32 location_shm_id;
248 uint32 location_shm_offset;
249 uint32 data_size;
250 };
251
252 COMPILE_ASSERT(sizeof(GetAttribLocation) == 28,
253 Sizeof_GetAttribLocation_is_not_28);
254 COMPILE_ASSERT(offsetof(GetAttribLocation, header) == 0,
255 OffsetOf_GetAttribLocation_header_not_0);
256 COMPILE_ASSERT(offsetof(GetAttribLocation, program) == 4,
257 OffsetOf_GetAttribLocation_program_not_4);
258 COMPILE_ASSERT(offsetof(GetAttribLocation, name_shm_id) == 8,
259 OffsetOf_GetAttribLocation_name_shm_id_not_8);
260 COMPILE_ASSERT(offsetof(GetAttribLocation, name_shm_offset) == 12,
261 OffsetOf_GetAttribLocation_name_shm_offset_not_12);
262 COMPILE_ASSERT(offsetof(GetAttribLocation, location_shm_id) == 16,
263 OffsetOf_GetAttribLocation_location_shm_id_not_16);
264 COMPILE_ASSERT(offsetof(GetAttribLocation, location_shm_offset) == 20,
265 OffsetOf_GetAttribLocation_location_shm_offset_not_20);
266 COMPILE_ASSERT(offsetof(GetAttribLocation, data_size) == 24,
267 OffsetOf_GetAttribLocation_data_size_not_24);
268
269
270 struct GetAttribLocationBucket {
271 typedef GetAttribLocationBucket ValueType;
272 static const CommandId kCmdId = kGetAttribLocationBucket;
273 static const cmd::ArgFlags kArgFlags = cmd::kFixed;
274 static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3);
275
276 typedef GLint Result;
277
278 static uint32 ComputeSize() {
279 return static_cast<uint32>(sizeof(ValueType)); // NOLINT
280 }
281
282 void SetHeader() {
283 header.SetCmd<ValueType>();
284 }
285
286 void Init(
287 GLuint _program, uint32 _name_bucket_id, 219 GLuint _program, uint32 _name_bucket_id,
288 uint32 _location_shm_id, uint32 _location_shm_offset) { 220 uint32 _location_shm_id, uint32 _location_shm_offset) {
289 SetHeader(); 221 SetHeader();
290 program = _program; 222 program = _program;
291 name_bucket_id = _name_bucket_id; 223 name_bucket_id = _name_bucket_id;
292 location_shm_id = _location_shm_id; 224 location_shm_id = _location_shm_id;
293 location_shm_offset = _location_shm_offset; 225 location_shm_offset = _location_shm_offset;
294 } 226 }
295 227
296 void* Set( 228 void* Set(
297 void* cmd, GLuint _program, uint32 _name_bucket_id, 229 void* cmd, GLuint _program, uint32 _name_bucket_id,
298 uint32 _location_shm_id, uint32 _location_shm_offset) { 230 uint32 _location_shm_id, uint32 _location_shm_offset) {
299 static_cast<ValueType*>( 231 static_cast<ValueType*>(
300 cmd)->Init( 232 cmd)->Init(
301 _program, _name_bucket_id, _location_shm_id, 233 _program, _name_bucket_id, _location_shm_id,
302 _location_shm_offset); 234 _location_shm_offset);
303 return NextCmdAddress<ValueType>(cmd); 235 return NextCmdAddress<ValueType>(cmd);
304 } 236 }
305 237
306 CommandHeader header; 238 CommandHeader header;
307 uint32 program; 239 uint32 program;
308 uint32 name_bucket_id; 240 uint32 name_bucket_id;
309 uint32 location_shm_id; 241 uint32 location_shm_id;
310 uint32 location_shm_offset; 242 uint32 location_shm_offset;
311 }; 243 };
312 244
313 COMPILE_ASSERT(sizeof(GetAttribLocationBucket) == 20, 245 COMPILE_ASSERT(sizeof(GetAttribLocation) == 20,
314 Sizeof_GetAttribLocationBucket_is_not_24); 246 Sizeof_GetAttribLocation_is_not_24);
315 COMPILE_ASSERT(offsetof(GetAttribLocationBucket, header) == 0, 247 COMPILE_ASSERT(offsetof(GetAttribLocation, header) == 0,
316 OffsetOf_GetAttribLocationBucket_header_not_0); 248 OffsetOf_GetAttribLocation_header_not_0);
317 COMPILE_ASSERT(offsetof(GetAttribLocationBucket, program) == 4, 249 COMPILE_ASSERT(offsetof(GetAttribLocation, program) == 4,
318 OffsetOf_GetAttribLocationBucket_program_not_4); 250 OffsetOf_GetAttribLocation_program_not_4);
319 COMPILE_ASSERT(offsetof(GetAttribLocationBucket, name_bucket_id) == 8, 251 COMPILE_ASSERT(offsetof(GetAttribLocation, name_bucket_id) == 8,
320 OffsetOf_GetAttribLocationBucket_name_bucket_id_not_8); 252 OffsetOf_GetAttribLocation_name_bucket_id_not_8);
321 COMPILE_ASSERT(offsetof(GetAttribLocationBucket, location_shm_id) == 12, 253 COMPILE_ASSERT(offsetof(GetAttribLocation, location_shm_id) == 12,
322 OffsetOf_GetAttribLocationBucket_location_shm_id_not_12); 254 OffsetOf_GetAttribLocation_location_shm_id_not_12);
323 COMPILE_ASSERT(offsetof(GetAttribLocationBucket, location_shm_offset) == 16, 255 COMPILE_ASSERT(offsetof(GetAttribLocation, location_shm_offset) == 16,
324 OffsetOf_GetAttribLocationBucket_location_shm_offset_not_16); 256 OffsetOf_GetAttribLocation_location_shm_offset_not_16);
325 257
326 struct GetUniformLocation { 258 struct GetUniformLocation {
327 typedef GetUniformLocation ValueType; 259 typedef GetUniformLocation ValueType;
328 static const CommandId kCmdId = kGetUniformLocation; 260 static const CommandId kCmdId = kGetUniformLocation;
329 static const cmd::ArgFlags kArgFlags = cmd::kFixed; 261 static const cmd::ArgFlags kArgFlags = cmd::kFixed;
330 static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3); 262 static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3);
331 263
332 typedef GLint Result; 264 typedef GLint Result;
333 265
334 static uint32 ComputeSize() { 266 static uint32 ComputeSize() {
335 return static_cast<uint32>(sizeof(ValueType)); // NOLINT 267 return static_cast<uint32>(sizeof(ValueType)); // NOLINT
336 } 268 }
337 269
338 void SetHeader() { 270 void SetHeader() {
339 header.SetCmd<ValueType>(); 271 header.SetCmd<ValueType>();
340 } 272 }
341 273
342 void Init( 274 void Init(
343 GLuint _program, uint32 _name_shm_id, uint32 _name_shm_offset,
344 uint32 _location_shm_id, uint32 _location_shm_offset,
345 uint32 _data_size) {
346 SetHeader();
347 program = _program;
348 name_shm_id = _name_shm_id;
349 name_shm_offset = _name_shm_offset;
350 location_shm_id = _location_shm_id;
351 location_shm_offset = _location_shm_offset;
352 data_size = _data_size;
353 }
354
355 void* Set(
356 void* cmd, GLuint _program, uint32 _name_shm_id, uint32 _name_shm_offset,
357 uint32 _location_shm_id, uint32 _location_shm_offset,
358 uint32 _data_size) {
359 static_cast<ValueType*>(
360 cmd)->Init(
361 _program, _name_shm_id, _name_shm_offset, _location_shm_id,
362 _location_shm_offset, _data_size);
363 return NextCmdAddress<ValueType>(cmd);
364 }
365
366 CommandHeader header;
367 uint32 program;
368 uint32 name_shm_id;
369 uint32 name_shm_offset;
370 uint32 location_shm_id;
371 uint32 location_shm_offset;
372 uint32 data_size;
373 };
374
375 COMPILE_ASSERT(sizeof(GetUniformLocation) == 28,
376 Sizeof_GetUniformLocation_is_not_28);
377 COMPILE_ASSERT(offsetof(GetUniformLocation, header) == 0,
378 OffsetOf_GetUniformLocation_header_not_0);
379 COMPILE_ASSERT(offsetof(GetUniformLocation, program) == 4,
380 OffsetOf_GetUniformLocation_program_not_4);
381 COMPILE_ASSERT(offsetof(GetUniformLocation, name_shm_id) == 8,
382 OffsetOf_GetUniformLocation_name_shm_id_not_8);
383 COMPILE_ASSERT(offsetof(GetUniformLocation, name_shm_offset) == 12,
384 OffsetOf_GetUniformLocation_name_shm_offset_not_12);
385 COMPILE_ASSERT(offsetof(GetUniformLocation, location_shm_id) == 16,
386 OffsetOf_GetUniformLocation_location_shm_id_not_16);
387 COMPILE_ASSERT(offsetof(GetUniformLocation, location_shm_offset) == 20,
388 OffsetOf_GetUniformLocation_location_shm_offset_not_20);
389 COMPILE_ASSERT(offsetof(GetUniformLocation, data_size) == 24,
390 OffsetOf_GetUniformLocation_data_size_not_24);
391
392 struct GetUniformLocationBucket {
393 typedef GetUniformLocationBucket ValueType;
394 static const CommandId kCmdId = kGetUniformLocationBucket;
395 static const cmd::ArgFlags kArgFlags = cmd::kFixed;
396 static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3);
397
398 typedef GLint Result;
399
400 static uint32 ComputeSize() {
401 return static_cast<uint32>(sizeof(ValueType)); // NOLINT
402 }
403
404 void SetHeader() {
405 header.SetCmd<ValueType>();
406 }
407
408 void Init(
409 GLuint _program, uint32 _name_bucket_id, 275 GLuint _program, uint32 _name_bucket_id,
410 uint32 _location_shm_id, uint32 _location_shm_offset) { 276 uint32 _location_shm_id, uint32 _location_shm_offset) {
411 SetHeader(); 277 SetHeader();
412 program = _program; 278 program = _program;
413 name_bucket_id = _name_bucket_id; 279 name_bucket_id = _name_bucket_id;
414 location_shm_id = _location_shm_id; 280 location_shm_id = _location_shm_id;
415 location_shm_offset = _location_shm_offset; 281 location_shm_offset = _location_shm_offset;
416 } 282 }
417 283
418 void* Set( 284 void* Set(
419 void* cmd, GLuint _program, uint32 _name_bucket_id, 285 void* cmd, GLuint _program, uint32 _name_bucket_id,
420 uint32 _location_shm_id, uint32 _location_shm_offset) { 286 uint32 _location_shm_id, uint32 _location_shm_offset) {
421 static_cast<ValueType*>( 287 static_cast<ValueType*>(
422 cmd)->Init( 288 cmd)->Init(
423 _program, _name_bucket_id, _location_shm_id, 289 _program, _name_bucket_id, _location_shm_id,
424 _location_shm_offset); 290 _location_shm_offset);
425 return NextCmdAddress<ValueType>(cmd); 291 return NextCmdAddress<ValueType>(cmd);
426 } 292 }
427 293
428 CommandHeader header; 294 CommandHeader header;
429 uint32 program; 295 uint32 program;
430 uint32 name_bucket_id; 296 uint32 name_bucket_id;
431 uint32 location_shm_id; 297 uint32 location_shm_id;
432 uint32 location_shm_offset; 298 uint32 location_shm_offset;
433 }; 299 };
434 300
435 COMPILE_ASSERT(sizeof(GetUniformLocationBucket) == 20, 301 COMPILE_ASSERT(sizeof(GetUniformLocation) == 20,
436 Sizeof_GetUniformLocationBucket_is_not_24); 302 Sizeof_GetUniformLocation_is_not_24);
437 COMPILE_ASSERT(offsetof(GetUniformLocationBucket, header) == 0, 303 COMPILE_ASSERT(offsetof(GetUniformLocation, header) == 0,
438 OffsetOf_GetUniformLocationBucket_header_not_0); 304 OffsetOf_GetUniformLocation_header_not_0);
439 COMPILE_ASSERT(offsetof(GetUniformLocationBucket, program) == 4, 305 COMPILE_ASSERT(offsetof(GetUniformLocation, program) == 4,
440 OffsetOf_GetUniformLocationBucket_program_not_4); 306 OffsetOf_GetUniformLocation_program_not_4);
441 COMPILE_ASSERT(offsetof(GetUniformLocationBucket, name_bucket_id) == 8, 307 COMPILE_ASSERT(offsetof(GetUniformLocation, name_bucket_id) == 8,
442 OffsetOf_GetUniformLocationBucket_name_bucket_id_not_8); 308 OffsetOf_GetUniformLocation_name_bucket_id_not_8);
443 COMPILE_ASSERT(offsetof(GetUniformLocationBucket, location_shm_id) == 12, 309 COMPILE_ASSERT(offsetof(GetUniformLocation, location_shm_id) == 12,
444 OffsetOf_GetUniformLocationBucket_location_shm_id_not_12); 310 OffsetOf_GetUniformLocation_location_shm_id_not_12);
445 COMPILE_ASSERT(offsetof(GetUniformLocationBucket, location_shm_offset) == 16, 311 COMPILE_ASSERT(offsetof(GetUniformLocation, location_shm_offset) == 16,
446 OffsetOf_GetUniformLocationBucket_location_shm_offset_not_16); 312 OffsetOf_GetUniformLocation_location_shm_offset_not_16);
447 313
448 struct GenMailboxCHROMIUM { 314 struct GenMailboxCHROMIUM {
449 typedef GenMailboxCHROMIUM ValueType; 315 typedef GenMailboxCHROMIUM ValueType;
450 static const CommandId kCmdId = kGenMailboxCHROMIUM; 316 static const CommandId kCmdId = kGenMailboxCHROMIUM;
451 static const cmd::ArgFlags kArgFlags = cmd::kFixed; 317 static const cmd::ArgFlags kArgFlags = cmd::kFixed;
452 static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3); 318 static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3);
453 CommandHeader header; 319 CommandHeader header;
454 }; 320 };
455 321
456 struct InsertSyncPointCHROMIUM { 322 struct InsertSyncPointCHROMIUM {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 OffsetOf_CreateAndConsumeTextureCHROMIUMImmediate_client_id_not_8); 378 OffsetOf_CreateAndConsumeTextureCHROMIUMImmediate_client_id_not_8);
513 379
514 380
515 #pragma pack(pop) 381 #pragma pack(pop)
516 382
517 } // namespace cmd 383 } // namespace cmd
518 } // namespace gles2 384 } // namespace gles2
519 } // namespace gpu 385 } // namespace gpu
520 386
521 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_ 387 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698