| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 COMPILE_ASSERT(sizeof(CommandHeader) == 4, Sizeof_CommandHeader_is_not_4); | 80 COMPILE_ASSERT(sizeof(CommandHeader) == 4, Sizeof_CommandHeader_is_not_4); |
| 81 | 81 |
| 82 // Union that defines possible command buffer entries. | 82 // Union that defines possible command buffer entries. |
| 83 union CommandBufferEntry { | 83 union CommandBufferEntry { |
| 84 CommandHeader value_header; | 84 CommandHeader value_header; |
| 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 #define GPU_COMMAND_BUFFER_ENTRY_ALIGNMENT 4 |
| 91 const size_t kCommandBufferEntrySize = GPU_COMMAND_BUFFER_ENTRY_ALIGNMENT; |
| 91 | 92 |
| 92 COMPILE_ASSERT(sizeof(CommandBufferEntry) == kCommandBufferEntrySize, | 93 COMPILE_ASSERT(sizeof(CommandBufferEntry) == kCommandBufferEntrySize, |
| 93 Sizeof_CommandBufferEntry_is_not_4); | 94 Sizeof_CommandBufferEntry_is_not_4); |
| 94 | 95 |
| 95 // Make sure the compiler does not add extra padding to any of the command | 96 // Command buffer is GPU_COMMAND_BUFFER_ENTRY_ALIGNMENT byte aligned. |
| 96 // structures. | 97 #pragma pack(push, GPU_COMMAND_BUFFER_ENTRY_ALIGNMENT) |
| 97 #pragma pack(push, 1) | |
| 98 | 98 |
| 99 // Gets the address of memory just after a structure in a typesafe way. This is | 99 // 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. | 100 // 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. | 101 // Immediate command put their data direclty in the command buffer. |
| 102 // Parameters: | 102 // Parameters: |
| 103 // cmd: Address of command. | 103 // cmd: Address of command. |
| 104 template <typename T> | 104 template <typename T> |
| 105 void* ImmediateDataAddress(T* cmd) { | 105 void* ImmediateDataAddress(T* cmd) { |
| 106 COMPILE_ASSERT(T::kArgFlags == cmd::kAtLeastN, Cmd_kArgFlags_not_kAtLeastN); | 106 COMPILE_ASSERT(T::kArgFlags == cmd::kAtLeastN, Cmd_kArgFlags_not_kAtLeastN); |
| 107 return reinterpret_cast<char*>(cmd) + sizeof(*cmd); | 107 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); | 531 Offsetof_GetBucketData_shared_memory_offset_not_20); |
| 532 | 532 |
| 533 } // namespace cmd | 533 } // namespace cmd |
| 534 | 534 |
| 535 #pragma pack(pop) | 535 #pragma pack(pop) |
| 536 | 536 |
| 537 } // namespace gpu | 537 } // namespace gpu |
| 538 | 538 |
| 539 #endif // GPU_COMMAND_BUFFER_COMMON_CMD_BUFFER_COMMON_H_ | 539 #endif // GPU_COMMAND_BUFFER_COMMON_CMD_BUFFER_COMMON_H_ |
| 540 | 540 |
| OLD | NEW |