| 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 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 return nullptr; | 1013 return nullptr; |
| 1014 } | 1014 } |
| 1015 share_context = share_provider_impl->context_provider(); | 1015 share_context = share_provider_impl->context_provider(); |
| 1016 } | 1016 } |
| 1017 | 1017 |
| 1018 bool is_software_rendering = gpu_channel_host->gpu_info().software_rendering; | 1018 bool is_software_rendering = gpu_channel_host->gpu_info().software_rendering; |
| 1019 | 1019 |
| 1020 // This is an offscreen context, which doesn't use the default frame buffer, | 1020 // This is an offscreen context, which doesn't use the default frame buffer, |
| 1021 // so don't request any alpha, depth, stencil, antialiasing. | 1021 // so don't request any alpha, depth, stencil, antialiasing. |
| 1022 gpu::gles2::ContextCreationAttribHelper attributes; | 1022 gpu::gles2::ContextCreationAttribHelper attributes; |
| 1023 attributes.alpha_size = -1; | 1023 |
| 1024 attributes.depth_size = 0; | 1024 if (web_attributes.supportOwnOffscreenSurface) { |
| 1025 attributes.stencil_size = 0; | 1025 attributes.own_offscreen_surface = true; |
| 1026 attributes.samples = 0; | 1026 attributes.low_priority = true; |
| 1027 attributes.sample_buffers = 0; | 1027 // TODO(klausw): currently, alpha is available even when not requested. |
| 1028 attributes.alpha_size = web_attributes.supportAlpha ? 8 : -1; |
| 1029 attributes.depth_size = web_attributes.supportDepth ? 24 : 0; |
| 1030 attributes.stencil_size = web_attributes.supportStencil ? 8 : 0; |
| 1031 attributes.samples = web_attributes.supportAntialias ? 4 : 0; |
| 1032 attributes.sample_buffers = 0; |
| 1033 } else { |
| 1034 attributes.alpha_size = -1; |
| 1035 attributes.depth_size = 0; |
| 1036 attributes.stencil_size = 0; |
| 1037 attributes.samples = 0; |
| 1038 attributes.sample_buffers = 0; |
| 1039 } |
| 1028 attributes.bind_generates_resource = false; | 1040 attributes.bind_generates_resource = false; |
| 1029 // Prefer discrete GPU for WebGL. | 1041 // Prefer discrete GPU for WebGL. |
| 1030 attributes.gpu_preference = gl::PreferDiscreteGpu; | 1042 attributes.gpu_preference = gl::PreferDiscreteGpu; |
| 1031 | 1043 |
| 1032 attributes.fail_if_major_perf_caveat = | 1044 attributes.fail_if_major_perf_caveat = |
| 1033 web_attributes.failIfMajorPerformanceCaveat; | 1045 web_attributes.failIfMajorPerformanceCaveat; |
| 1046 |
| 1034 DCHECK_GT(web_attributes.webGLVersion, 0u); | 1047 DCHECK_GT(web_attributes.webGLVersion, 0u); |
| 1035 DCHECK_LE(web_attributes.webGLVersion, 2u); | 1048 DCHECK_LE(web_attributes.webGLVersion, 2u); |
| 1036 if (web_attributes.webGLVersion == 2) | 1049 if (web_attributes.webGLVersion == 2) |
| 1037 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL2; | 1050 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL2; |
| 1038 else | 1051 else |
| 1039 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL1; | 1052 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL1; |
| 1040 | 1053 |
| 1041 constexpr bool automatic_flushes = true; | 1054 constexpr bool automatic_flushes = true; |
| 1042 constexpr bool support_locking = false; | 1055 constexpr bool support_locking = false; |
| 1043 | 1056 |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1285 return &trial_token_validator_; | 1298 return &trial_token_validator_; |
| 1286 } | 1299 } |
| 1287 | 1300 |
| 1288 void RendererBlinkPlatformImpl::workerContextCreated( | 1301 void RendererBlinkPlatformImpl::workerContextCreated( |
| 1289 const v8::Local<v8::Context>& worker) { | 1302 const v8::Local<v8::Context>& worker) { |
| 1290 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( | 1303 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( |
| 1291 worker); | 1304 worker); |
| 1292 } | 1305 } |
| 1293 | 1306 |
| 1294 } // namespace content | 1307 } // namespace content |
| OLD | NEW |