OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "android_webview/browser/scoped_app_gl_state_restore.h" | 5 #include "android_webview/browser/scoped_app_gl_state_restore.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 glGetIntegerv(GL_TEXTURE_BINDING_CUBE_MAP, &bindings.texture_cube_map); | 266 glGetIntegerv(GL_TEXTURE_BINDING_CUBE_MAP, &bindings.texture_cube_map); |
267 glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, | 267 glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, |
268 &bindings.texture_external_oes); | 268 &bindings.texture_external_oes); |
269 } | 269 } |
270 | 270 |
271 if (g_supports_oes_vertex_array_object) { | 271 if (g_supports_oes_vertex_array_object) { |
272 glGetIntegerv(GL_VERTEX_ARRAY_BINDING_OES, &vertex_array_bindings_oes_); | 272 glGetIntegerv(GL_VERTEX_ARRAY_BINDING_OES, &vertex_array_bindings_oes_); |
273 glBindVertexArrayOES(0); | 273 glBindVertexArrayOES(0); |
274 } | 274 } |
275 | 275 |
276 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(vertex_attrib_); ++i) { | 276 for (size_t i = 0; i < arraysize(vertex_attrib_); ++i) { |
277 glGetVertexAttribiv( | 277 glGetVertexAttribiv( |
278 i, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &vertex_attrib_[i].enabled); | 278 i, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &vertex_attrib_[i].enabled); |
279 glGetVertexAttribiv( | 279 glGetVertexAttribiv( |
280 i, GL_VERTEX_ATTRIB_ARRAY_SIZE, &vertex_attrib_[i].size); | 280 i, GL_VERTEX_ATTRIB_ARRAY_SIZE, &vertex_attrib_[i].size); |
281 glGetVertexAttribiv( | 281 glGetVertexAttribiv( |
282 i, GL_VERTEX_ATTRIB_ARRAY_TYPE, &vertex_attrib_[i].type); | 282 i, GL_VERTEX_ATTRIB_ARRAY_TYPE, &vertex_attrib_[i].type); |
283 glGetVertexAttribiv( | 283 glGetVertexAttribiv( |
284 i, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &vertex_attrib_[i].normalized); | 284 i, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &vertex_attrib_[i].normalized); |
285 glGetVertexAttribiv( | 285 glGetVertexAttribiv( |
286 i, GL_VERTEX_ATTRIB_ARRAY_STRIDE, &vertex_attrib_[i].stride); | 286 i, GL_VERTEX_ATTRIB_ARRAY_STRIDE, &vertex_attrib_[i].stride); |
(...skipping 15 matching lines...) Expand all Loading... |
302 MakeAppContextCurrent(); | 302 MakeAppContextCurrent(); |
303 | 303 |
304 DCHECK(ClearGLErrors(false, NULL)); | 304 DCHECK(ClearGLErrors(false, NULL)); |
305 | 305 |
306 glBindFramebufferEXT(GL_FRAMEBUFFER, framebuffer_binding_ext_); | 306 glBindFramebufferEXT(GL_FRAMEBUFFER, framebuffer_binding_ext_); |
307 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_array_buffer_binding_); | 307 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_array_buffer_binding_); |
308 | 308 |
309 if (g_supports_oes_vertex_array_object) | 309 if (g_supports_oes_vertex_array_object) |
310 glBindVertexArrayOES(0); | 310 glBindVertexArrayOES(0); |
311 | 311 |
312 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(vertex_attrib_); ++i) { | 312 for (size_t i = 0; i < arraysize(vertex_attrib_); ++i) { |
313 glBindBuffer(GL_ARRAY_BUFFER, | 313 glBindBuffer(GL_ARRAY_BUFFER, |
314 vertex_attrib_[i].vertex_attrib_array_buffer_binding); | 314 vertex_attrib_[i].vertex_attrib_array_buffer_binding); |
315 glVertexAttribPointer(i, | 315 glVertexAttribPointer(i, |
316 vertex_attrib_[i].size, | 316 vertex_attrib_[i].size, |
317 vertex_attrib_[i].type, | 317 vertex_attrib_[i].type, |
318 vertex_attrib_[i].normalized, | 318 vertex_attrib_[i].normalized, |
319 vertex_attrib_[i].stride, | 319 vertex_attrib_[i].stride, |
320 vertex_attrib_[i].pointer); | 320 vertex_attrib_[i].pointer); |
321 | 321 |
322 glVertexAttrib4fv(i, vertex_attrib_[i].current_vertex_attrib); | 322 glVertexAttrib4fv(i, vertex_attrib_[i].current_vertex_attrib); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 ScopedAppGLStateRestore::~ScopedAppGLStateRestore() {} | 424 ScopedAppGLStateRestore::~ScopedAppGLStateRestore() {} |
425 | 425 |
426 bool ScopedAppGLStateRestore::stencil_enabled() const { | 426 bool ScopedAppGLStateRestore::stencil_enabled() const { |
427 return impl_->stencil_enabled(); | 427 return impl_->stencil_enabled(); |
428 } | 428 } |
429 int ScopedAppGLStateRestore::framebuffer_binding_ext() const { | 429 int ScopedAppGLStateRestore::framebuffer_binding_ext() const { |
430 return impl_->framebuffer_binding_ext(); | 430 return impl_->framebuffer_binding_ext(); |
431 } | 431 } |
432 | 432 |
433 } // namespace android_webview | 433 } // namespace android_webview |
OLD | NEW |