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

Side by Side Diff: gpu/gles2_conform_support/egl/display.cc

Issue 10388131: Allow GLES2CmdDecoder to change the GLSurface associated with the default FBO. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 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
« no previous file with comments | « gpu/demos/framework/window.cc ('k') | gpu/gpu_common.gypi » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/gles2_conform_support/egl/display.h" 5 #include "gpu/gles2_conform_support/egl/display.h"
6 6
7 #include <vector> 7 #include <vector>
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "gpu/command_buffer/client/gles2_lib.h" 10 #include "gpu/command_buffer/client/gles2_lib.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 gl_surface_ = gfx::GLSurface::CreateViewGLSurface(false, win); 102 gl_surface_ = gfx::GLSurface::CreateViewGLSurface(false, win);
103 if (!gl_surface_.get()) 103 if (!gl_surface_.get())
104 return EGL_NO_SURFACE; 104 return EGL_NO_SURFACE;
105 105
106 gl_context_ = gfx::GLContext::CreateGLContext(NULL, 106 gl_context_ = gfx::GLContext::CreateGLContext(NULL,
107 gl_surface_.get(), 107 gl_surface_.get(),
108 gfx::PreferDiscreteGpu); 108 gfx::PreferDiscreteGpu);
109 if (!gl_context_.get()) 109 if (!gl_context_.get())
110 return EGL_NO_SURFACE; 110 return EGL_NO_SURFACE;
111 111
112 gl_context_->MakeCurrent(gl_surface_);
113
112 std::vector<int32> attribs; 114 std::vector<int32> attribs;
113 if (!decoder_->Initialize(gl_surface_.get(), 115 if (!decoder_->Initialize(gl_surface_.get(),
114 gl_context_.get(), 116 gl_context_.get(),
115 gl_surface_->IsOffscreen(), 117 gl_surface_->IsOffscreen(),
116 gfx::Size(), 118 gfx::Size(),
117 gpu::gles2::DisallowedFeatures(), 119 gpu::gles2::DisallowedFeatures(),
118 NULL, 120 NULL,
119 attribs)) { 121 attribs)) {
120 return EGL_NO_SURFACE; 122 return EGL_NO_SURFACE;
121 } 123 }
(...skipping 18 matching lines...) Expand all
140 gles2_cmd_helper_.reset(cmd_helper.release()); 142 gles2_cmd_helper_.reset(cmd_helper.release());
141 surface_.reset(new Surface(win)); 143 surface_.reset(new Surface(win));
142 144
143 return surface_.get(); 145 return surface_.get();
144 } 146 }
145 147
146 void Display::DestroySurface(EGLSurface surface) { 148 void Display::DestroySurface(EGLSurface surface) {
147 DCHECK(IsValidSurface(surface)); 149 DCHECK(IsValidSurface(surface));
148 gpu_scheduler_.reset(); 150 gpu_scheduler_.reset();
149 if (decoder_.get()) { 151 if (decoder_.get()) {
150 decoder_->Destroy(); 152 decoder_->Destroy(true);
151 } 153 }
152 decoder_.reset(); 154 decoder_.reset();
153 gl_surface_ = NULL; 155 gl_surface_ = NULL;
154 gl_context_ = NULL; 156 gl_context_ = NULL;
155 surface_.reset(); 157 surface_.reset();
156 } 158 }
157 159
158 void Display::SwapBuffers(EGLSurface surface) { 160 void Display::SwapBuffers(EGLSurface surface) {
159 DCHECK(IsValidSurface(surface)); 161 DCHECK(IsValidSurface(surface));
160 context_->SwapBuffers(); 162 context_->SwapBuffers();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 } else { 209 } else {
208 DCHECK(IsValidSurface(draw)); 210 DCHECK(IsValidSurface(draw));
209 DCHECK(IsValidSurface(read)); 211 DCHECK(IsValidSurface(read));
210 DCHECK(IsValidContext(ctx)); 212 DCHECK(IsValidContext(ctx));
211 gles2::SetGLContext(context_.get()); 213 gles2::SetGLContext(context_.get());
212 } 214 }
213 return true; 215 return true;
214 } 216 }
215 217
216 } // namespace egl 218 } // namespace egl
OLDNEW
« no previous file with comments | « gpu/demos/framework/window.cc ('k') | gpu/gpu_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698