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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « ui/gl/dirty_texture_state.h ('k') | ui/gl/gl.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/gl/dirty_texture_state.h"
6
7 namespace gfx {
8
9 const size_t kMaxTextureUnits = 64;
10
11 DirtyTextureState::DirtyTextureState()
12 : bindings_(),
13 max_texture_unit_(GL_TEXTURE0) {
14 bindings_.resize(kMaxTextureUnits);
15 }
16
17 DirtyTextureState::~DirtyTextureState() {
18 }
19
20 void DirtyTextureState::UpdateMaxTextureUnit(GLenum current_unit) {
21 max_texture_unit_ = std::max(current_unit, max_texture_unit_);
22 }
23
24 void DirtyTextureState::AddBinding(GLenum current_unit, GLenum target) {
25 int current_unit_index = current_unit - GL_TEXTURE0;
26 DCHECK(current_unit_index >= 0);
27 DCHECK(static_cast<size_t>(current_unit_index) < kMaxTextureUnits);
28 DirtyTextureBindings binding_for_texture = bindings_[current_unit_index];
29
30 switch (target) {
31 case GL_TEXTURE_2D:
32 binding_for_texture.binding_2d = true;
33 break;
34 case GL_TEXTURE_CUBE_MAP:
35 binding_for_texture.binding_cube_map = true;
36 break;
37 case GL_TEXTURE_EXTERNAL_OES:
38 binding_for_texture.binding_external_oes = true;
39 break;
40 case GL_TEXTURE_RECTANGLE_ARB:
41 binding_for_texture.binding_rectangle_arb = true;
42 break;
43 default:
44 NOTREACHED();
45 }
46
47 bindings_[current_unit_index] = binding_for_texture;
48 }
49
50 void DirtyTextureState::Clear() {
51 max_texture_unit_ = GL_TEXTURE0;
52 bindings_.clear();
53 bindings_.resize(kMaxTextureUnits);
54 }
55
56 } // namespace gfx
OLDNEW
« 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