Index: content/renderer/pepper_platform_context_3d_impl.cc |
=================================================================== |
--- content/renderer/pepper_platform_context_3d_impl.cc (revision 94518) |
+++ content/renderer/pepper_platform_context_3d_impl.cc (working copy) |
@@ -40,7 +40,7 @@ |
channel_ = NULL; |
} |
-bool PlatformContext3DImpl::Init() { |
+bool PlatformContext3DImpl::Init(const int32* attrib_list) { |
// Ignore initializing more than once. |
if (command_buffer_) |
return true; |
@@ -66,20 +66,35 @@ |
parent_gles2->helper()->CommandBufferHelper::Finish(); |
parent_texture_id_ = parent_gles2->MakeTextureId(); |
- // TODO(apatrick): Let Pepper plugins configure their back buffer surface. |
- static const int32 kAttribs[] = { |
- RendererGLContext::ALPHA_SIZE, 8, |
- RendererGLContext::DEPTH_SIZE, 24, |
- RendererGLContext::STENCIL_SIZE, 8, |
- RendererGLContext::SAMPLES, 0, |
- RendererGLContext::SAMPLE_BUFFERS, 0, |
- RendererGLContext::NONE, |
- }; |
- std::vector<int32> attribs(kAttribs, kAttribs + ARRAYSIZE_UNSAFE(kAttribs)); |
+ gfx::Size surface_size; |
+ std::vector<int32> attribs; |
+ // TODO(alokp): Change GpuChannelHost::CreateOffscreenCommandBuffer() |
+ // interface to accept width and height in the attrib_list so that |
+ // we do not need to filter for width and height here. |
+ if (attrib_list) { |
+ for (const int32_t* attr = attrib_list; |
+ attr[0] != RendererGLContext::NONE; |
+ attr += 2) { |
+ switch (attr[0]) { |
+ case RendererGLContext::WIDTH: |
+ surface_size.set_width(attr[1]); |
+ break; |
+ case RendererGLContext::HEIGHT: |
+ surface_size.set_height(attr[1]); |
+ break; |
+ default: |
+ attribs.push_back(attr[0]); |
+ attribs.push_back(attr[1]); |
+ break; |
+ } |
+ } |
+ attribs.push_back(RendererGLContext::NONE); |
+ } |
+ |
CommandBufferProxy* parent_command_buffer = |
parent_context_->GetCommandBufferProxy(); |
command_buffer_ = channel_->CreateOffscreenCommandBuffer( |
- gfx::Size(1, 1), |
+ surface_size, |
"*", |
attribs, |
GURL::EmptyGURL()); |