| 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 | 1018 |
| 1019 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host( | 1019 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host( |
| 1020 RenderThreadImpl::current()->EstablishGpuChannelSync( | 1020 RenderThreadImpl::current()->EstablishGpuChannelSync( |
| 1021 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
); | 1021 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
); |
| 1022 | 1022 |
| 1023 WebGraphicsContext3DCommandBufferImpl* share_context = | 1023 WebGraphicsContext3DCommandBufferImpl* share_context = |
| 1024 share_provider ? static_cast<WebGraphicsContext3DCommandBufferImpl*>( | 1024 share_provider ? static_cast<WebGraphicsContext3DCommandBufferImpl*>( |
| 1025 share_provider->context3d()) | 1025 share_provider->context3d()) |
| 1026 : nullptr; | 1026 : nullptr; |
| 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. |
| 1028 gpu::gles2::ContextCreationAttribHelper attributes; | 1030 gpu::gles2::ContextCreationAttribHelper attributes; |
| 1029 // Defaults matching WebGraphicsContext3D::Attributes. | 1031 attributes.alpha_size = -1; |
| 1030 // TODO(danakj): This is an offscreen context, so we shouldn't care what the | 1032 attributes.depth_size = 0; |
| 1031 // default framebuffer has, as we won't be using it. Can we always set these | 1033 attributes.stencil_size = 0; |
| 1032 // to 0 and stop requesting them from blink (remove from the web_attributes)? | 1034 attributes.samples = 0; |
| 1033 // | 1035 attributes.sample_buffers = 0; |
| 1034 // From kbr: There's a subtle tie between the Blink-level code and the command | |
| 1035 // buffer. DrawingBuffer::initialize queries the GL_MAX_SAMPLES_ANGLE | |
| 1036 // parameter to figure out how many samples it can request when allocating its | |
| 1037 // multisampled renderbuffer or texture. I recall that if we don't request | |
| 1038 // antialiasing from the command buffer's default back buffer, that this query | |
| 1039 // comes back with 0, disabling WebGL's ability to antialias. I think that the | |
| 1040 // pixel tests would catch this if it were broken, but I'm not sure the WebGL | |
| 1041 // conformance suite would, since it's legal for a WebGL implementation to not | |
| 1042 // support antialiasing. | |
| 1043 attributes.alpha_size = 8; | |
| 1044 attributes.depth_size = 24; | |
| 1045 attributes.stencil_size = 8; | |
| 1046 attributes.samples = 4; | |
| 1047 attributes.sample_buffers = 1; | |
| 1048 attributes.bind_generates_resource = false; | 1036 attributes.bind_generates_resource = false; |
| 1049 // Overrides from WebGraphicsContext3D::Attributes. | 1037 |
| 1050 if (!web_attributes.alpha) | 1038 attributes.fail_if_major_perf_caveat = |
| 1051 attributes.alpha_size = 0; | 1039 web_attributes.failIfMajorPerformanceCaveat; |
| 1052 if (!web_attributes.depth) | |
| 1053 attributes.depth_size = 0; | |
| 1054 if (!web_attributes.stencil) | |
| 1055 attributes.stencil_size = 0; | |
| 1056 if (!web_attributes.antialias) | |
| 1057 attributes.samples = attributes.sample_buffers = 0; | |
| 1058 if (web_attributes.failIfMajorPerformanceCaveat) | |
| 1059 attributes.fail_if_major_perf_caveat = true; | |
| 1060 DCHECK_LE(web_attributes.webGLVersion, 2u); | 1040 DCHECK_LE(web_attributes.webGLVersion, 2u); |
| 1061 if (web_attributes.webGLVersion == 1) | 1041 if (web_attributes.webGLVersion == 1) |
| 1062 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL1; | 1042 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL1; |
| 1063 else if (web_attributes.webGLVersion == 2) | 1043 else if (web_attributes.webGLVersion == 2) |
| 1064 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL2; | 1044 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL2; |
| 1065 | 1045 |
| 1066 bool share_resources = web_attributes.shareResources; | 1046 bool share_resources = web_attributes.shareResources; |
| 1067 bool automatic_flushes = !web_attributes.noAutomaticFlushes; | 1047 bool automatic_flushes = !web_attributes.noAutomaticFlushes; |
| 1068 gfx::GpuPreference gpu_preference = web_attributes.preferDiscreteGPU | 1048 gfx::GpuPreference gpu_preference = web_attributes.preferDiscreteGPU |
| 1069 ? gfx::PreferDiscreteGpu | 1049 ? gfx::PreferDiscreteGpu |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1306 } | 1286 } |
| 1307 | 1287 |
| 1308 //------------------------------------------------------------------------------ | 1288 //------------------------------------------------------------------------------ |
| 1309 | 1289 |
| 1310 blink::WebTrialTokenValidator* | 1290 blink::WebTrialTokenValidator* |
| 1311 RendererBlinkPlatformImpl::trialTokenValidator() { | 1291 RendererBlinkPlatformImpl::trialTokenValidator() { |
| 1312 return &trial_token_validator_; | 1292 return &trial_token_validator_; |
| 1313 } | 1293 } |
| 1314 | 1294 |
| 1315 } // namespace content | 1295 } // namespace content |
| OLD | NEW |