OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "../common/types.h" | 10 #include "../common/types.h" |
11 #include "../common/bitfield_helpers.h" | 11 #include "../common/bitfield_helpers.h" |
12 #include "../common/logging.h" | 12 #include "../common/logging.h" |
13 | 13 |
14 namespace gpu { | 14 namespace gpu { |
15 | 15 |
16 namespace cmd { | 16 namespace cmd { |
17 enum ArgFlags { | 17 enum ArgFlags { |
18 kFixed = 0x0, | 18 kFixed = 0x0, |
19 kAtLeastN = 0x1, | 19 kAtLeastN = 0x1 |
20 }; | 20 }; |
21 } // namespace cmd | 21 } // namespace cmd |
22 | 22 |
23 // Computes the number of command buffer entries needed for a certain size. In | 23 // Computes the number of command buffer entries needed for a certain size. In |
24 // other words it rounds up to a multiple of entries. | 24 // other words it rounds up to a multiple of entries. |
25 inline uint32 ComputeNumEntries(size_t size_in_bytes) { | 25 inline uint32 ComputeNumEntries(size_t size_in_bytes) { |
26 return static_cast<uint32>( | 26 return static_cast<uint32>( |
27 (size_in_bytes + sizeof(uint32) - 1) / sizeof(uint32)); // NOLINT | 27 (size_in_bytes + sizeof(uint32) - 1) / sizeof(uint32)); // NOLINT |
28 } | 28 } |
29 | 29 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 160 |
161 // Common commands. | 161 // Common commands. |
162 enum CommandId { | 162 enum CommandId { |
163 #define COMMON_COMMAND_BUFFER_CMD_OP(name) k ## name, | 163 #define COMMON_COMMAND_BUFFER_CMD_OP(name) k ## name, |
164 | 164 |
165 COMMON_COMMAND_BUFFER_CMDS(COMMON_COMMAND_BUFFER_CMD_OP) | 165 COMMON_COMMAND_BUFFER_CMDS(COMMON_COMMAND_BUFFER_CMD_OP) |
166 | 166 |
167 #undef COMMON_COMMAND_BUFFER_CMD_OP | 167 #undef COMMON_COMMAND_BUFFER_CMD_OP |
168 | 168 |
169 kNumCommands, | 169 kNumCommands, |
170 kLastCommonId = 255, // reserve 256 spaces for common commands. | 170 kLastCommonId = 255 // reserve 256 spaces for common commands. |
171 }; | 171 }; |
172 | 172 |
173 COMPILE_ASSERT(kNumCommands - 1 <= kLastCommonId, Too_many_common_commands); | 173 COMPILE_ASSERT(kNumCommands - 1 <= kLastCommonId, Too_many_common_commands); |
174 | 174 |
175 const char* GetCommandName(CommandId id); | 175 const char* GetCommandName(CommandId id); |
176 | 176 |
177 // A Noop command. | 177 // A Noop command. |
178 struct Noop { | 178 struct Noop { |
179 typedef Noop ValueType; | 179 typedef Noop ValueType; |
180 static const CommandId kCmdId = kNoop; | 180 static const CommandId kCmdId = kNoop; |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 Offsetof_GetBucketData_shared_memory_offset_not_20); | 642 Offsetof_GetBucketData_shared_memory_offset_not_20); |
643 | 643 |
644 } // namespace cmd | 644 } // namespace cmd |
645 | 645 |
646 #pragma pack(pop) | 646 #pragma pack(pop) |
647 | 647 |
648 } // namespace gpu | 648 } // namespace gpu |
649 | 649 |
650 #endif // GPU_COMMAND_BUFFER_COMMON_CMD_BUFFER_COMMON_H_ | 650 #endif // GPU_COMMAND_BUFFER_COMMON_CMD_BUFFER_COMMON_H_ |
651 | 651 |
OLD | NEW |