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

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

Issue 147237: Adding GetStreamInfo functionality (and passing corresponding unit test). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2009, Google Inc. 2 * Copyright 2009, Google Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 ResourceID id = args[0].value_uint32; 360 ResourceID id = args[0].value_uint32;
361 unsigned int size = args[1].value_uint32; 361 unsigned int size = args[1].value_uint32;
362 void *data = GetAddressAndCheckSize(args[2].value_uint32, 362 void *data = GetAddressAndCheckSize(args[2].value_uint32,
363 args[3].value_uint32, 363 args[3].value_uint32,
364 size); 364 size);
365 if (!data) return BufferSyncInterface::PARSE_INVALID_ARGUMENTS; 365 if (!data) return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
366 return gapi_->GetParamDesc(id, size, data); 366 return gapi_->GetParamDesc(id, size, data);
367 } else { 367 } else {
368 return BufferSyncInterface::PARSE_INVALID_ARGUMENTS; 368 return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
369 } 369 }
370 case GET_STREAM_COUNT:
371 if (arg_count == 4) {
372 ResourceID id = args[0].value_uint32;
373 unsigned int size = args[1].value_uint32;
374 void *data = GetAddressAndCheckSize(args[2].value_uint32,
375 args[3].value_uint32,
376 size);
377 if (!data) return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
378 return gapi_->GetStreamCount(id, size, data);
379 } else {
380 return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
381 }
382 case GET_STREAM_DESC:
383 if (arg_count == 5) {
384 ResourceID id = args[0].value_uint32;
385 unsigned int index = args[1].value_uint32;
386 unsigned int size = args[2].value_uint32;
387 void *data = GetAddressAndCheckSize(args[3].value_uint32,
388 args[4].value_uint32,
389 size);
390 if (!data) return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
391 return gapi_->GetStreamDesc(id, index, size, data);
392 } else {
393 return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
394 }
370 case DESTROY_TEXTURE: 395 case DESTROY_TEXTURE:
371 if (arg_count == 1) { 396 if (arg_count == 1) {
372 return gapi_->DestroyTexture(args[0].value_uint32); 397 return gapi_->DestroyTexture(args[0].value_uint32);
373 } else { 398 } else {
374 return BufferSyncInterface::PARSE_INVALID_ARGUMENTS; 399 return BufferSyncInterface::PARSE_INVALID_ARGUMENTS;
375 } 400 }
376 case CREATE_TEXTURE_2D: 401 case CREATE_TEXTURE_2D:
377 return DecodeCreateTexture2D(arg_count, args); 402 return DecodeCreateTexture2D(arg_count, args);
378 case CREATE_TEXTURE_3D: 403 case CREATE_TEXTURE_3D:
379 return DecodeCreateTexture3D(arg_count, args); 404 return DecodeCreateTexture3D(arg_count, args);
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 unsigned int size) { 897 unsigned int size) {
873 void * shm_addr = engine_->GetSharedMemoryAddress(shm_id); 898 void * shm_addr = engine_->GetSharedMemoryAddress(shm_id);
874 if (!shm_addr) return NULL; 899 if (!shm_addr) return NULL;
875 size_t shm_size = engine_->GetSharedMemorySize(shm_id); 900 size_t shm_size = engine_->GetSharedMemorySize(shm_id);
876 if (offset + size > shm_size) return NULL; 901 if (offset + size > shm_size) return NULL;
877 return static_cast<char *>(shm_addr) + offset; 902 return static_cast<char *>(shm_addr) + offset;
878 } 903 }
879 904
880 } // namespace command_buffer 905 } // namespace command_buffer
881 } // namespace o3d 906 } // namespace o3d
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698