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

Side by Side Diff: ui/gl/gl_gl_api_implementation.cc

Issue 118203002: During virtual context switches only restore texture units that have changed from the previous cont… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use the delta between the ContextStates to decide if we should bind a texture or not Created 7 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
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 "ui/gl/gl_gl_api_implementation.h" 5 #include "ui/gl/gl_gl_api_implementation.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 298
299 DCHECK_EQ(real_context_, GLContext::GetRealCurrent()); 299 DCHECK_EQ(real_context_, GLContext::GetRealCurrent());
300 DCHECK(real_context_->IsCurrent(NULL)); 300 DCHECK(real_context_->IsCurrent(NULL));
301 DCHECK(virtual_context->IsCurrent(surface)); 301 DCHECK(virtual_context->IsCurrent(surface));
302 302
303 if (switched_contexts || virtual_context != current_context_) { 303 if (switched_contexts || virtual_context != current_context_) {
304 // There should be no errors from the previous context leaking into the 304 // There should be no errors from the previous context leaking into the
305 // new context. 305 // new context.
306 DCHECK_EQ(glGetErrorFn(), static_cast<GLenum>(GL_NO_ERROR)); 306 DCHECK_EQ(glGetErrorFn(), static_cast<GLenum>(GL_NO_ERROR));
307 307
308 current_context_ = virtual_context;
309 // Set all state that is different from the real state 308 // Set all state that is different from the real state
310 // NOTE: !!! This is a temporary implementation that just restores all
311 // state to let us test that it works.
312 // TODO: ASAP, change this to something that only restores the state
313 // needed for individual GL calls.
314 GLApi* temp = GetCurrentGLApi(); 309 GLApi* temp = GetCurrentGLApi();
315 SetGLToRealGLApi(); 310 SetGLToRealGLApi();
316 if (virtual_context->GetGLStateRestorer()->IsInitialized()) 311 if (virtual_context->GetGLStateRestorer()->IsInitialized()) {
317 virtual_context->GetGLStateRestorer()->RestoreState(); 312 if (current_context_ == NULL) {
313 LOG(ERROR) << "KAANB: besiktas!";
Ken Russell (switch to Gerrit) 2013/12/19 21:39:33 What does this mean? :)
kaanb 2013/12/20 13:20:31 It's the name of the soccer team I support :) I ne
314 }
315 virtual_context->GetGLStateRestorer()->RestoreState(
316 (current_context_)
no sievers 2013/12/19 21:13:50 && !switched_contexts I.e. only if we are using t
kaanb 2013/12/20 13:20:31 Done.
317 ? current_context_->GetGLStateRestorer()->GetContextState()
318 : NULL);
319 }
318 SetGLApi(temp); 320 SetGLApi(temp);
321 current_context_ = virtual_context;
319 } 322 }
320 SetGLApi(this); 323 SetGLApi(this);
321 324
322 virtual_context->SetCurrent(surface); 325 virtual_context->SetCurrent(surface);
323 if (!surface->OnMakeCurrent(virtual_context)) { 326 if (!surface->OnMakeCurrent(virtual_context)) {
324 LOG(ERROR) << "Could not make GLSurface current."; 327 LOG(ERROR) << "Could not make GLSurface current.";
325 return false; 328 return false;
326 } 329 }
327 return true; 330 return true;
328 } 331 }
329 332
330 void VirtualGLApi::OnReleaseVirtuallyCurrent(GLContext* virtual_context) { 333 void VirtualGLApi::OnReleaseVirtuallyCurrent(GLContext* virtual_context) {
331 if (current_context_ == virtual_context) 334 if (current_context_ == virtual_context)
332 current_context_ = NULL; 335 current_context_ = NULL;
333 } 336 }
334 337
335 const GLubyte* VirtualGLApi::glGetStringFn(GLenum name) { 338 const GLubyte* VirtualGLApi::glGetStringFn(GLenum name) {
336 switch (name) { 339 switch (name) {
337 case GL_EXTENSIONS: 340 case GL_EXTENSIONS:
338 return reinterpret_cast<const GLubyte*>(extensions_.c_str()); 341 return reinterpret_cast<const GLubyte*>(extensions_.c_str());
339 default: 342 default:
340 return driver_->fn.glGetStringFn(name); 343 return driver_->fn.glGetStringFn(name);
341 } 344 }
342 } 345 }
343 346
344 } // namespace gfx 347 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698