Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 Uint32 value_uint32; | 85 Uint32 value_uint32; |
| 86 Int32 value_int32; | 86 Int32 value_int32; |
| 87 float value_float; | 87 float value_float; |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 const size_t kCommandBufferEntrySize = 4; | 90 const size_t kCommandBufferEntrySize = 4; |
| 91 | 91 |
| 92 COMPILE_ASSERT(sizeof(CommandBufferEntry) == kCommandBufferEntrySize, | 92 COMPILE_ASSERT(sizeof(CommandBufferEntry) == kCommandBufferEntrySize, |
| 93 Sizeof_CommandBufferEntry_is_not_4); | 93 Sizeof_CommandBufferEntry_is_not_4); |
| 94 | 94 |
| 95 // Make sure the compiler does not add extra padding to any of the command | 95 // Command buffer is 4 byte aligned. |
| 96 // structures. | 96 #pragma pack(push, 4) |
|
piman
2014/02/03 22:30:49
Do we even want anything at all, instead of just l
vmiura
2014/02/03 22:44:38
The command buffer is 4 byte aligned, so this pack
| |
| 97 #pragma pack(push, 1) | |
| 98 | 97 |
| 99 // Gets the address of memory just after a structure in a typesafe way. This is | 98 // Gets the address of memory just after a structure in a typesafe way. This is |
| 100 // used for IMMEDIATE commands to get the address of the place to put the data. | 99 // used for IMMEDIATE commands to get the address of the place to put the data. |
| 101 // Immediate command put their data direclty in the command buffer. | 100 // Immediate command put their data direclty in the command buffer. |
| 102 // Parameters: | 101 // Parameters: |
| 103 // cmd: Address of command. | 102 // cmd: Address of command. |
| 104 template <typename T> | 103 template <typename T> |
| 105 void* ImmediateDataAddress(T* cmd) { | 104 void* ImmediateDataAddress(T* cmd) { |
| 106 COMPILE_ASSERT(T::kArgFlags == cmd::kAtLeastN, Cmd_kArgFlags_not_kAtLeastN); | 105 COMPILE_ASSERT(T::kArgFlags == cmd::kAtLeastN, Cmd_kArgFlags_not_kAtLeastN); |
| 107 return reinterpret_cast<char*>(cmd) + sizeof(*cmd); | 106 return reinterpret_cast<char*>(cmd) + sizeof(*cmd); |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 531 Offsetof_GetBucketData_shared_memory_offset_not_20); | 530 Offsetof_GetBucketData_shared_memory_offset_not_20); |
| 532 | 531 |
| 533 } // namespace cmd | 532 } // namespace cmd |
| 534 | 533 |
| 535 #pragma pack(pop) | 534 #pragma pack(pop) |
| 536 | 535 |
| 537 } // namespace gpu | 536 } // namespace gpu |
| 538 | 537 |
| 539 #endif // GPU_COMMAND_BUFFER_COMMON_CMD_BUFFER_COMMON_H_ | 538 #endif // GPU_COMMAND_BUFFER_COMMON_CMD_BUFFER_COMMON_H_ |
| 540 | 539 |
| OLD | NEW |