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 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 <string.h> | 13 #include <string.h> |
| 14 | 14 |
| 15 #include "base/atomicops.h" | |
| 15 #include "gpu/command_buffer/common/bitfield_helpers.h" | 16 #include "gpu/command_buffer/common/bitfield_helpers.h" |
| 16 #include "gpu/command_buffer/common/cmd_buffer_common.h" | 17 #include "gpu/command_buffer/common/cmd_buffer_common.h" |
| 17 #include "gpu/command_buffer/common/gles2_cmd_ids.h" | 18 #include "gpu/command_buffer/common/gles2_cmd_ids.h" |
| 18 #include "gpu/command_buffer/common/types.h" | 19 #include "gpu/command_buffer/common/types.h" |
| 19 | 20 |
| 20 // GL types are forward declared to avoid including the GL headers. The problem | 21 // GL types are forward declared to avoid including the GL headers. The problem |
| 21 // is determining which GL headers to include from code that is common to the | 22 // is determining which GL headers to include from code that is common to the |
| 22 // client and service sides (GLES2 or one of several GL implementations). | 23 // client and service sides (GLES2 or one of several GL implementations). |
| 23 typedef unsigned int GLenum; | 24 typedef unsigned int GLenum; |
| 24 typedef unsigned int GLbitfield; | 25 typedef unsigned int GLbitfield; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 struct QuerySync { | 144 struct QuerySync { |
| 144 void Reset() { | 145 void Reset() { |
| 145 process_count = 0; | 146 process_count = 0; |
| 146 result = 0; | 147 result = 0; |
| 147 } | 148 } |
| 148 | 149 |
| 149 uint32 process_count; | 150 uint32 process_count; |
| 150 uint64 result; | 151 uint64 result; |
| 151 }; | 152 }; |
| 152 | 153 |
| 154 struct AsyncUploadSync { | |
| 155 void Reset() { | |
| 156 base::subtle::Release_Store(&async_upload_token, 0); | |
| 157 } | |
| 158 | |
| 159 void SetAsyncUploadToken(uint32 token) { | |
| 160 base::subtle::Release_Store(&async_upload_token, token); | |
| 161 } | |
| 162 | |
| 163 bool HasAsyncUploadTokenPassed(uint32 token) { | |
| 164 uint32_t current_token = base::subtle::Acquire_Load(&async_upload_token); | |
| 165 return (current_token - token < 0x80000000); | |
| 166 } | |
| 167 | |
| 168 base::subtle::Atomic32 async_upload_token; | |
| 169 }; | |
|
piman
2014/02/20 01:52:37
Can we add a unit test for this, that mimics our u
| |
| 170 | |
| 153 COMPILE_ASSERT(sizeof(ProgramInput) == 20, ProgramInput_size_not_20); | 171 COMPILE_ASSERT(sizeof(ProgramInput) == 20, ProgramInput_size_not_20); |
| 154 COMPILE_ASSERT(offsetof(ProgramInput, type) == 0, | 172 COMPILE_ASSERT(offsetof(ProgramInput, type) == 0, |
| 155 OffsetOf_ProgramInput_type_not_0); | 173 OffsetOf_ProgramInput_type_not_0); |
| 156 COMPILE_ASSERT(offsetof(ProgramInput, size) == 4, | 174 COMPILE_ASSERT(offsetof(ProgramInput, size) == 4, |
| 157 OffsetOf_ProgramInput_size_not_4); | 175 OffsetOf_ProgramInput_size_not_4); |
| 158 COMPILE_ASSERT(offsetof(ProgramInput, location_offset) == 8, | 176 COMPILE_ASSERT(offsetof(ProgramInput, location_offset) == 8, |
| 159 OffsetOf_ProgramInput_location_offset_not_8); | 177 OffsetOf_ProgramInput_location_offset_not_8); |
| 160 COMPILE_ASSERT(offsetof(ProgramInput, name_offset) == 12, | 178 COMPILE_ASSERT(offsetof(ProgramInput, name_offset) == 12, |
| 161 OffsetOf_ProgramInput_name_offset_not_12); | 179 OffsetOf_ProgramInput_name_offset_not_12); |
| 162 COMPILE_ASSERT(offsetof(ProgramInput, name_length) == 16, | 180 COMPILE_ASSERT(offsetof(ProgramInput, name_length) == 16, |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 438 CommandHeader header; | 456 CommandHeader header; |
| 439 }; | 457 }; |
| 440 | 458 |
| 441 #pragma pack(pop) | 459 #pragma pack(pop) |
| 442 | 460 |
| 443 } // namespace cmd | 461 } // namespace cmd |
| 444 } // namespace gles2 | 462 } // namespace gles2 |
| 445 } // namespace gpu | 463 } // namespace gpu |
| 446 | 464 |
| 447 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_ | 465 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_ |
| OLD | NEW |