Chromium Code Reviews| 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 attributes.alpha_size = web_attributes.supportAlpha ? 8 : -1; |
| 1028 attributes.depth_size = web_attributes.supportDepth ? 24 : 0; | |
| 1029 attributes.stencil_size = web_attributes.supportStencil ? 8 : 0; | |
| 1030 attributes.samples = web_attributes.supportAntialias ? 4 : 0; | |
| 1031 attributes.sample_buffers = 0; | |
| 1032 } else { | |
| 1033 attributes.alpha_size = -1; | |
|
dcheng
2017/01/09 23:14:57
Nit: I think this is the default value already (ht
klausw
2017/01/09 23:33:24
This matches the pre-patch logic, and in this case
| |
| 1034 attributes.depth_size = 0; | |
| 1035 attributes.stencil_size = 0; | |
| 1036 attributes.samples = 0; | |
| 1037 attributes.sample_buffers = 0; | |
| 1038 } | |
| 1028 attributes.bind_generates_resource = false; | 1039 attributes.bind_generates_resource = false; |
| 1029 // Prefer discrete GPU for WebGL. | 1040 // Prefer discrete GPU for WebGL. |
| 1030 attributes.gpu_preference = gl::PreferDiscreteGpu; | 1041 attributes.gpu_preference = gl::PreferDiscreteGpu; |
| 1031 | 1042 |
| 1032 attributes.fail_if_major_perf_caveat = | 1043 attributes.fail_if_major_perf_caveat = |
| 1033 web_attributes.failIfMajorPerformanceCaveat; | 1044 web_attributes.failIfMajorPerformanceCaveat; |
| 1045 | |
| 1034 DCHECK_GT(web_attributes.webGLVersion, 0u); | 1046 DCHECK_GT(web_attributes.webGLVersion, 0u); |
| 1035 DCHECK_LE(web_attributes.webGLVersion, 2u); | 1047 DCHECK_LE(web_attributes.webGLVersion, 2u); |
| 1036 if (web_attributes.webGLVersion == 2) | 1048 if (web_attributes.webGLVersion == 2) |
| 1037 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL2; | 1049 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL2; |
| 1038 else | 1050 else |
| 1039 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL1; | 1051 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL1; |
| 1040 | 1052 |
| 1041 constexpr bool automatic_flushes = true; | 1053 constexpr bool automatic_flushes = true; |
| 1042 constexpr bool support_locking = false; | 1054 constexpr bool support_locking = false; |
| 1043 | 1055 |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1285 return &trial_token_validator_; | 1297 return &trial_token_validator_; |
| 1286 } | 1298 } |
| 1287 | 1299 |
| 1288 void RendererBlinkPlatformImpl::workerContextCreated( | 1300 void RendererBlinkPlatformImpl::workerContextCreated( |
| 1289 const v8::Local<v8::Context>& worker) { | 1301 const v8::Local<v8::Context>& worker) { |
| 1290 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( | 1302 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( |
| 1291 worker); | 1303 worker); |
| 1292 } | 1304 } |
| 1293 | 1305 |
| 1294 } // namespace content | 1306 } // namespace content |
| OLD | NEW |