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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 std::string error_message( | 1018 std::string error_message( |
1019 "OffscreenContext Creation failed, Shared context is lost"); | 1019 "OffscreenContext Creation failed, Shared context is lost"); |
1020 gl_info->errorMessage = WebString::fromUTF8(error_message); | 1020 gl_info->errorMessage = WebString::fromUTF8(error_message); |
1021 return nullptr; | 1021 return nullptr; |
1022 } | 1022 } |
1023 share_context = share_provider_impl->context_provider(); | 1023 share_context = share_provider_impl->context_provider(); |
1024 } | 1024 } |
1025 | 1025 |
1026 bool is_software_rendering = gpu_channel_host->gpu_info().software_rendering; | 1026 bool is_software_rendering = gpu_channel_host->gpu_info().software_rendering; |
1027 | 1027 |
1028 // This is an offscreen context, which doesn't use the default frame buffer, | |
1029 // so don't request any alpha, depth, stencil, antialiasing. | |
1030 gpu::gles2::ContextCreationAttribHelper attributes; | 1028 gpu::gles2::ContextCreationAttribHelper attributes; |
1031 attributes.alpha_size = -1; | 1029 |
1032 attributes.depth_size = 0; | 1030 attributes.own_offscreen_surface = web_attributes.ownOffscreenSurface; |
1033 attributes.stencil_size = 0; | 1031 if (web_attributes.ownOffscreenSurface) { |
1034 attributes.samples = 0; | 1032 attributes.alpha_size = web_attributes.alpha ? 8 : -1; |
1035 attributes.sample_buffers = 0; | 1033 attributes.depth_size = web_attributes.depth ? 24 : 0; |
| 1034 attributes.stencil_size = web_attributes.stencil ? 8 : 0; |
| 1035 attributes.samples = web_attributes.antialias ? 4 : 0; |
| 1036 attributes.sample_buffers = web_attributes.antialias ? 1 : 0; |
| 1037 } else { |
| 1038 // This is an offscreen context, which doesn't use the default frame buffer, |
| 1039 // so don't request any alpha, depth, stencil, antialiasing. |
| 1040 attributes.alpha_size = -1; |
| 1041 attributes.depth_size = 0; |
| 1042 attributes.stencil_size = 0; |
| 1043 attributes.samples = 0; |
| 1044 attributes.sample_buffers = 0; |
| 1045 } |
1036 attributes.bind_generates_resource = false; | 1046 attributes.bind_generates_resource = false; |
1037 // Prefer discrete GPU for WebGL. | 1047 // Prefer discrete GPU for WebGL. |
1038 attributes.gpu_preference = gl::PreferDiscreteGpu; | 1048 attributes.gpu_preference = gl::PreferDiscreteGpu; |
1039 | 1049 |
1040 attributes.fail_if_major_perf_caveat = | 1050 attributes.fail_if_major_perf_caveat = |
1041 web_attributes.failIfMajorPerformanceCaveat; | 1051 web_attributes.failIfMajorPerformanceCaveat; |
| 1052 |
1042 DCHECK_GT(web_attributes.webGLVersion, 0u); | 1053 DCHECK_GT(web_attributes.webGLVersion, 0u); |
1043 DCHECK_LE(web_attributes.webGLVersion, 2u); | 1054 DCHECK_LE(web_attributes.webGLVersion, 2u); |
1044 if (web_attributes.webGLVersion == 2) | 1055 if (web_attributes.webGLVersion == 2) |
1045 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL2; | 1056 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL2; |
1046 else | 1057 else |
1047 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL1; | 1058 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL1; |
1048 | 1059 |
1049 constexpr bool automatic_flushes = true; | 1060 constexpr bool automatic_flushes = true; |
1050 constexpr bool support_locking = false; | 1061 constexpr bool support_locking = false; |
1051 | 1062 |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1290 return &trial_token_validator_; | 1301 return &trial_token_validator_; |
1291 } | 1302 } |
1292 | 1303 |
1293 void RendererBlinkPlatformImpl::workerContextCreated( | 1304 void RendererBlinkPlatformImpl::workerContextCreated( |
1294 const v8::Local<v8::Context>& worker) { | 1305 const v8::Local<v8::Context>& worker) { |
1295 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( | 1306 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( |
1296 worker); | 1307 worker); |
1297 } | 1308 } |
1298 | 1309 |
1299 } // namespace content | 1310 } // namespace content |
OLD | NEW |