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 // A class to emulate GLES2 over command buffers. | 5 // A class to emulate GLES2 over command buffers. |
6 | 6 |
7 #include "../client/gles2_implementation.h" | 7 #include "../client/gles2_implementation.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 } | 258 } |
259 | 259 |
260 void GLES2Implementation::WaitForCmd() { | 260 void GLES2Implementation::WaitForCmd() { |
261 TRACE_EVENT0("gpu", "GLES2::WaitForCmd"); | 261 TRACE_EVENT0("gpu", "GLES2::WaitForCmd"); |
262 helper_->CommandBufferHelper::Finish(); | 262 helper_->CommandBufferHelper::Finish(); |
263 } | 263 } |
264 | 264 |
265 bool GLES2Implementation::IsExtensionAvailable(const char* ext) { | 265 bool GLES2Implementation::IsExtensionAvailable(const char* ext) { |
266 const char* extensions = | 266 const char* extensions = |
267 reinterpret_cast<const char*>(GetStringHelper(GL_EXTENSIONS)); | 267 reinterpret_cast<const char*>(GetStringHelper(GL_EXTENSIONS)); |
| 268 if (!extensions) |
| 269 return false; |
| 270 |
268 int length = strlen(ext); | 271 int length = strlen(ext); |
269 while (true) { | 272 while (true) { |
270 int n = strcspn(extensions, " "); | 273 int n = strcspn(extensions, " "); |
271 if (n == length && 0 == strncmp(ext, extensions, length)) { | 274 if (n == length && 0 == strncmp(ext, extensions, length)) { |
272 return true; | 275 return true; |
273 } | 276 } |
274 if ('\0' == extensions[n]) { | 277 if ('\0' == extensions[n]) { |
275 return false; | 278 return false; |
276 } | 279 } |
277 extensions += n + 1; | 280 extensions += n + 1; |
(...skipping 3280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3558 return helper_->InsertSyncPointCHROMIUM(); | 3561 return helper_->InsertSyncPointCHROMIUM(); |
3559 } | 3562 } |
3560 | 3563 |
3561 // Include the auto-generated part of this file. We split this because it means | 3564 // Include the auto-generated part of this file. We split this because it means |
3562 // we can easily edit the non-auto generated parts right here in this file | 3565 // we can easily edit the non-auto generated parts right here in this file |
3563 // instead of having to edit some template or the code generator. | 3566 // instead of having to edit some template or the code generator. |
3564 #include "../client/gles2_implementation_impl_autogen.h" | 3567 #include "../client/gles2_implementation_impl_autogen.h" |
3565 | 3568 |
3566 } // namespace gles2 | 3569 } // namespace gles2 |
3567 } // namespace gpu | 3570 } // namespace gpu |
OLD | NEW |