| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef GPU_COMMAND_BUFFER_COMMON_SYNC_TOKEN_H_ | 5 #ifndef GPU_COMMAND_BUFFER_COMMON_SYNC_TOKEN_H_ |
| 6 #define GPU_COMMAND_BUFFER_COMMON_SYNC_TOKEN_H_ | 6 #define GPU_COMMAND_BUFFER_COMMON_SYNC_TOKEN_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 } | 44 } |
| 45 | 45 |
| 46 void Clear() { | 46 void Clear() { |
| 47 verified_flush_ = false; | 47 verified_flush_ = false; |
| 48 namespace_id_ = CommandBufferNamespace::INVALID; | 48 namespace_id_ = CommandBufferNamespace::INVALID; |
| 49 extra_data_field_ = 0; | 49 extra_data_field_ = 0; |
| 50 command_buffer_id_ = CommandBufferId(); | 50 command_buffer_id_ = CommandBufferId(); |
| 51 release_count_ = 0; | 51 release_count_ = 0; |
| 52 } | 52 } |
| 53 | 53 |
| 54 void SetVerifyFlush() { | 54 void SetVerifyFlush() { verified_flush_ = true; } |
| 55 verified_flush_ = true; | |
| 56 } | |
| 57 | 55 |
| 58 bool HasData() const { | 56 bool HasData() const { |
| 59 return namespace_id_ != CommandBufferNamespace::INVALID; | 57 return namespace_id_ != CommandBufferNamespace::INVALID; |
| 60 } | 58 } |
| 61 | 59 |
| 62 int8_t* GetData() { return reinterpret_cast<int8_t*>(this); } | 60 int8_t* GetData() { return reinterpret_cast<int8_t*>(this); } |
| 63 | 61 |
| 64 const int8_t* GetConstData() const { | 62 const int8_t* GetConstData() const { |
| 65 return reinterpret_cast<const int8_t*>(this); | 63 return reinterpret_cast<const int8_t*>(this); |
| 66 } | 64 } |
| 67 | 65 |
| 66 bool IsEqual(const SyncToken& other) const { |
| 67 return namespace_id_ == other.namespace_id() && |
| 68 command_buffer_id_ == other.command_buffer_id() && |
| 69 release_count_ == other.release_count(); |
| 70 } |
| 71 |
| 68 bool verified_flush() const { return verified_flush_; } | 72 bool verified_flush() const { return verified_flush_; } |
| 69 CommandBufferNamespace namespace_id() const { return namespace_id_; } | 73 CommandBufferNamespace namespace_id() const { return namespace_id_; } |
| 70 CommandBufferId command_buffer_id() const { return command_buffer_id_; } | 74 CommandBufferId command_buffer_id() const { return command_buffer_id_; } |
| 71 uint64_t release_count() const { return release_count_; } | 75 uint64_t release_count() const { return release_count_; } |
| 72 | 76 |
| 73 // This extra data field can be used by command buffers to add extra | 77 // This extra data field can be used by command buffers to add extra |
| 74 // information to identify unverified sync tokens. The current purpose | 78 // information to identify unverified sync tokens. The current purpose |
| 75 // of this field is only for unverified sync tokens which only exist within | 79 // of this field is only for unverified sync tokens which only exist within |
| 76 // the same process so this information will not survive cross-process IPCs. | 80 // the same process so this information will not survive cross-process IPCs. |
| 77 int32_t extra_data_field() const { return extra_data_field_; } | 81 int32_t extra_data_field() const { return extra_data_field_; } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 103 CommandBufferId command_buffer_id_; | 107 CommandBufferId command_buffer_id_; |
| 104 uint64_t release_count_; | 108 uint64_t release_count_; |
| 105 }; | 109 }; |
| 106 | 110 |
| 107 static_assert(sizeof(SyncToken) <= GL_SYNC_TOKEN_SIZE_CHROMIUM, | 111 static_assert(sizeof(SyncToken) <= GL_SYNC_TOKEN_SIZE_CHROMIUM, |
| 108 "SyncToken size must not exceed GL_SYNC_TOKEN_SIZE_CHROMIUM"); | 112 "SyncToken size must not exceed GL_SYNC_TOKEN_SIZE_CHROMIUM"); |
| 109 | 113 |
| 110 } // namespace gpu | 114 } // namespace gpu |
| 111 | 115 |
| 112 #endif // GPU_COMMAND_BUFFER_COMMON_SYNC_TOKEN_H_ | 116 #endif // GPU_COMMAND_BUFFER_COMMON_SYNC_TOKEN_H_ |
| OLD | NEW |