OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 OP(Jump) /* 2 */ \ | 151 OP(Jump) /* 2 */ \ |
152 OP(JumpRelative) /* 3 */ \ | 152 OP(JumpRelative) /* 3 */ \ |
153 OP(Call) /* 4 */ \ | 153 OP(Call) /* 4 */ \ |
154 OP(CallRelative) /* 5 */ \ | 154 OP(CallRelative) /* 5 */ \ |
155 OP(Return) /* 6 */ \ | 155 OP(Return) /* 6 */ \ |
156 OP(SetBucketSize) /* 7 */ \ | 156 OP(SetBucketSize) /* 7 */ \ |
157 OP(SetBucketData) /* 8 */ \ | 157 OP(SetBucketData) /* 8 */ \ |
158 OP(SetBucketDataImmediate) /* 9 */ \ | 158 OP(SetBucketDataImmediate) /* 9 */ \ |
159 OP(GetBucketSize) /* 10 */ \ | 159 OP(GetBucketSize) /* 10 */ \ |
160 OP(GetBucketData) /* 11 */ \ | 160 OP(GetBucketData) /* 11 */ \ |
| 161 OP(YieldScheduler) /* 12 */ \ |
161 | 162 |
162 // Common commands. | 163 // Common commands. |
163 enum CommandId { | 164 enum CommandId { |
164 #define COMMON_COMMAND_BUFFER_CMD_OP(name) k ## name, | 165 #define COMMON_COMMAND_BUFFER_CMD_OP(name) k ## name, |
165 | 166 |
166 COMMON_COMMAND_BUFFER_CMDS(COMMON_COMMAND_BUFFER_CMD_OP) | 167 COMMON_COMMAND_BUFFER_CMDS(COMMON_COMMAND_BUFFER_CMD_OP) |
167 | 168 |
168 #undef COMMON_COMMAND_BUFFER_CMD_OP | 169 #undef COMMON_COMMAND_BUFFER_CMD_OP |
169 | 170 |
170 kNumCommands, | 171 kNumCommands, |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 Offsetof_GetBucketData_bucket_id_not_4); | 636 Offsetof_GetBucketData_bucket_id_not_4); |
636 COMPILE_ASSERT(offsetof(GetBucketData, offset) == 8, | 637 COMPILE_ASSERT(offsetof(GetBucketData, offset) == 8, |
637 Offsetof_GetBucketData_offset_not_8); | 638 Offsetof_GetBucketData_offset_not_8); |
638 COMPILE_ASSERT(offsetof(GetBucketData, size) == 12, | 639 COMPILE_ASSERT(offsetof(GetBucketData, size) == 12, |
639 Offsetof_GetBucketData_size_not_12); | 640 Offsetof_GetBucketData_size_not_12); |
640 COMPILE_ASSERT(offsetof(GetBucketData, shared_memory_id) == 16, | 641 COMPILE_ASSERT(offsetof(GetBucketData, shared_memory_id) == 16, |
641 Offsetof_GetBucketData_shared_memory_id_not_16); | 642 Offsetof_GetBucketData_shared_memory_id_not_16); |
642 COMPILE_ASSERT(offsetof(GetBucketData, shared_memory_offset) == 20, | 643 COMPILE_ASSERT(offsetof(GetBucketData, shared_memory_offset) == 20, |
643 Offsetof_GetBucketData_shared_memory_offset_not_20); | 644 Offsetof_GetBucketData_shared_memory_offset_not_20); |
644 | 645 |
| 646 // A Yield command. Hints the scheduler that this is a good point to update the |
| 647 // state and schedule other command buffers. |
| 648 struct YieldScheduler { |
| 649 typedef YieldScheduler ValueType; |
| 650 static const CommandId kCmdId = kYieldScheduler; |
| 651 static const cmd::ArgFlags kArgFlags = cmd::kFixed; |
| 652 |
| 653 void SetHeader() { |
| 654 header.SetCmd<ValueType>(); |
| 655 } |
| 656 |
| 657 void Init() { |
| 658 SetHeader(); |
| 659 } |
| 660 static void* Set(void* cmd) { |
| 661 static_cast<ValueType*>(cmd)->Init(); |
| 662 return NextCmdAddress<ValueType>(cmd); |
| 663 } |
| 664 |
| 665 CommandHeader header; |
| 666 }; |
| 667 |
| 668 COMPILE_ASSERT(sizeof(YieldScheduler) == 4, Sizeof_YieldScheduler_is_not_4); |
| 669 COMPILE_ASSERT(offsetof(YieldScheduler, header) == 0, |
| 670 Offsetof_YieldScheduler_header_not_0); |
| 671 |
645 } // namespace cmd | 672 } // namespace cmd |
646 | 673 |
647 #pragma pack(pop) | 674 #pragma pack(pop) |
648 | 675 |
649 } // namespace gpu | 676 } // namespace gpu |
650 | 677 |
651 #endif // GPU_COMMAND_BUFFER_COMMON_CMD_BUFFER_COMMON_H_ | 678 #endif // GPU_COMMAND_BUFFER_COMMON_CMD_BUFFER_COMMON_H_ |
652 | 679 |
OLD | NEW |