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 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 gpu::gles2::ContextCreationAttribHelper attributes; | 1054 gpu::gles2::ContextCreationAttribHelper attributes; |
1055 attributes.alpha_size = -1; | 1055 attributes.alpha_size = -1; |
1056 attributes.depth_size = 0; | 1056 attributes.depth_size = 0; |
1057 attributes.stencil_size = 0; | 1057 attributes.stencil_size = 0; |
1058 attributes.samples = 0; | 1058 attributes.samples = 0; |
1059 attributes.sample_buffers = 0; | 1059 attributes.sample_buffers = 0; |
1060 attributes.bind_generates_resource = false; | 1060 attributes.bind_generates_resource = false; |
1061 | 1061 |
1062 attributes.fail_if_major_perf_caveat = | 1062 attributes.fail_if_major_perf_caveat = |
1063 web_attributes.failIfMajorPerformanceCaveat; | 1063 web_attributes.failIfMajorPerformanceCaveat; |
| 1064 DCHECK_GT(web_attributes.webGLVersion, 0u); |
1064 DCHECK_LE(web_attributes.webGLVersion, 2u); | 1065 DCHECK_LE(web_attributes.webGLVersion, 2u); |
1065 if (web_attributes.webGLVersion == 1) | 1066 if (web_attributes.webGLVersion == 2) |
| 1067 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL2; |
| 1068 else |
1066 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL1; | 1069 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL1; |
1067 else if (web_attributes.webGLVersion == 2) | |
1068 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL2; | |
1069 | 1070 |
1070 bool automatic_flushes = true; | 1071 bool automatic_flushes = true; |
1071 // Prefer discrete GPU for WebGL. | 1072 // Prefer discrete GPU for WebGL. |
1072 gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; | 1073 gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; |
1073 const auto& gpu_info = gpu_channel_host->gpu_info(); | 1074 const auto& gpu_info = gpu_channel_host->gpu_info(); |
1074 | 1075 |
1075 scoped_refptr<ContextProviderCommandBuffer> provider( | 1076 scoped_refptr<ContextProviderCommandBuffer> provider( |
1076 new ContextProviderCommandBuffer( | 1077 new ContextProviderCommandBuffer( |
1077 base::WrapUnique(new WebGraphicsContext3DCommandBufferImpl( | 1078 base::WrapUnique(new WebGraphicsContext3DCommandBufferImpl( |
1078 gpu::kNullSurfaceHandle, GURL(top_document_web_url), | 1079 gpu::kNullSurfaceHandle, GURL(top_document_web_url), |
1079 std::move(gpu_channel_host), attributes, gpu_preference, | 1080 std::move(gpu_channel_host), gpu_preference, automatic_flushes)), |
1080 automatic_flushes)), | 1081 gpu::SharedMemoryLimits(), attributes, share_context, |
1081 gpu::SharedMemoryLimits(), share_context, | 1082 command_buffer_metrics::OFFSCREEN_CONTEXT_FOR_WEBGL)); |
1082 RENDERER_MAINTHREAD_CONTEXT)); | |
1083 if (!provider->BindToCurrentThread()) { | 1083 if (!provider->BindToCurrentThread()) { |
1084 // Collect Graphicsinfo if there is a context failure or it is failed | 1084 // Collect Graphicsinfo if there is a context failure or it is failed |
1085 // purposefully in case of layout tests. | 1085 // purposefully in case of layout tests. |
1086 Collect3DContextInformationOnFailure(gl_info, gpu_info); | 1086 Collect3DContextInformationOnFailure(gl_info, gpu_info); |
1087 return nullptr; | 1087 return nullptr; |
1088 } | 1088 } |
1089 return new WebGraphicsContext3DProviderImpl(std::move(provider)); | 1089 return new WebGraphicsContext3DProviderImpl(std::move(provider)); |
1090 } | 1090 } |
1091 | 1091 |
1092 //------------------------------------------------------------------------------ | 1092 //------------------------------------------------------------------------------ |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1304 } | 1304 } |
1305 | 1305 |
1306 //------------------------------------------------------------------------------ | 1306 //------------------------------------------------------------------------------ |
1307 | 1307 |
1308 blink::WebTrialTokenValidator* | 1308 blink::WebTrialTokenValidator* |
1309 RendererBlinkPlatformImpl::trialTokenValidator() { | 1309 RendererBlinkPlatformImpl::trialTokenValidator() { |
1310 return &trial_token_validator_; | 1310 return &trial_token_validator_; |
1311 } | 1311 } |
1312 | 1312 |
1313 } // namespace content | 1313 } // namespace content |
OLD | NEW |