| 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/renderer/renderer_blink_platform_impl.h" | 5 #include "content/renderer/renderer_blink_platform_impl.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 std::string error_message( | 1007 std::string error_message( |
| 1008 "OffscreenContext Creation failed, Shared context is lost"); | 1008 "OffscreenContext Creation failed, Shared context is lost"); |
| 1009 gl_info->errorMessage = WebString::fromUTF8(error_message); | 1009 gl_info->errorMessage = WebString::fromUTF8(error_message); |
| 1010 return nullptr; | 1010 return nullptr; |
| 1011 } | 1011 } |
| 1012 share_context = share_provider_impl->context_provider(); | 1012 share_context = share_provider_impl->context_provider(); |
| 1013 } | 1013 } |
| 1014 | 1014 |
| 1015 bool is_software_rendering = gpu_channel_host->gpu_info().software_rendering; | 1015 bool is_software_rendering = gpu_channel_host->gpu_info().software_rendering; |
| 1016 | 1016 |
| 1017 // This is an offscreen context, which doesn't use the default frame buffer, | 1017 // This is an offscreen context. Generally it won't use the default |
| 1018 // so don't request any alpha, depth, stencil, antialiasing. | 1018 // frame buffer, in that case don't request any alpha, depth, stencil, |
| 1019 // antialiasing. But we do need those attributes for the "own |
| 1020 // offscreen surface" optimization which supports directly drawing |
| 1021 // to a custom surface backed frame buffer. |
| 1019 gpu::gles2::ContextCreationAttribHelper attributes; | 1022 gpu::gles2::ContextCreationAttribHelper attributes; |
| 1020 attributes.alpha_size = -1; | 1023 attributes.alpha_size = web_attributes.supportAlpha ? 8 : -1; |
| 1021 attributes.depth_size = 0; | 1024 attributes.depth_size = web_attributes.supportDepth ? 24 : 0; |
| 1022 attributes.stencil_size = 0; | 1025 attributes.stencil_size = web_attributes.supportStencil ? 8 : 0; |
| 1023 attributes.samples = 0; | 1026 attributes.samples = web_attributes.supportAntialias ? 4 : 0; |
| 1024 attributes.sample_buffers = 0; | 1027 attributes.sample_buffers = 0; |
| 1025 attributes.bind_generates_resource = false; | 1028 attributes.bind_generates_resource = false; |
| 1026 // Prefer discrete GPU for WebGL. | 1029 // Prefer discrete GPU for WebGL. |
| 1027 attributes.gpu_preference = gl::PreferDiscreteGpu; | 1030 attributes.gpu_preference = gl::PreferDiscreteGpu; |
| 1028 | 1031 |
| 1029 attributes.fail_if_major_perf_caveat = | 1032 attributes.fail_if_major_perf_caveat = |
| 1030 web_attributes.failIfMajorPerformanceCaveat; | 1033 web_attributes.failIfMajorPerformanceCaveat; |
| 1031 DCHECK_GT(web_attributes.webGLVersion, 0u); | 1034 DCHECK_GT(web_attributes.webGLVersion, 0u); |
| 1032 DCHECK_LE(web_attributes.webGLVersion, 2u); | 1035 DCHECK_LE(web_attributes.webGLVersion, 2u); |
| 1033 if (web_attributes.webGLVersion == 2) | 1036 if (web_attributes.webGLVersion == 2) |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1283 return &trial_token_validator_; | 1286 return &trial_token_validator_; |
| 1284 } | 1287 } |
| 1285 | 1288 |
| 1286 void RendererBlinkPlatformImpl::workerContextCreated( | 1289 void RendererBlinkPlatformImpl::workerContextCreated( |
| 1287 const v8::Local<v8::Context>& worker) { | 1290 const v8::Local<v8::Context>& worker) { |
| 1288 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( | 1291 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( |
| 1289 worker); | 1292 worker); |
| 1290 } | 1293 } |
| 1291 | 1294 |
| 1292 } // namespace content | 1295 } // namespace content |
| OLD | NEW |