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 defines the GLES2 command buffer commands. | 5 // This file defines the GLES2 command buffer commands. |
6 | 6 |
7 #ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_ | 7 #ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_ |
8 #define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_ | 8 #define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_ |
9 | 9 |
10 // This is here because service side code must include the system's version of | 10 // This is here because service side code must include the system's version of |
(...skipping 22 matching lines...) Expand all Loading... |
33 #pragma pack(push, 1) | 33 #pragma pack(push, 1) |
34 | 34 |
35 // Used for some glGetXXX commands that return a result through a pointer. We | 35 // Used for some glGetXXX commands that return a result through a pointer. We |
36 // need to know if the command succeeded or not and the size of the result. If | 36 // need to know if the command succeeded or not and the size of the result. If |
37 // the command failed its result size will 0. | 37 // the command failed its result size will 0. |
38 struct SizedResult { | 38 struct SizedResult { |
39 template <typename T> | 39 template <typename T> |
40 T GetDataAs() { | 40 T GetDataAs() { |
41 return static_cast<T>(static_cast<void*>(&data)); | 41 return static_cast<T>(static_cast<void*>(&data)); |
42 } | 42 } |
| 43 |
| 44 // Returns the size of the SizedResult for a given size of result. |
| 45 static size_t GetSize(size_t size_of_result) { |
| 46 return size_of_result + sizeof(uint32); // NOLINT |
| 47 } |
| 48 |
43 uint32 size; // in bytes. | 49 uint32 size; // in bytes. |
44 int32 data; // this is just here to get an offset. | 50 int32 data; // this is just here to get an offset. |
45 }; | 51 }; |
46 | 52 |
| 53 COMPILE_ASSERT(sizeof(SizedResult) == 8, SizedResult_size_not_8); |
| 54 COMPILE_ASSERT(offsetof(SizedResult, size) == 0, |
| 55 OffsetOf_SizedResult_size_not_0); |
| 56 COMPILE_ASSERT(offsetof(SizedResult, data) == 4, |
| 57 OffsetOf_SizedResult_data_not_4); |
| 58 |
47 #include "gpu/command_buffer/common/gles2_cmd_format_autogen.h" | 59 #include "gpu/command_buffer/common/gles2_cmd_format_autogen.h" |
48 | 60 |
49 // These are hand written commands. | 61 // These are hand written commands. |
50 // TODO(gman): Attempt to make these auto-generated. | 62 // TODO(gman): Attempt to make these auto-generated. |
51 | 63 |
52 struct GetAttribLocation { | 64 struct GetAttribLocation { |
53 typedef GetAttribLocation ValueType; | 65 typedef GetAttribLocation ValueType; |
54 static const CommandId kCmdId = kGetAttribLocation; | 66 static const CommandId kCmdId = kGetAttribLocation; |
55 static const cmd::ArgFlags kArgFlags = cmd::kFixed; | 67 static const cmd::ArgFlags kArgFlags = cmd::kFixed; |
56 | 68 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 COMPILE_ASSERT(offsetof(GetUniformLocationImmediate, data_size) == 16, | 302 COMPILE_ASSERT(offsetof(GetUniformLocationImmediate, data_size) == 16, |
291 OffsetOf_GetUniformLocationImmediate_data_size_not_16); | 303 OffsetOf_GetUniformLocationImmediate_data_size_not_16); |
292 | 304 |
293 #pragma pack(pop) | 305 #pragma pack(pop) |
294 | 306 |
295 } // namespace gles2 | 307 } // namespace gles2 |
296 } // namespace gpu | 308 } // namespace gpu |
297 | 309 |
298 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_ | 310 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_ |
299 | 311 |
OLD | NEW |