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 */ \ | |
162 | 161 |
163 // Common commands. | 162 // Common commands. |
164 enum CommandId { | 163 enum CommandId { |
165 #define COMMON_COMMAND_BUFFER_CMD_OP(name) k ## name, | 164 #define COMMON_COMMAND_BUFFER_CMD_OP(name) k ## name, |
166 | 165 |
167 COMMON_COMMAND_BUFFER_CMDS(COMMON_COMMAND_BUFFER_CMD_OP) | 166 COMMON_COMMAND_BUFFER_CMDS(COMMON_COMMAND_BUFFER_CMD_OP) |
168 | 167 |
169 #undef COMMON_COMMAND_BUFFER_CMD_OP | 168 #undef COMMON_COMMAND_BUFFER_CMD_OP |
170 | 169 |
171 kNumCommands, | 170 kNumCommands, |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 Offsetof_GetBucketData_bucket_id_not_4); | 635 Offsetof_GetBucketData_bucket_id_not_4); |
637 COMPILE_ASSERT(offsetof(GetBucketData, offset) == 8, | 636 COMPILE_ASSERT(offsetof(GetBucketData, offset) == 8, |
638 Offsetof_GetBucketData_offset_not_8); | 637 Offsetof_GetBucketData_offset_not_8); |
639 COMPILE_ASSERT(offsetof(GetBucketData, size) == 12, | 638 COMPILE_ASSERT(offsetof(GetBucketData, size) == 12, |
640 Offsetof_GetBucketData_size_not_12); | 639 Offsetof_GetBucketData_size_not_12); |
641 COMPILE_ASSERT(offsetof(GetBucketData, shared_memory_id) == 16, | 640 COMPILE_ASSERT(offsetof(GetBucketData, shared_memory_id) == 16, |
642 Offsetof_GetBucketData_shared_memory_id_not_16); | 641 Offsetof_GetBucketData_shared_memory_id_not_16); |
643 COMPILE_ASSERT(offsetof(GetBucketData, shared_memory_offset) == 20, | 642 COMPILE_ASSERT(offsetof(GetBucketData, shared_memory_offset) == 20, |
644 Offsetof_GetBucketData_shared_memory_offset_not_20); | 643 Offsetof_GetBucketData_shared_memory_offset_not_20); |
645 | 644 |
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 | |
672 } // namespace cmd | 645 } // namespace cmd |
673 | 646 |
674 #pragma pack(pop) | 647 #pragma pack(pop) |
675 | 648 |
676 } // namespace gpu | 649 } // namespace gpu |
677 | 650 |
678 #endif // GPU_COMMAND_BUFFER_COMMON_CMD_BUFFER_COMMON_H_ | 651 #endif // GPU_COMMAND_BUFFER_COMMON_CMD_BUFFER_COMMON_H_ |
679 | 652 |
OLD | NEW |