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

Unified Diff: ui/gl/dirty_texture_state.cc

Issue 104833007: Restore only modified texture state during virtual context switches (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More cleanup 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gl/dirty_texture_state.h ('k') | ui/gl/gl.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/dirty_texture_state.cc
diff --git a/ui/gl/dirty_texture_state.cc b/ui/gl/dirty_texture_state.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1672167a42a6457b1e17a400b2f1d708980cb80b
--- /dev/null
+++ b/ui/gl/dirty_texture_state.cc
@@ -0,0 +1,56 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/gl/dirty_texture_state.h"
+
+namespace gfx {
+
+const size_t kMaxTextureUnits = 64;
+
+DirtyTextureState::DirtyTextureState()
+ : bindings_(),
+ max_texture_unit_(GL_TEXTURE0) {
+ bindings_.resize(kMaxTextureUnits);
+}
+
+DirtyTextureState::~DirtyTextureState() {
+}
+
+void DirtyTextureState::UpdateMaxTextureUnit(GLenum current_unit) {
+ max_texture_unit_ = std::max(current_unit, max_texture_unit_);
+}
+
+void DirtyTextureState::AddBinding(GLenum current_unit, GLenum target) {
+ int current_unit_index = current_unit - GL_TEXTURE0;
+ DCHECK(current_unit_index >= 0);
+ DCHECK(static_cast<size_t>(current_unit_index) < kMaxTextureUnits);
+ DirtyTextureBindings binding_for_texture = bindings_[current_unit_index];
+
+ switch (target) {
+ case GL_TEXTURE_2D:
+ binding_for_texture.binding_2d = true;
+ break;
+ case GL_TEXTURE_CUBE_MAP:
+ binding_for_texture.binding_cube_map = true;
+ break;
+ case GL_TEXTURE_EXTERNAL_OES:
+ binding_for_texture.binding_external_oes = true;
+ break;
+ case GL_TEXTURE_RECTANGLE_ARB:
+ binding_for_texture.binding_rectangle_arb = true;
+ break;
+ default:
+ NOTREACHED();
+ }
+
+ bindings_[current_unit_index] = binding_for_texture;
+}
+
+void DirtyTextureState::Clear() {
+ max_texture_unit_ = GL_TEXTURE0;
+ bindings_.clear();
+ bindings_.resize(kMaxTextureUnits);
+}
+
+} // namespace gfx
« no previous file with comments | « ui/gl/dirty_texture_state.h ('k') | ui/gl/gl.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698