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 |
11 #include <KHR/khrplatform.h> | 11 #include <KHR/khrplatform.h> |
12 | 12 |
13 #include <stdint.h> | 13 #include <stdint.h> |
14 #include <string.h> | 14 #include <string.h> |
15 | 15 |
16 #include "base/atomicops.h" | 16 #include "base/atomicops.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/macros.h" | 18 #include "base/macros.h" |
19 #include "gpu/command_buffer/common/bitfield_helpers.h" | 19 #include "gpu/command_buffer/common/bitfield_helpers.h" |
20 #include "gpu/command_buffer/common/cmd_buffer_common.h" | 20 #include "gpu/command_buffer/common/cmd_buffer_common.h" |
| 21 #include "gpu/command_buffer/common/constants.h" |
21 #include "gpu/command_buffer/common/gles2_cmd_ids.h" | 22 #include "gpu/command_buffer/common/gles2_cmd_ids.h" |
22 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 23 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
23 | 24 |
24 // GL types are forward declared to avoid including the GL headers. The problem | 25 // GL types are forward declared to avoid including the GL headers. The problem |
25 // is determining which GL headers to include from code that is common to the | 26 // is determining which GL headers to include from code that is common to the |
26 // client and service sides (GLES2 or one of several GL implementations). | 27 // client and service sides (GLES2 or one of several GL implementations). |
27 typedef unsigned int GLenum; | 28 typedef unsigned int GLenum; |
28 typedef unsigned int GLbitfield; | 29 typedef unsigned int GLbitfield; |
29 typedef unsigned int GLuint; | 30 typedef unsigned int GLuint; |
30 typedef int GLint; | 31 typedef int GLint; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 int32_t matrix_stride; | 196 int32_t matrix_stride; |
196 int32_t is_row_major; | 197 int32_t is_row_major; |
197 }; | 198 }; |
198 | 199 |
199 // The format of the bucket filled out by GetUniformsivES3CHROMIUM | 200 // The format of the bucket filled out by GetUniformsivES3CHROMIUM |
200 struct UniformsES3Header { | 201 struct UniformsES3Header { |
201 uint32_t num_uniforms; | 202 uint32_t num_uniforms; |
202 // UniformES3Info uniforms[num_uniforms]; | 203 // UniformES3Info uniforms[num_uniforms]; |
203 }; | 204 }; |
204 | 205 |
| 206 // The format of fence sync tokens. |
| 207 struct SyncToken { |
| 208 CommandBufferNamespace namespace_id; |
| 209 uint64_t command_buffer_id; |
| 210 uint64_t release_count; |
| 211 |
| 212 bool operator<(const SyncToken& other) const { |
| 213 // TODO(dyen): Once all our compilers support c++11, we can replace this |
| 214 // long list of comparisons with std::tie(). |
| 215 return (namespace_id < other.namespace_id) || |
| 216 ((namespace_id == other.namespace_id) && |
| 217 ((command_buffer_id < other.command_buffer_id) || |
| 218 ((command_buffer_id == other.command_buffer_id) && |
| 219 (release_count < other.release_count)))); |
| 220 } |
| 221 }; |
| 222 |
205 // The format of QuerySync used by EXT_occlusion_query_boolean | 223 // The format of QuerySync used by EXT_occlusion_query_boolean |
206 struct QuerySync { | 224 struct QuerySync { |
207 void Reset() { | 225 void Reset() { |
208 process_count = 0; | 226 process_count = 0; |
209 result = 0; | 227 result = 0; |
210 } | 228 } |
211 | 229 |
212 base::subtle::Atomic32 process_count; | 230 base::subtle::Atomic32 process_count; |
213 uint64_t result; | 231 uint64_t result; |
214 }; | 232 }; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 "should be 24"); | 307 "should be 24"); |
290 static_assert(offsetof(UniformBlockInfo, referenced_by_fragment_shader) == 28, | 308 static_assert(offsetof(UniformBlockInfo, referenced_by_fragment_shader) == 28, |
291 "offset of UniformBlockInfo.referenced_by_fragment_shader " | 309 "offset of UniformBlockInfo.referenced_by_fragment_shader " |
292 "should be 28"); | 310 "should be 28"); |
293 | 311 |
294 static_assert(sizeof(UniformBlocksHeader) == 4, | 312 static_assert(sizeof(UniformBlocksHeader) == 4, |
295 "size of UniformBlocksHeader should be 4"); | 313 "size of UniformBlocksHeader should be 4"); |
296 static_assert(offsetof(UniformBlocksHeader, num_uniform_blocks) == 0, | 314 static_assert(offsetof(UniformBlocksHeader, num_uniform_blocks) == 0, |
297 "offset of UniformBlocksHeader.num_uniform_blocks should be 0"); | 315 "offset of UniformBlocksHeader.num_uniform_blocks should be 0"); |
298 | 316 |
| 317 static_assert(sizeof(SyncToken) <= GL_SYNC_TOKEN_SIZE_CHROMIUM, |
| 318 "size of SyncToken must not exceed GL_SYNC_TOKEN_SIZE_CHROMIUM"); |
| 319 |
299 namespace cmds { | 320 namespace cmds { |
300 | 321 |
301 #include "../common/gles2_cmd_format_autogen.h" | 322 #include "../common/gles2_cmd_format_autogen.h" |
302 | 323 |
303 // These are hand written commands. | 324 // These are hand written commands. |
304 // TODO(gman): Attempt to make these auto-generated. | 325 // TODO(gman): Attempt to make these auto-generated. |
305 | 326 |
306 struct GenMailboxCHROMIUM { | 327 struct GenMailboxCHROMIUM { |
307 typedef GenMailboxCHROMIUM ValueType; | 328 typedef GenMailboxCHROMIUM ValueType; |
308 static const CommandId kCmdId = kGenMailboxCHROMIUM; | 329 static const CommandId kCmdId = kGenMailboxCHROMIUM; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 "offset of CreateAndConsumeTextureCHROMIUMImmediate.client_id should be 8"); | 393 "offset of CreateAndConsumeTextureCHROMIUMImmediate.client_id should be 8"); |
373 | 394 |
374 | 395 |
375 #pragma pack(pop) | 396 #pragma pack(pop) |
376 | 397 |
377 } // namespace cmd | 398 } // namespace cmd |
378 } // namespace gles2 | 399 } // namespace gles2 |
379 } // namespace gpu | 400 } // namespace gpu |
380 | 401 |
381 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_ | 402 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_ |
OLD | NEW |