OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #if defined(ENABLE_GPU) | 5 #if defined(ENABLE_GPU) |
6 | 6 |
7 #include "chrome/renderer/webgraphicscontext3d_command_buffer_impl.h" | 7 #include "chrome/renderer/webgraphicscontext3d_command_buffer_impl.h" |
8 | 8 |
9 #include <GLES2/gl2.h> | 9 #include <GLES2/gl2.h> |
10 #ifndef GL_GLEXT_PROTOTYPES | 10 #ifndef GL_GLEXT_PROTOTYPES |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 ggl::GGL_DEPTH_SIZE, depth_size, | 83 ggl::GGL_DEPTH_SIZE, depth_size, |
84 ggl::GGL_STENCIL_SIZE, stencil_size, | 84 ggl::GGL_STENCIL_SIZE, stencil_size, |
85 ggl::GGL_SAMPLES, samples, | 85 ggl::GGL_SAMPLES, samples, |
86 ggl::GGL_SAMPLE_BUFFERS, sample_buffers, | 86 ggl::GGL_SAMPLE_BUFFERS, sample_buffers, |
87 ggl::GGL_NONE, | 87 ggl::GGL_NONE, |
88 }; | 88 }; |
89 | 89 |
90 GPUInfo gpu_info = host->gpu_info(); | 90 GPUInfo gpu_info = host->gpu_info(); |
91 UMA_HISTOGRAM_ENUMERATION( | 91 UMA_HISTOGRAM_ENUMERATION( |
92 "GPU.WebGraphicsContext3D_Init_CanLoseContext", | 92 "GPU.WebGraphicsContext3D_Init_CanLoseContext", |
93 attributes.canRecoverFromContextLoss * 2 + gpu_info.can_lose_context(), | 93 attributes.canRecoverFromContextLoss * 2 + gpu_info.can_lose_context(), |
94 4); | 94 4); |
95 if (attributes.canRecoverFromContextLoss == false) { | 95 if (attributes.canRecoverFromContextLoss == false) { |
96 if (gpu_info.can_lose_context()) | 96 if (gpu_info.can_lose_context()) |
97 return false; | 97 return false; |
98 } | 98 } |
99 | 99 |
100 if (render_directly_to_web_view) { | 100 if (render_directly_to_web_view) { |
101 RenderView* renderview = RenderView::FromWebView(web_view); | 101 RenderView* renderview = RenderView::FromWebView(web_view); |
102 if (!renderview) | 102 if (!renderview) |
103 return false; | 103 return false; |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 void WebGraphicsContext3DCommandBufferImpl::unmapTexSubImage2DCHROMIUM( | 364 void WebGraphicsContext3DCommandBufferImpl::unmapTexSubImage2DCHROMIUM( |
365 const void* mem) { | 365 const void* mem) { |
366 glUnmapTexSubImage2DCHROMIUM(mem); | 366 glUnmapTexSubImage2DCHROMIUM(mem); |
367 } | 367 } |
368 | 368 |
369 void WebGraphicsContext3DCommandBufferImpl::copyTextureToParentTextureCHROMIUM( | 369 void WebGraphicsContext3DCommandBufferImpl::copyTextureToParentTextureCHROMIUM( |
370 unsigned texture, unsigned parentTexture) { | 370 unsigned texture, unsigned parentTexture) { |
371 copyTextureToCompositor(texture, parentTexture); | 371 copyTextureToCompositor(texture, parentTexture); |
372 } | 372 } |
373 | 373 |
| 374 WebKit::WebString WebGraphicsContext3DCommandBufferImpl:: |
| 375 getRequestableExtensionsCHROMIUM() { |
| 376 return WebKit::WebString::fromUTF8(glGetRequestableExtensionsCHROMIUM()); |
| 377 } |
| 378 |
| 379 void WebGraphicsContext3DCommandBufferImpl::requestExtensionCHROMIUM( |
| 380 const char* extension) { |
| 381 glRequestExtensionCHROMIUM(extension); |
| 382 } |
| 383 |
374 // Helper macros to reduce the amount of code. | 384 // Helper macros to reduce the amount of code. |
375 | 385 |
376 #define DELEGATE_TO_GL(name, glname) \ | 386 #define DELEGATE_TO_GL(name, glname) \ |
377 void WebGraphicsContext3DCommandBufferImpl::name() { \ | 387 void WebGraphicsContext3DCommandBufferImpl::name() { \ |
378 makeContextCurrent(); \ | 388 makeContextCurrent(); \ |
379 gl##glname(); \ | 389 gl##glname(); \ |
380 } | 390 } |
381 | 391 |
382 #define DELEGATE_TO_GL_1(name, glname, t1) \ | 392 #define DELEGATE_TO_GL_1(name, glname, t1) \ |
383 void WebGraphicsContext3DCommandBufferImpl::name(t1 a1) { \ | 393 void WebGraphicsContext3DCommandBufferImpl::name(t1 a1) { \ |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 } | 1022 } |
1013 | 1023 |
1014 void WebGraphicsContext3DCommandBufferImpl::copyTextureToCompositor( | 1024 void WebGraphicsContext3DCommandBufferImpl::copyTextureToCompositor( |
1015 unsigned texture, unsigned parentTexture) { | 1025 unsigned texture, unsigned parentTexture) { |
1016 makeContextCurrent(); | 1026 makeContextCurrent(); |
1017 glCopyTextureToParentTextureCHROMIUM(texture, parentTexture); | 1027 glCopyTextureToParentTextureCHROMIUM(texture, parentTexture); |
1018 glFlush(); | 1028 glFlush(); |
1019 } | 1029 } |
1020 | 1030 |
1021 #endif // defined(ENABLE_GPU) | 1031 #endif // defined(ENABLE_GPU) |
OLD | NEW |