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

Side by Side Diff: gpu/command_buffer/service/gpu_processor_win.cc

Issue 2134006: Added EGL based GLContext.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 <windows.h> 5 #include <windows.h>
6 6
7 #include "app/gfx/gl/gl_context.h" 7 #include "app/gfx/gl/gl_context.h"
8 #include "gpu/command_buffer/service/gpu_processor.h" 8 #include "gpu/command_buffer/service/gpu_processor.h"
9 9
10 using ::base::SharedMemory; 10 using ::base::SharedMemory;
11 11
12 namespace gpu { 12 namespace gpu {
13 13
14 bool GPUProcessor::Initialize(gfx::PluginWindowHandle window, 14 bool GPUProcessor::Initialize(gfx::PluginWindowHandle window,
15 const gfx::Size& size, 15 const gfx::Size& size,
16 GPUProcessor* parent, 16 GPUProcessor* parent,
17 uint32 parent_texture_id) { 17 uint32 parent_texture_id) {
18 // Cannot reinitialize. 18 // Cannot reinitialize.
19 if (context_.get()) 19 if (context_.get())
20 return false; 20 return false;
21 21
22 // Get the parent decoder and the GLContext to share IDs with, if any. 22 // Get the parent decoder and the GLContext to share IDs with, if any.
23 gles2::GLES2Decoder* parent_decoder = NULL; 23 gles2::GLES2Decoder* parent_decoder = NULL;
24 gfx::GLContext* parent_context = NULL; 24 gfx::GLContext* parent_context = NULL;
25 void* parent_handle = NULL;
26 if (parent) { 25 if (parent) {
27 parent_decoder = parent->decoder_.get(); 26 parent_decoder = parent->decoder_.get();
28 DCHECK(parent_decoder); 27 DCHECK(parent_decoder);
29 28
30 parent_context = parent_decoder->GetGLContext(); 29 parent_context = parent_decoder->GetGLContext();
31 DCHECK(parent_context); 30 DCHECK(parent_context);
32
33 parent_handle = parent_context->GetHandle();
34 DCHECK(parent_handle);
35 } 31 }
36 32
37 // Create either a view or pbuffer based GLContext. 33 // Create either a view or pbuffer based GLContext.
38 if (window) { 34 if (window) {
39 DCHECK(!parent_handle); 35 DCHECK(!parent_context);
40 36
41 // TODO(apatrick): support multisampling. 37 // TODO(apatrick): support multisampling.
42 context_.reset(gfx::GLContext::CreateViewGLContext(window, false)); 38 context_.reset(gfx::GLContext::CreateViewGLContext(window, false));
43 } else { 39 } else {
44 context_.reset(gfx::GLContext::CreateOffscreenGLContext(parent_handle)); 40 context_.reset(gfx::GLContext::CreateOffscreenGLContext(parent_context));
45 } 41 }
46 42
47 if (!context_.get()) 43 if (!context_.get())
48 return false; 44 return false;
49 45
50 return InitializeCommon(size, parent_decoder, parent_texture_id); 46 return InitializeCommon(size, parent_decoder, parent_texture_id);
51 } 47 }
52 48
53 void GPUProcessor::Destroy() { 49 void GPUProcessor::Destroy() {
54 DestroyCommon(); 50 DestroyCommon();
55 } 51 }
56 52
57 void GPUProcessor::WillSwapBuffers() { 53 void GPUProcessor::WillSwapBuffers() {
58 if (wrapped_swap_buffers_callback_.get()) { 54 if (wrapped_swap_buffers_callback_.get()) {
59 wrapped_swap_buffers_callback_->Run(); 55 wrapped_swap_buffers_callback_->Run();
60 } 56 }
61 } 57 }
62 58
63 } // namespace gpu 59 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gpu_processor_mac.cc ('k') | gpu/command_buffer/service/program_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698