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

Side by Side Diff: gpu/demos/framework/window.cc

Issue 8947016: Fix standalone gl demos and conformance tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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
« no previous file with comments | « no previous file | gpu/gles2_conform_support/egl/display.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "gpu/demos/framework/window.h" 5 #include "gpu/demos/framework/window.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 16 matching lines...) Expand all
27 27
28 namespace gpu { 28 namespace gpu {
29 namespace demos { 29 namespace demos {
30 30
31 Window::Window() 31 Window::Window()
32 : window_handle_(NULL), 32 : window_handle_(NULL),
33 demo_(CreateDemo()) { 33 demo_(CreateDemo()) {
34 } 34 }
35 35
36 Window::~Window() { 36 Window::~Window() {
37 if (decoder_.get()) {
38 decoder_->Destroy();
39 }
37 } 40 }
38 41
39 bool Window::Init(int width, int height) { 42 bool Window::Init(int width, int height) {
40 window_handle_ = CreateNativeWindow(demo_->Title(), width, height); 43 window_handle_ = CreateNativeWindow(demo_->Title(), width, height);
41 if (window_handle_ == NULL) 44 if (window_handle_ == NULL)
42 return false; 45 return false;
43 if (!CreateRenderContext(PluginWindow(window_handle_))) 46 if (!CreateRenderContext(PluginWindow(window_handle_)))
44 return false; 47 return false;
45 48
46 demo_->Resize(width, height); 49 demo_->Resize(width, height);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 gfx::Size(), 88 gfx::Size(),
86 gpu::gles2::DisallowedFeatures(), 89 gpu::gles2::DisallowedFeatures(),
87 NULL, 90 NULL,
88 attribs)) { 91 attribs)) {
89 return false; 92 return false;
90 } 93 }
91 94
92 command_buffer_->SetPutOffsetChangeCallback( 95 command_buffer_->SetPutOffsetChangeCallback(
93 base::Bind(&GpuScheduler::PutChanged, 96 base::Bind(&GpuScheduler::PutChanged,
94 base::Unretained(gpu_scheduler_.get()))); 97 base::Unretained(gpu_scheduler_.get())));
98 command_buffer_->SetGetBufferChangeCallback(
99 base::Bind(&GpuScheduler::SetGetBuffer,
100 base::Unretained(gpu_scheduler_.get())));
95 101
96 gles2_cmd_helper_.reset(new GLES2CmdHelper(command_buffer_.get())); 102 gles2_cmd_helper_.reset(new GLES2CmdHelper(command_buffer_.get()));
97 if (!gles2_cmd_helper_->Initialize(kCommandBufferSize)) 103 if (!gles2_cmd_helper_->Initialize(kCommandBufferSize))
98 return false; 104 return false;
99 105
100 int32 transfer_buffer_id = 106 int32 transfer_buffer_id =
101 command_buffer_->CreateTransferBuffer(kTransferBufferSize, -1); 107 command_buffer_->CreateTransferBuffer(kTransferBufferSize, -1);
102 Buffer transfer_buffer = 108 Buffer transfer_buffer =
103 command_buffer_->GetTransferBuffer(transfer_buffer_id); 109 command_buffer_->GetTransferBuffer(transfer_buffer_id);
104 if (transfer_buffer.ptr == NULL) return false; 110 if (transfer_buffer.ptr == NULL) return false;
105 111
106 ::gles2::Initialize(); 112 ::gles2::Initialize();
107 ::gles2::SetGLContext(new GLES2Implementation(gles2_cmd_helper_.get(), 113 ::gles2::SetGLContext(new GLES2Implementation(gles2_cmd_helper_.get(),
108 transfer_buffer.size, 114 transfer_buffer.size,
109 transfer_buffer.ptr, 115 transfer_buffer.ptr,
110 transfer_buffer_id, 116 transfer_buffer_id,
111 false, 117 false,
112 true)); 118 true));
113 return true; 119 return true;
114 } 120 }
115 121
116 } // namespace demos 122 } // namespace demos
117 } // namespace gpu 123 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/gles2_conform_support/egl/display.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698