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> |
| 11 |
| 12 #include "../../gpu_export.h" |
11 #include "../common/types.h" | 13 #include "../common/types.h" |
12 #include "../common/bitfield_helpers.h" | 14 #include "../common/bitfield_helpers.h" |
13 #include "../common/logging.h" | 15 #include "../common/logging.h" |
14 | 16 |
15 namespace gpu { | 17 namespace gpu { |
16 | 18 |
17 namespace cmd { | 19 namespace cmd { |
18 enum ArgFlags { | 20 enum ArgFlags { |
19 kFixed = 0x0, | 21 kFixed = 0x0, |
20 kAtLeastN = 0x1 | 22 kAtLeastN = 0x1 |
(...skipping 10 matching lines...) Expand all Loading... |
31 // Rounds up to a multiple of entries in bytes. | 33 // Rounds up to a multiple of entries in bytes. |
32 inline size_t RoundSizeToMultipleOfEntries(size_t size_in_bytes) { | 34 inline size_t RoundSizeToMultipleOfEntries(size_t size_in_bytes) { |
33 return ComputeNumEntries(size_in_bytes) * sizeof(uint32); // NOLINT | 35 return ComputeNumEntries(size_in_bytes) * sizeof(uint32); // NOLINT |
34 } | 36 } |
35 | 37 |
36 // Struct that defines the command header in the command buffer. | 38 // Struct that defines the command header in the command buffer. |
37 struct CommandHeader { | 39 struct CommandHeader { |
38 Uint32 size:21; | 40 Uint32 size:21; |
39 Uint32 command:11; | 41 Uint32 command:11; |
40 | 42 |
41 static const int32 kMaxSize = (1 << 21) - 1; | 43 GPU_EXPORT static const int32 kMaxSize = (1 << 21) - 1; |
42 | 44 |
43 void Init(uint32 _command, int32 _size) { | 45 void Init(uint32 _command, int32 _size) { |
44 GPU_DCHECK_LE(_size, kMaxSize); | 46 GPU_DCHECK_LE(_size, kMaxSize); |
45 command = _command; | 47 command = _command; |
46 size = _size; | 48 size = _size; |
47 } | 49 } |
48 | 50 |
49 // Sets the header based on the passed in command. Can not be used for | 51 // Sets the header based on the passed in command. Can not be used for |
50 // variable sized commands like immediate commands or Noop. | 52 // variable sized commands like immediate commands or Noop. |
51 template <typename T> | 53 template <typename T> |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 Offsetof_GetBucketData_shared_memory_offset_not_20); | 645 Offsetof_GetBucketData_shared_memory_offset_not_20); |
644 | 646 |
645 } // namespace cmd | 647 } // namespace cmd |
646 | 648 |
647 #pragma pack(pop) | 649 #pragma pack(pop) |
648 | 650 |
649 } // namespace gpu | 651 } // namespace gpu |
650 | 652 |
651 #endif // GPU_COMMAND_BUFFER_COMMON_CMD_BUFFER_COMMON_H_ | 653 #endif // GPU_COMMAND_BUFFER_COMMON_CMD_BUFFER_COMMON_H_ |
652 | 654 |
OLD | NEW |