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

Unified Diff: gpu/command_buffer/common/cmd_buffer_common.h

Issue 479008: Implements bucket commands and adds unit tests to... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gpu/command_buffer/service/common_decoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/common/cmd_buffer_common.h
===================================================================
--- gpu/command_buffer/common/cmd_buffer_common.h (revision 34064)
+++ gpu/command_buffer/common/cmd_buffer_common.h (working copy)
@@ -107,10 +107,11 @@
float value_float;
};
-COMPILE_ASSERT(sizeof(CommandBufferEntry) == 4,
+const size_t kCommandBufferEntrySize = 4;
+
+COMPILE_ASSERT(sizeof(CommandBufferEntry) == kCommandBufferEntrySize,
Sizeof_CommandBufferEntry_is_not_4);
-
// Make sure the compiler does not add extra padding to any of the command
// structures.
#pragma pack(push, 1)
@@ -181,8 +182,8 @@
OP(SetBucketSize) /* 7 */ \
OP(SetBucketData) /* 8 */ \
OP(SetBucketDataImmediate) /* 9 */ \
- OP(GetResultSize) /* 10 */ \
- OP(GetResultData) /* 11 */ \
+ OP(GetBucketSize) /* 10 */ \
+ OP(GetBucketData) /* 11 */ \
// Common commands.
enum CommandId {
@@ -566,76 +567,86 @@
COMPILE_ASSERT(offsetof(SetBucketDataImmediate, size) == 12,
Offsetof_SetBucketDataImmediate_size_not_12);
-// Gets the size of a result the service has available.
-// Sending a variable size result back to the client, for example any API that
-// returns a string, is problematic since the largest thing you can send back is
-// the size of your shared memory. This command along with GetResultData
-// implement a way to get a result a piece at a time to help solve that problem
-// in a generic way.
-struct GetResultSize {
- typedef GetResultSize ValueType;
- static const CommandId kCmdId = kGetResultSize;
+// Gets the size of a bucket the service has available. Sending a variable size
+// result back to the client, for example any API that returns a string, is
+// problematic since the largest thing you can send back is the size of your
+// shared memory. This command along with GetBucketData implements a way to get
+// a result a piece at a time to help solve that problem in a generic way.
+struct GetBucketSize {
+ typedef GetBucketSize ValueType;
+ static const CommandId kCmdId = kGetBucketSize;
static const cmd::ArgFlags kArgFlags = cmd::kFixed;
void SetHeader() {
header.SetCmd<ValueType>();
}
- void Init(uint32 _shared_memory_id,
+ void Init(uint32 _bucket_id,
+ uint32 _shared_memory_id,
uint32 _shared_memory_offset) {
SetHeader();
+ bucket_id = _bucket_id;
shared_memory_id = _shared_memory_id;
shared_memory_offset = _shared_memory_offset;
}
static void* Set(void* cmd,
+ uint32 _bucket_id,
uint32 _shared_memory_id,
uint32 _shared_memory_offset) {
static_cast<ValueType*>(cmd)->Init(
+ _bucket_id,
_shared_memory_id,
_shared_memory_offset);
return NextCmdAddress<ValueType>(cmd);
}
CommandHeader header;
+ uint32 bucket_id;
uint32 shared_memory_id;
uint32 shared_memory_offset;
};
-COMPILE_ASSERT(sizeof(GetResultSize) == 12, Sizeof_GetResultSize_is_not_12);
-COMPILE_ASSERT(offsetof(GetResultSize, header) == 0,
- Offsetof_GetResultSize_header_not_0);
-COMPILE_ASSERT(offsetof(GetResultSize, shared_memory_id) == 4,
- Offsetof_GetResultSize_shared_memory_id_not_4);
-COMPILE_ASSERT(offsetof(GetResultSize, shared_memory_offset) == 8,
- Offsetof_GetResultSize_shared_memory_offset_not_8);
+COMPILE_ASSERT(sizeof(GetBucketSize) == 16, Sizeof_GetBucketSize_is_not_16);
+COMPILE_ASSERT(offsetof(GetBucketSize, header) == 0,
+ Offsetof_GetBucketSize_header_not_0);
+COMPILE_ASSERT(offsetof(GetBucketSize, bucket_id) == 4,
+ Offsetof_GetBucketSize_bucket_id_not_4);
+COMPILE_ASSERT(offsetof(GetBucketSize, shared_memory_id) == 8,
+ Offsetof_GetBucketSize_shared_memory_id_not_8);
+COMPILE_ASSERT(offsetof(GetBucketSize, shared_memory_offset) == 12,
+ Offsetof_GetBucketSize_shared_memory_offset_not_12);
// Gets a piece of a result the service as available.
-// See GetResultSize.
-struct GetResultData {
- typedef GetResultData ValueType;
- static const CommandId kCmdId = kGetResultData;
+// See GetBucketSize.
+struct GetBucketData {
+ typedef GetBucketData ValueType;
+ static const CommandId kCmdId = kGetBucketData;
static const cmd::ArgFlags kArgFlags = cmd::kFixed;
void SetHeader() {
header.SetCmd<ValueType>();
}
- void Init(uint32 _offset,
+ void Init(uint32 _bucket_id,
+ uint32 _offset,
uint32 _size,
uint32 _shared_memory_id,
uint32 _shared_memory_offset) {
SetHeader();
+ bucket_id = _bucket_id;
offset = _offset;
size = _size;
shared_memory_id = _shared_memory_id;
shared_memory_offset = _shared_memory_offset;
}
static void* Set(void* cmd,
+ uint32 _bucket_id,
uint32 _offset,
uint32 _size,
uint32 _shared_memory_id,
uint32 _shared_memory_offset) {
static_cast<ValueType*>(cmd)->Init(
+ _bucket_id,
_offset,
_size,
_shared_memory_id,
@@ -644,23 +655,26 @@
}
CommandHeader header;
+ uint32 bucket_id;
uint32 offset;
uint32 size;
uint32 shared_memory_id;
uint32 shared_memory_offset;
};
-COMPILE_ASSERT(sizeof(GetResultData) == 20, Sizeof_GetResultData_is_not_20);
-COMPILE_ASSERT(offsetof(GetResultData, header) == 0,
- Offsetof_GetResultData_header_not_0);
-COMPILE_ASSERT(offsetof(GetResultData, offset) == 4,
- Offsetof_GetResultData_offset_not_4);
-COMPILE_ASSERT(offsetof(GetResultData, size) == 8,
- Offsetof_GetResultData_size_not_8);
-COMPILE_ASSERT(offsetof(GetResultData, shared_memory_id) == 12,
- Offsetof_GetResultData_shared_memory_id_not_12);
-COMPILE_ASSERT(offsetof(GetResultData, shared_memory_offset) == 16,
- Offsetof_GetResultData_shared_memory_offset_not_16);
+COMPILE_ASSERT(sizeof(GetBucketData) == 24, Sizeof_GetBucketData_is_not_20);
+COMPILE_ASSERT(offsetof(GetBucketData, header) == 0,
+ Offsetof_GetBucketData_header_not_0);
+COMPILE_ASSERT(offsetof(GetBucketData, bucket_id) == 4,
+ Offsetof_GetBucketData_bucket_id_not_4);
+COMPILE_ASSERT(offsetof(GetBucketData, offset) == 8,
+ Offsetof_GetBucketData_offset_not_8);
+COMPILE_ASSERT(offsetof(GetBucketData, size) == 12,
+ Offsetof_GetBucketData_size_not_12);
+COMPILE_ASSERT(offsetof(GetBucketData, shared_memory_id) == 16,
+ Offsetof_GetBucketData_shared_memory_id_not_16);
+COMPILE_ASSERT(offsetof(GetBucketData, shared_memory_offset) == 20,
+ Offsetof_GetBucketData_shared_memory_offset_not_20);
} // namespace cmd
« no previous file with comments | « no previous file | gpu/command_buffer/service/common_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698