| 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 "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // Rounds up to a multiple of entries in bytes. | 31 // Rounds up to a multiple of entries in bytes. |
| 32 inline size_t RoundSizeToMultipleOfEntries(size_t size_in_bytes) { | 32 inline size_t RoundSizeToMultipleOfEntries(size_t size_in_bytes) { |
| 33 return ComputeNumEntries(size_in_bytes) * sizeof(uint32); // NOLINT | 33 return ComputeNumEntries(size_in_bytes) * sizeof(uint32); // NOLINT |
| 34 } | 34 } |
| 35 | 35 |
| 36 // Struct that defines the command header in the command buffer. | 36 // Struct that defines the command header in the command buffer. |
| 37 struct CommandHeader { | 37 struct CommandHeader { |
| 38 Uint32 size:21; | 38 Uint32 size:21; |
| 39 Uint32 command:11; | 39 Uint32 command:11; |
| 40 | 40 |
| 41 static const int32 kMaxSize; | 41 static const int32 kMaxSize = (1 << 21) - 1; |
| 42 | 42 |
| 43 void Init(uint32 _command, int32 _size) { | 43 void Init(uint32 _command, int32 _size) { |
| 44 DCHECK_LE(_size, kMaxSize); | 44 DCHECK_LE(_size, kMaxSize); |
| 45 command = _command; | 45 command = _command; |
| 46 size = _size; | 46 size = _size; |
| 47 } | 47 } |
| 48 | 48 |
| 49 // Sets the header based on the passed in command. Can not be used for | 49 // Sets the header based on the passed in command. Can not be used for |
| 50 // variable sized commands like immediate commands or Noop. | 50 // variable sized commands like immediate commands or Noop. |
| 51 template <typename T> | 51 template <typename T> |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 Offsetof_GetBucketData_shared_memory_offset_not_20); | 641 Offsetof_GetBucketData_shared_memory_offset_not_20); |
| 642 | 642 |
| 643 } // namespace cmd | 643 } // namespace cmd |
| 644 | 644 |
| 645 #pragma pack(pop) | 645 #pragma pack(pop) |
| 646 | 646 |
| 647 } // namespace gpu | 647 } // namespace gpu |
| 648 | 648 |
| 649 #endif // GPU_COMMAND_BUFFER_COMMON_CMD_BUFFER_COMMON_H_ | 649 #endif // GPU_COMMAND_BUFFER_COMMON_CMD_BUFFER_COMMON_H_ |
| 650 | 650 |
| OLD | NEW |