Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: content/renderer/renderer_blink_platform_impl.cc

Issue 1852533002: Remove alpha/depth/stencil/antialias from WGC3D::Attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@premul
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 1013
1014 scoped_refptr<GpuChannelHost> gpu_channel_host( 1014 scoped_refptr<GpuChannelHost> gpu_channel_host(
1015 RenderThreadImpl::current()->EstablishGpuChannelSync( 1015 RenderThreadImpl::current()->EstablishGpuChannelSync(
1016 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) ); 1016 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) );
1017 1017
1018 WebGraphicsContext3DCommandBufferImpl* share_context = 1018 WebGraphicsContext3DCommandBufferImpl* share_context =
1019 share_provider ? static_cast<WebGraphicsContext3DCommandBufferImpl*>( 1019 share_provider ? static_cast<WebGraphicsContext3DCommandBufferImpl*>(
1020 share_provider->context3d()) 1020 share_provider->context3d())
1021 : nullptr; 1021 : nullptr;
1022 1022
1023 // This is an offscreen context, which doesn't use the default frame buffer,
1024 // so don't request any alpha, depth, stencil, antialiasing.
1023 gpu::gles2::ContextCreationAttribHelper attributes; 1025 gpu::gles2::ContextCreationAttribHelper attributes;
1024 // Defaults matching WebGraphicsContext3D::Attributes. 1026 attributes.alpha_size = -1;
1025 // TODO(danakj): This is an offscreen context, so we shouldn't care what the 1027 attributes.depth_size = 0;
1026 // default framebuffer has, as we won't be using it. Can we always set these 1028 attributes.stencil_size = 0;
1027 // to 0 and stop requesting them from blink (remove from the web_attributes)? 1029 attributes.samples = 0;
1028 // 1030 attributes.sample_buffers = 0;
1029 // From kbr: There's a subtle tie between the Blink-level code and the command
1030 // buffer. DrawingBuffer::initialize queries the GL_MAX_SAMPLES_ANGLE
1031 // parameter to figure out how many samples it can request when allocating its
1032 // multisampled renderbuffer or texture. I recall that if we don't request
1033 // antialiasing from the command buffer's default back buffer, that this query
1034 // comes back with 0, disabling WebGL's ability to antialias. I think that the
1035 // pixel tests would catch this if it were broken, but I'm not sure the WebGL
1036 // conformance suite would, since it's legal for a WebGL implementation to not
1037 // support antialiasing.
1038 attributes.alpha_size = 8;
1039 attributes.depth_size = 24;
1040 attributes.stencil_size = 8;
1041 attributes.samples = 4;
1042 attributes.sample_buffers = 1;
1043 attributes.bind_generates_resource = false; 1031 attributes.bind_generates_resource = false;
1044 // Overrides from WebGraphicsContext3D::Attributes. 1032
1045 if (!web_attributes.alpha) 1033 attributes.fail_if_major_perf_caveat =
1046 attributes.alpha_size = 0; 1034 web_attributes.failIfMajorPerformanceCaveat;
1047 if (!web_attributes.depth)
1048 attributes.depth_size = 0;
1049 if (!web_attributes.stencil)
1050 attributes.stencil_size = 0;
1051 if (!web_attributes.antialias)
1052 attributes.samples = attributes.sample_buffers = 0;
1053 if (web_attributes.failIfMajorPerformanceCaveat)
1054 attributes.fail_if_major_perf_caveat = true;
1055 DCHECK_LE(web_attributes.webGLVersion, 2u); 1035 DCHECK_LE(web_attributes.webGLVersion, 2u);
1056 if (web_attributes.webGLVersion == 1) 1036 if (web_attributes.webGLVersion == 1)
1057 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL1; 1037 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL1;
1058 else if (web_attributes.webGLVersion == 2) 1038 else if (web_attributes.webGLVersion == 2)
1059 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL2; 1039 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL2;
1060 1040
1061 bool share_resources = web_attributes.shareResources; 1041 bool share_resources = web_attributes.shareResources;
1062 bool automatic_flushes = !web_attributes.noAutomaticFlushes; 1042 bool automatic_flushes = !web_attributes.noAutomaticFlushes;
1063 gfx::GpuPreference gpu_preference = web_attributes.preferDiscreteGPU 1043 gfx::GpuPreference gpu_preference = web_attributes.preferDiscreteGPU
1064 ? gfx::PreferDiscreteGpu 1044 ? gfx::PreferDiscreteGpu
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 } 1289 }
1310 1290
1311 //------------------------------------------------------------------------------ 1291 //------------------------------------------------------------------------------
1312 1292
1313 blink::WebTrialTokenValidator* 1293 blink::WebTrialTokenValidator*
1314 RendererBlinkPlatformImpl::trialTokenValidator() { 1294 RendererBlinkPlatformImpl::trialTokenValidator() {
1315 return &trial_token_validator_; 1295 return &trial_token_validator_;
1316 } 1296 }
1317 1297
1318 } // namespace content 1298 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698