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

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

Issue 116863003: gpu: Reuse transfer buffers more aggresively (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: [WIP] Introduced internal SetAsyncToken command buffer command Created 6 years, 11 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 contains the common parts of command buffer formats. 5 // This file contains the common parts of command buffer formats.
6 6
7 #ifndef GPU_COMMAND_BUFFER_COMMON_CMD_BUFFER_COMMON_H_ 7 #ifndef GPU_COMMAND_BUFFER_COMMON_CMD_BUFFER_COMMON_H_
8 #define GPU_COMMAND_BUFFER_COMMON_CMD_BUFFER_COMMON_H_ 8 #define GPU_COMMAND_BUFFER_COMMON_CMD_BUFFER_COMMON_H_
9 9
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // 148 //
149 // NOTE: THE ORDER OF THESE MUST NOT CHANGE (their id is derived by order) 149 // NOTE: THE ORDER OF THESE MUST NOT CHANGE (their id is derived by order)
150 #define COMMON_COMMAND_BUFFER_CMDS(OP) \ 150 #define COMMON_COMMAND_BUFFER_CMDS(OP) \
151 OP(Noop) /* 0 */ \ 151 OP(Noop) /* 0 */ \
152 OP(SetToken) /* 1 */ \ 152 OP(SetToken) /* 1 */ \
153 OP(SetBucketSize) /* 2 */ \ 153 OP(SetBucketSize) /* 2 */ \
154 OP(SetBucketData) /* 3 */ \ 154 OP(SetBucketData) /* 3 */ \
155 OP(SetBucketDataImmediate) /* 4 */ \ 155 OP(SetBucketDataImmediate) /* 4 */ \
156 OP(GetBucketStart) /* 5 */ \ 156 OP(GetBucketStart) /* 5 */ \
157 OP(GetBucketData) /* 6 */ \ 157 OP(GetBucketData) /* 6 */ \
158 OP(SetAsyncToken) /* 7 */ \
158 159
159 // Common commands. 160 // Common commands.
160 enum CommandId { 161 enum CommandId {
161 #define COMMON_COMMAND_BUFFER_CMD_OP(name) k ## name, 162 #define COMMON_COMMAND_BUFFER_CMD_OP(name) k ## name,
162 163
163 COMMON_COMMAND_BUFFER_CMDS(COMMON_COMMAND_BUFFER_CMD_OP) 164 COMMON_COMMAND_BUFFER_CMDS(COMMON_COMMAND_BUFFER_CMD_OP)
164 165
165 #undef COMMON_COMMAND_BUFFER_CMD_OP 166 #undef COMMON_COMMAND_BUFFER_CMD_OP
166 167
167 kNumCommands, 168 kNumCommands,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } 217 }
217 static void* Set(void* cmd, uint32 token) { 218 static void* Set(void* cmd, uint32 token) {
218 static_cast<ValueType*>(cmd)->Init(token); 219 static_cast<ValueType*>(cmd)->Init(token);
219 return NextCmdAddress<ValueType>(cmd); 220 return NextCmdAddress<ValueType>(cmd);
220 } 221 }
221 222
222 CommandHeader header; 223 CommandHeader header;
223 uint32 token; 224 uint32 token;
224 }; 225 };
225 226
227 struct SetAsyncToken {
228 typedef SetAsyncToken ValueType;
229 static const CommandId kCmdId = kSetAsyncToken;
230 static const cmd::ArgFlags kArgFlags = cmd::kFixed;
231
232 void SetHeader() {
233 header.SetCmd<ValueType>();
234 }
235
236 void Init(uint32 _async_token) {
237 SetHeader();
238 async_token = _async_token;
239 }
240
241 static void* Set(void* cmd, uint32 async_token) {
242 static_cast<ValueType*>(cmd)->Init(async_token);
243 return NextCmdAddress<ValueType>(cmd);
244 }
245
246 CommandHeader header;
247 uint32 async_token;
248 };
249
226 COMPILE_ASSERT(sizeof(SetToken) == 8, Sizeof_SetToken_is_not_8); 250 COMPILE_ASSERT(sizeof(SetToken) == 8, Sizeof_SetToken_is_not_8);
227 COMPILE_ASSERT(offsetof(SetToken, header) == 0, 251 COMPILE_ASSERT(offsetof(SetToken, header) == 0,
228 Offsetof_SetToken_header_not_0); 252 Offsetof_SetToken_header_not_0);
229 COMPILE_ASSERT(offsetof(SetToken, token) == 4, 253 COMPILE_ASSERT(offsetof(SetToken, token) == 4,
230 Offsetof_SetToken_token_not_4); 254 Offsetof_SetToken_token_not_4);
231 255
232 // Sets the size of a bucket for collecting data on the service side. 256 // Sets the size of a bucket for collecting data on the service side.
233 // This is a utility for gathering data on the service side so it can be used 257 // This is a utility for gathering data on the service side so it can be used
234 // all at once when some service side API is called. It removes the need to add 258 // all at once when some service side API is called. It removes the need to add
235 // special commands just to support a particular API. For example, any API 259 // special commands just to support a particular API. For example, any API
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 Offsetof_GetBucketData_shared_memory_offset_not_20); 544 Offsetof_GetBucketData_shared_memory_offset_not_20);
521 545
522 } // namespace cmd 546 } // namespace cmd
523 547
524 #pragma pack(pop) 548 #pragma pack(pop)
525 549
526 } // namespace gpu 550 } // namespace gpu
527 551
528 #endif // GPU_COMMAND_BUFFER_COMMON_CMD_BUFFER_COMMON_H_ 552 #endif // GPU_COMMAND_BUFFER_COMMON_CMD_BUFFER_COMMON_H_
529 553
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698