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 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 | 10 |
(...skipping 25 matching lines...) Expand all Loading... | |
36 typedef unsigned short GLushort; | 36 typedef unsigned short GLushort; |
37 typedef unsigned long GLulong; | 37 typedef unsigned long GLulong; |
38 typedef float GLfloat; | 38 typedef float GLfloat; |
39 typedef float GLclampf; | 39 typedef float GLclampf; |
40 typedef double GLdouble; | 40 typedef double GLdouble; |
41 typedef double GLclampd; | 41 typedef double GLclampd; |
42 typedef void GLvoid; | 42 typedef void GLvoid; |
43 typedef khronos_intptr_t GLintptr; | 43 typedef khronos_intptr_t GLintptr; |
44 typedef khronos_ssize_t GLsizeiptr; | 44 typedef khronos_ssize_t GLsizeiptr; |
45 typedef struct __GLsync *GLsync; | 45 typedef struct __GLsync *GLsync; |
46 typedef uint64_t GLuint64; | |
46 | 47 |
47 namespace gpu { | 48 namespace gpu { |
48 namespace gles2 { | 49 namespace gles2 { |
49 | 50 |
50 // Command buffer is GPU_COMMAND_BUFFER_ENTRY_ALIGNMENT byte aligned. | 51 // Command buffer is GPU_COMMAND_BUFFER_ENTRY_ALIGNMENT byte aligned. |
51 #pragma pack(push, GPU_COMMAND_BUFFER_ENTRY_ALIGNMENT) | 52 #pragma pack(push, GPU_COMMAND_BUFFER_ENTRY_ALIGNMENT) |
52 | 53 |
53 namespace id_namespaces { | 54 namespace id_namespaces { |
54 | 55 |
55 // These are used when contexts share resources. | 56 // These are used when contexts share resources. |
(...skipping 14 matching lines...) Expand all Loading... | |
70 | 71 |
71 // These numbers must not change | 72 // These numbers must not change |
72 static_assert(kBuffers == 0, "kBuffers should equal 0"); | 73 static_assert(kBuffers == 0, "kBuffers should equal 0"); |
73 static_assert(kFramebuffers == 1, "kFramebuffers should equal 1"); | 74 static_assert(kFramebuffers == 1, "kFramebuffers should equal 1"); |
74 static_assert(kProgramsAndShaders == 2, "kProgramsAndShaders should equal 2"); | 75 static_assert(kProgramsAndShaders == 2, "kProgramsAndShaders should equal 2"); |
75 static_assert(kRenderbuffers == 3, "kRenderbuffers should equal 3"); | 76 static_assert(kRenderbuffers == 3, "kRenderbuffers should equal 3"); |
76 static_assert(kTextures == 4, "kTextures should equal 4"); | 77 static_assert(kTextures == 4, "kTextures should equal 4"); |
77 | 78 |
78 } // namespace id_namespaces | 79 } // namespace id_namespaces |
79 | 80 |
81 union GLuint64Union { | |
piman
2015/02/18 18:38:00
Oh, actually, I missed the fact that this was a un
Zhenyao Mo
2015/02/18 19:10:37
Thanks for catching this. My understanding of uni
| |
82 GLuint64Union(GLuint64 v64) | |
83 : param64(v64) { | |
84 } | |
85 | |
86 GLuint64Union(uint32_t v32_0, uint32_t v32_1) { | |
87 param32.v0 = v32_0; | |
88 param32.v1 = v32_1; | |
89 } | |
90 | |
91 GLuint64 param64; | |
92 struct { | |
93 uint32_t v0; | |
94 uint32_t v1; | |
95 } param32; | |
96 }; | |
97 | |
98 static_assert(sizeof(GLuint64Union) == 8, "size of GLuint64Union should be 8"); | |
99 static_assert(offsetof(GLuint64Union, param64) == 0, | |
100 "offset of GLuint64Union.param64 should be 0"); | |
101 static_assert(offsetof(GLuint64Union, param32.v0) == 0, | |
102 "offset of GLuint64Union.param32.v0 should be 0"); | |
103 static_assert(offsetof(GLuint64Union, param32.v1) == 4, | |
104 "offset of GLuint64Union.param32.v1 should be 4"); | |
105 | |
80 // Used for some glGetXXX commands that return a result through a pointer. We | 106 // Used for some glGetXXX commands that return a result through a pointer. We |
81 // need to know if the command succeeded or not and the size of the result. If | 107 // need to know if the command succeeded or not and the size of the result. If |
82 // the command failed its result size will 0. | 108 // the command failed its result size will 0. |
83 template <typename T> | 109 template <typename T> |
84 struct SizedResult { | 110 struct SizedResult { |
85 typedef T Type; | 111 typedef T Type; |
86 | 112 |
87 T* GetData() { | 113 T* GetData() { |
88 return static_cast<T*>(static_cast<void*>(&data)); | 114 return static_cast<T*>(static_cast<void*>(&data)); |
89 } | 115 } |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
355 "offset of CreateAndConsumeTextureCHROMIUMImmediate.client_id should be 8"); | 381 "offset of CreateAndConsumeTextureCHROMIUMImmediate.client_id should be 8"); |
356 | 382 |
357 | 383 |
358 #pragma pack(pop) | 384 #pragma pack(pop) |
359 | 385 |
360 } // namespace cmd | 386 } // namespace cmd |
361 } // namespace gles2 | 387 } // namespace gles2 |
362 } // namespace gpu | 388 } // namespace gpu |
363 | 389 |
364 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_ | 390 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_ |
OLD | NEW |