Index: components/html_viewer/web_graphics_context_3d_command_buffer_impl.cc |
diff --git a/components/html_viewer/web_graphics_context_3d_command_buffer_impl.cc b/components/html_viewer/web_graphics_context_3d_command_buffer_impl.cc |
index 70ffcdf0e4762c4792bd80203acbf27ddf27f38c..eeddf3ab04ad3b3cdc9b2a8b915991fca529281c 100644 |
--- a/components/html_viewer/web_graphics_context_3d_command_buffer_impl.cc |
+++ b/components/html_viewer/web_graphics_context_3d_command_buffer_impl.cc |
@@ -5,6 +5,7 @@ |
#include "components/html_viewer/web_graphics_context_3d_command_buffer_impl.h" |
#include "components/mus/public/interfaces/gpu.mojom.h" |
+#include "gpu/command_buffer/common/gles2_cmd_utils.h" |
#include "mojo/application/public/cpp/application_impl.h" |
#include "mojo/cc/context_provider_mojo.h" |
#include "mojo/gles2/gles2_context.h" |
@@ -29,9 +30,22 @@ WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl( |
command_buffer_handle_ = cb.PassInterface().PassHandle(); |
CHECK(command_buffer_handle_.is_valid()); |
// TODO(penghuang): Support share context. |
- // TODO(penghuang): Fill gl_info and pass attribuites to GPU. |
+ // TODO(penghuang): Fill gl_info. |
+ gpu::gles2::ContextCreationAttribHelper attrib_helper; |
+ attrib_helper.alpha_size = attributes.alpha ? 8 : 0; |
+ attrib_helper.depth_size = attributes.depth ? 24 : 0; |
+ attrib_helper.stencil_size = attributes.stencil ? 8 : 0; |
+ attrib_helper.samples = attributes.antialias ? 4 : 0; |
+ attrib_helper.sample_buffers = attributes.antialias ? 1 : 0; |
+ attrib_helper.fail_if_major_perf_caveat = |
+ attributes.failIfMajorPerformanceCaveat; |
+ attrib_helper.bind_generates_resource = false; |
+ attrib_helper.webgl_version = attributes.webGLVersion; |
+ std::vector<int32_t> attrib_vector; |
+ attrib_helper.Serialize(&attrib_vector); |
gles2_context_ = MojoGLES2CreateContext( |
command_buffer_handle_.release().value(), |
+ attrib_vector.data(), |
&ContextLostThunk, |
this, |
mojo::Environment::GetDefaultAsyncWaiter()); |