| Index: gpu/ipc/service/gpu_command_buffer_stub.cc
|
| diff --git a/gpu/ipc/service/gpu_command_buffer_stub.cc b/gpu/ipc/service/gpu_command_buffer_stub.cc
|
| index 6d305cf9ab99b670e9d8c743e9ad21c6cbd1161d..e5e060d364cd7b31adfc473ae7a350aaed56abd6 100644
|
| --- a/gpu/ipc/service/gpu_command_buffer_stub.cc
|
| +++ b/gpu/ipc/service/gpu_command_buffer_stub.cc
|
| @@ -655,20 +655,29 @@ bool GpuCommandBufferStub::Initialize(
|
| decoder_->set_engine(executor_.get());
|
|
|
| if (offscreen) {
|
| - if (init_params.attribs.depth_size > 0) {
|
| - surface_format.SetDepthBits(init_params.attribs.depth_size);
|
| + // Do we want to create an offscreen rendering context suitable
|
| + // for directly drawing to a separately supplied surface? In that
|
| + // case, we must ensure that the surface used for context creation
|
| + // is compatible with the requested attributes. This is explicitly
|
| + // opt-in since some context such as for NaCl request custom
|
| + // attributes but don't expect to get their own surface, and not
|
| + // all surface factories support custom formats.
|
| + if (init_params.attribs.own_offscreen_surface) {
|
| + if (init_params.attribs.depth_size > 0) {
|
| + surface_format.SetDepthBits(init_params.attribs.depth_size);
|
| + }
|
| + if (init_params.attribs.samples > 0) {
|
| + surface_format.SetSamples(init_params.attribs.samples);
|
| + }
|
| + if (init_params.attribs.stencil_size > 0) {
|
| + surface_format.SetStencilBits(init_params.attribs.stencil_size);
|
| + }
|
| + // Currently, we can't separately control alpha channel for surfaces,
|
| + // it's generally enabled by default except for RGB565 and (on desktop)
|
| + // smaller-than-32bit formats.
|
| + //
|
| + // TODO(klausw): use init_params.attribs.alpha_size here if possible.
|
| }
|
| - if (init_params.attribs.samples > 0) {
|
| - surface_format.SetSamples(init_params.attribs.samples);
|
| - }
|
| - if (init_params.attribs.stencil_size > 0) {
|
| - surface_format.SetStencilBits(init_params.attribs.stencil_size);
|
| - }
|
| - // Currently, we can't separately control alpha channel for surfaces,
|
| - // it's generally enabled by default except for RGB565 and (on desktop)
|
| - // smaller-than-32bit formats.
|
| - //
|
| - // TODO(klausw): use init_params.attribs.alpha_size here if possible.
|
| if (!surface_format.IsCompatible(default_surface->GetFormat())) {
|
| DVLOG(1) << __FUNCTION__ << ": Hit the OwnOffscreenSurface path";
|
| use_virtualized_gl_context_ = false;
|
|
|