| 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 contains the command buffer helper class. | 5 // This file contains the command buffer helper class. |
| 6 | 6 |
| 7 #ifndef GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ | 7 #ifndef GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ |
| 8 #define GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ | 8 #define GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ |
| 9 | 9 |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 CommandBufferEntry* space = &entries_[put_]; | 130 CommandBufferEntry* space = &entries_[put_]; |
| 131 put_ += entries; | 131 put_ += entries; |
| 132 immediate_entry_count_ -= entries; | 132 immediate_entry_count_ -= entries; |
| 133 | 133 |
| 134 DCHECK_LE(put_, total_entry_count_); | 134 DCHECK_LE(put_, total_entry_count_); |
| 135 return space; | 135 return space; |
| 136 } | 136 } |
| 137 | 137 |
| 138 template <typename T> | 138 template <typename T> |
| 139 void ForceNullCheck(T* data) { | 139 void ForceNullCheck(T* data) { |
| 140 #if defined(OS_WIN) && defined(ARCH_CPU_64_BITS) | 140 #if defined(COMPILER_MSVC) && defined(ARCH_CPU_64_BITS) && !defined(__clang__) |
| 141 // 64-bit MSVC's alias analysis was determining that the command buffer | 141 // 64-bit MSVC's alias analysis was determining that the command buffer |
| 142 // entry couldn't be NULL, so it optimized out the NULL check. | 142 // entry couldn't be NULL, so it optimized out the NULL check. |
| 143 // Dereferencing the same datatype through a volatile pointer seems to | 143 // Dereferencing the same datatype through a volatile pointer seems to |
| 144 // prevent that from happening. http://crbug.com/361936 | 144 // prevent that from happening. http://crbug.com/361936 |
| 145 // TODO(jbauman): Remove once we're on VC2015, http://crbug.com/412902 |
| 145 if (data) | 146 if (data) |
| 146 static_cast<volatile T*>(data)->header; | 147 static_cast<volatile T*>(data)->header; |
| 147 #endif | 148 #endif |
| 148 } | 149 } |
| 149 | 150 |
| 150 // Typed version of GetSpace. Gets enough room for the given type and returns | 151 // Typed version of GetSpace. Gets enough room for the given type and returns |
| 151 // a reference to it. | 152 // a reference to it. |
| 152 template <typename T> | 153 template <typename T> |
| 153 T* GetCmdSpace() { | 154 T* GetCmdSpace() { |
| 154 COMPILE_ASSERT(T::kArgFlags == cmd::kFixed, Cmd_kArgFlags_not_kFixed); | 155 COMPILE_ASSERT(T::kArgFlags == cmd::kFixed, Cmd_kArgFlags_not_kFixed); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 // Can be used to track when prior commands have been flushed. | 334 // Can be used to track when prior commands have been flushed. |
| 334 uint32 flush_generation_; | 335 uint32 flush_generation_; |
| 335 | 336 |
| 336 friend class CommandBufferHelperTest; | 337 friend class CommandBufferHelperTest; |
| 337 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); | 338 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); |
| 338 }; | 339 }; |
| 339 | 340 |
| 340 } // namespace gpu | 341 } // namespace gpu |
| 341 | 342 |
| 342 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ | 343 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ |
| OLD | NEW |