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 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 5 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
6 | 6 |
7 #include "third_party/khronos/GLES2/gl2.h" | 7 #include "third_party/khronos/GLES2/gl2.h" |
8 #ifndef GL_GLEXT_PROTOTYPES | 8 #ifndef GL_GLEXT_PROTOTYPES |
9 #define GL_GLEXT_PROTOTYPES 1 | 9 #define GL_GLEXT_PROTOTYPES 1 |
10 #endif | 10 #endif |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 !InitializeCommandBuffer(onscreen, | 336 !InitializeCommandBuffer(onscreen, |
337 allowed_extensions)) { | 337 allowed_extensions)) { |
338 return false; | 338 return false; |
339 } | 339 } |
340 | 340 |
341 // Create the GLES2 helper, which writes the command buffer protocol. | 341 // Create the GLES2 helper, which writes the command buffer protocol. |
342 gles2_helper_ = new gpu::gles2::GLES2CmdHelper(command_buffer_); | 342 gles2_helper_ = new gpu::gles2::GLES2CmdHelper(command_buffer_); |
343 if (!gles2_helper_->Initialize(kCommandBufferSize)) | 343 if (!gles2_helper_->Initialize(kCommandBufferSize)) |
344 return false; | 344 return false; |
345 | 345 |
| 346 if (attributes_.noAutomaticFlushes) |
| 347 gles2_helper_->SetAutomaticFlushes(false); |
| 348 |
346 // Create a transfer buffer used to copy resources between the renderer | 349 // Create a transfer buffer used to copy resources between the renderer |
347 // process and the GPU process. | 350 // process and the GPU process. |
348 transfer_buffer_ = new gpu::TransferBuffer(gles2_helper_); | 351 transfer_buffer_ = new gpu::TransferBuffer(gles2_helper_); |
349 | 352 |
350 WebGraphicsContext3DCommandBufferImpl* share_group_context = | 353 WebGraphicsContext3DCommandBufferImpl* share_group_context = |
351 g_all_shared_contexts.Pointer()->empty() ? | 354 g_all_shared_contexts.Pointer()->empty() ? |
352 NULL : *g_all_shared_contexts.Pointer()->begin(); | 355 NULL : *g_all_shared_contexts.Pointer()->begin(); |
353 | 356 |
354 // Create the object exposing the OpenGL API. | 357 // Create the object exposing the OpenGL API. |
355 gl_ = new gpu::gles2::GLES2Implementation( | 358 gl_ = new gpu::gles2::GLES2Implementation( |
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 swap_client_->OnViewContextSwapBuffersAborted(); | 1591 swap_client_->OnViewContextSwapBuffersAborted(); |
1589 } | 1592 } |
1590 | 1593 |
1591 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( | 1594 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( |
1592 const std::string& message, int id) { | 1595 const std::string& message, int id) { |
1593 if (error_message_callback_) { | 1596 if (error_message_callback_) { |
1594 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str()); | 1597 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str()); |
1595 error_message_callback_->onErrorMessage(str, id); | 1598 error_message_callback_->onErrorMessage(str, id); |
1596 } | 1599 } |
1597 } | 1600 } |
OLD | NEW |