OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/pepper_platform_context_3d_impl.h" | 5 #include "content/renderer/pepper_platform_context_3d_impl.h" |
6 | 6 |
7 #include "content/renderer/render_thread.h" | 7 #include "content/renderer/render_thread.h" |
8 #include "content/renderer/gpu/renderer_gl_context.h" | 8 #include "content/renderer/gpu/renderer_gl_context.h" |
9 #include "content/renderer/gpu/gpu_channel_host.h" | 9 #include "content/renderer/gpu/gpu_channel_host.h" |
10 #include "content/renderer/gpu/command_buffer_proxy.h" | 10 #include "content/renderer/gpu/command_buffer_proxy.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 RendererGLContext::DEPTH_SIZE, 24, | 68 RendererGLContext::DEPTH_SIZE, 24, |
69 RendererGLContext::STENCIL_SIZE, 8, | 69 RendererGLContext::STENCIL_SIZE, 8, |
70 RendererGLContext::SAMPLES, 0, | 70 RendererGLContext::SAMPLES, 0, |
71 RendererGLContext::SAMPLE_BUFFERS, 0, | 71 RendererGLContext::SAMPLE_BUFFERS, 0, |
72 RendererGLContext::NONE, | 72 RendererGLContext::NONE, |
73 }; | 73 }; |
74 std::vector<int32> attribs(kAttribs, kAttribs + ARRAYSIZE_UNSAFE(kAttribs)); | 74 std::vector<int32> attribs(kAttribs, kAttribs + ARRAYSIZE_UNSAFE(kAttribs)); |
75 CommandBufferProxy* parent_command_buffer = | 75 CommandBufferProxy* parent_command_buffer = |
76 parent_context_->GetCommandBufferProxy(); | 76 parent_context_->GetCommandBufferProxy(); |
77 command_buffer_ = channel_->CreateOffscreenCommandBuffer( | 77 command_buffer_ = channel_->CreateOffscreenCommandBuffer( |
78 parent_command_buffer, | |
79 gfx::Size(1, 1), | 78 gfx::Size(1, 1), |
80 "*", | 79 "*", |
81 attribs, | 80 attribs, |
82 parent_texture_id_, | |
83 GURL::EmptyGURL()); | 81 GURL::EmptyGURL()); |
84 if (!command_buffer_) | 82 if (!command_buffer_) |
85 return false; | 83 return false; |
84 | |
85 if (!command_buffer_->SetParent(parent_command_buffer, parent_texture_id_)) | |
piman
2011/06/22 00:53:27
Actually this broke pepper. At this point the GpuC
apatrick_chromium
2011/06/22 17:53:14
Okay I'll look into it.
| |
86 return false; | |
87 | |
86 command_buffer_->SetChannelErrorCallback(callback_factory_.NewCallback( | 88 command_buffer_->SetChannelErrorCallback(callback_factory_.NewCallback( |
87 &PlatformContext3DImpl::OnContextLost)); | 89 &PlatformContext3DImpl::OnContextLost)); |
88 | 90 |
89 return true; | 91 return true; |
90 } | 92 } |
91 | 93 |
92 void PlatformContext3DImpl::SetSwapBuffersCallback(Callback0::Type* callback) { | 94 void PlatformContext3DImpl::SetSwapBuffersCallback(Callback0::Type* callback) { |
93 DCHECK(command_buffer_); | 95 DCHECK(command_buffer_); |
94 command_buffer_->SetSwapBuffersCallback(callback); | 96 command_buffer_->SetSwapBuffersCallback(callback); |
95 } | 97 } |
(...skipping 17 matching lines...) Expand all Loading... | |
113 } | 115 } |
114 | 116 |
115 void PlatformContext3DImpl::OnContextLost() { | 117 void PlatformContext3DImpl::OnContextLost() { |
116 DCHECK(command_buffer_); | 118 DCHECK(command_buffer_); |
117 | 119 |
118 if (context_lost_callback_.get()) | 120 if (context_lost_callback_.get()) |
119 context_lost_callback_->Run(); | 121 context_lost_callback_->Run(); |
120 } | 122 } |
121 | 123 |
122 #endif // ENABLE_GPU | 124 #endif // ENABLE_GPU |
OLD | NEW |