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 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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, which doesn't use the default frame buffer, |
1018 // so don't request any alpha, depth, stencil, antialiasing. | 1018 // so don't request any alpha, depth, stencil, antialiasing. |
1019 gpu::gles2::ContextCreationAttribHelper attributes; | 1019 gpu::gles2::ContextCreationAttribHelper attributes; |
1020 attributes.alpha_size = -1; | 1020 |
1021 attributes.depth_size = 0; | 1021 if (web_attributes.supportOwnOffscreenSurface) { |
aelias_OOO_until_Jul13
2017/02/16 03:25:51
It doesn't look like this outer if statement is ne
klausw
2017/02/16 20:06:57
Done, and also updated the comment above to match
| |
1022 attributes.stencil_size = 0; | 1022 attributes.own_offscreen_surface = true; |
1023 attributes.samples = 0; | 1023 attributes.alpha_size = web_attributes.supportAlpha ? 8 : -1; |
1024 attributes.sample_buffers = 0; | 1024 attributes.depth_size = web_attributes.supportDepth ? 24 : 0; |
1025 attributes.stencil_size = web_attributes.supportStencil ? 8 : 0; | |
1026 attributes.samples = web_attributes.supportAntialias ? 4 : 0; | |
1027 attributes.sample_buffers = 0; | |
1028 } else { | |
1029 attributes.alpha_size = -1; | |
1030 attributes.depth_size = 0; | |
1031 attributes.stencil_size = 0; | |
1032 attributes.samples = 0; | |
1033 attributes.sample_buffers = 0; | |
1034 } | |
1025 attributes.bind_generates_resource = false; | 1035 attributes.bind_generates_resource = false; |
1026 // Prefer discrete GPU for WebGL. | 1036 // Prefer discrete GPU for WebGL. |
1027 attributes.gpu_preference = gl::PreferDiscreteGpu; | 1037 attributes.gpu_preference = gl::PreferDiscreteGpu; |
1028 | 1038 |
1029 attributes.fail_if_major_perf_caveat = | 1039 attributes.fail_if_major_perf_caveat = |
1030 web_attributes.failIfMajorPerformanceCaveat; | 1040 web_attributes.failIfMajorPerformanceCaveat; |
1041 | |
aelias_OOO_until_Jul13
2017/02/16 03:25:51
nit: unnecessary newline
klausw
2017/02/16 20:06:57
Done.
| |
1031 DCHECK_GT(web_attributes.webGLVersion, 0u); | 1042 DCHECK_GT(web_attributes.webGLVersion, 0u); |
1032 DCHECK_LE(web_attributes.webGLVersion, 2u); | 1043 DCHECK_LE(web_attributes.webGLVersion, 2u); |
1033 if (web_attributes.webGLVersion == 2) | 1044 if (web_attributes.webGLVersion == 2) |
1034 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL2; | 1045 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL2; |
1035 else | 1046 else |
1036 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL1; | 1047 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL1; |
1037 | 1048 |
1038 constexpr bool automatic_flushes = true; | 1049 constexpr bool automatic_flushes = true; |
1039 constexpr bool support_locking = false; | 1050 constexpr bool support_locking = false; |
1040 | 1051 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1283 return &trial_token_validator_; | 1294 return &trial_token_validator_; |
1284 } | 1295 } |
1285 | 1296 |
1286 void RendererBlinkPlatformImpl::workerContextCreated( | 1297 void RendererBlinkPlatformImpl::workerContextCreated( |
1287 const v8::Local<v8::Context>& worker) { | 1298 const v8::Local<v8::Context>& worker) { |
1288 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( | 1299 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( |
1289 worker); | 1300 worker); |
1290 } | 1301 } |
1291 | 1302 |
1292 } // namespace content | 1303 } // namespace content |
OLD | NEW |