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

Side by Side Diff: gpu/command_buffer/service/context_state.h

Issue 12326146: Refactor/Rename a bunch of GPU stuff (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
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 // This file contains the ContextState class. 5 // This file contains the ContextState class.
6 6
7 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ 7 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_
8 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ 8 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_
9 9
10 #include <vector> 10 #include <vector>
(...skipping 16 matching lines...) Expand all
27 27
28 // State associated with each texture unit. 28 // State associated with each texture unit.
29 struct GPU_EXPORT TextureUnit { 29 struct GPU_EXPORT TextureUnit {
30 TextureUnit(); 30 TextureUnit();
31 ~TextureUnit(); 31 ~TextureUnit();
32 32
33 // The last target that was bound to this texture unit. 33 // The last target that was bound to this texture unit.
34 GLenum bind_target; 34 GLenum bind_target;
35 35
36 // texture currently bound to this unit's GL_TEXTURE_2D with glBindTexture 36 // texture currently bound to this unit's GL_TEXTURE_2D with glBindTexture
37 TextureManager::TextureInfo::Ref bound_texture_2d; 37 scoped_refptr<Texture> bound_texture_2d;
38 38
39 // texture currently bound to this unit's GL_TEXTURE_CUBE_MAP with 39 // texture currently bound to this unit's GL_TEXTURE_CUBE_MAP with
40 // glBindTexture 40 // glBindTexture
41 TextureManager::TextureInfo::Ref bound_texture_cube_map; 41 scoped_refptr<Texture> bound_texture_cube_map;
42 42
43 // texture currently bound to this unit's GL_TEXTURE_EXTERNAL_OES with 43 // texture currently bound to this unit's GL_TEXTURE_EXTERNAL_OES with
44 // glBindTexture 44 // glBindTexture
45 TextureManager::TextureInfo::Ref bound_texture_external_oes; 45 scoped_refptr<Texture> bound_texture_external_oes;
46 46
47 // texture currently bound to this unit's GL_TEXTURE_RECTANGLE_ARB with 47 // texture currently bound to this unit's GL_TEXTURE_RECTANGLE_ARB with
48 // glBindTexture 48 // glBindTexture
49 TextureManager::TextureInfo::Ref bound_texture_rectangle_arb; 49 scoped_refptr<Texture> bound_texture_rectangle_arb;
50 50
51 TextureManager::TextureInfo::Ref GetInfoForSamplerType(GLenum type) { 51 scoped_refptr<Texture> GetInfoForSamplerType(
52 GLenum type) {
52 DCHECK(type == GL_SAMPLER_2D || type == GL_SAMPLER_CUBE || 53 DCHECK(type == GL_SAMPLER_2D || type == GL_SAMPLER_CUBE ||
53 type == GL_SAMPLER_EXTERNAL_OES || type == GL_SAMPLER_2D_RECT_ARB); 54 type == GL_SAMPLER_EXTERNAL_OES || type == GL_SAMPLER_2D_RECT_ARB);
54 switch (type) { 55 switch (type) {
55 case GL_SAMPLER_2D: 56 case GL_SAMPLER_2D:
56 return bound_texture_2d; 57 return bound_texture_2d;
57 case GL_SAMPLER_CUBE: 58 case GL_SAMPLER_CUBE:
58 return bound_texture_cube_map; 59 return bound_texture_cube_map;
59 case GL_SAMPLER_EXTERNAL_OES: 60 case GL_SAMPLER_EXTERNAL_OES:
60 return bound_texture_external_oes; 61 return bound_texture_external_oes;
61 case GL_SAMPLER_2D_RECT_ARB: 62 case GL_SAMPLER_2D_RECT_ARB:
62 return bound_texture_rectangle_arb; 63 return bound_texture_rectangle_arb;
63 } 64 }
64 65
65 NOTREACHED(); 66 NOTREACHED();
66 return NULL; 67 return NULL;
67 } 68 }
68 69
69 void Unbind(TextureManager::TextureInfo* texture) { 70 void Unbind(Texture* texture) {
70 if (bound_texture_2d == texture) { 71 if (bound_texture_2d == texture) {
71 bound_texture_2d = NULL; 72 bound_texture_2d = NULL;
72 } 73 }
73 if (bound_texture_cube_map == texture) { 74 if (bound_texture_cube_map == texture) {
74 bound_texture_cube_map = NULL; 75 bound_texture_cube_map = NULL;
75 } 76 }
76 if (bound_texture_external_oes == texture) { 77 if (bound_texture_external_oes == texture) {
77 bound_texture_external_oes = NULL; 78 bound_texture_external_oes = NULL;
78 } 79 }
79 } 80 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // unpack alignment as last set by glPixelStorei 125 // unpack alignment as last set by glPixelStorei
125 GLint unpack_alignment; 126 GLint unpack_alignment;
126 127
127 // Current active texture by 0 - n index. 128 // Current active texture by 0 - n index.
128 // In other words, if we call glActiveTexture(GL_TEXTURE2) this value would 129 // In other words, if we call glActiveTexture(GL_TEXTURE2) this value would
129 // be 2. 130 // be 2.
130 GLuint active_texture_unit; 131 GLuint active_texture_unit;
131 132
132 // The currently bound array buffer. If this is 0 it is illegal to call 133 // The currently bound array buffer. If this is 0 it is illegal to call
133 // glVertexAttribPointer. 134 // glVertexAttribPointer.
134 BufferManager::BufferInfo::Ref bound_array_buffer; 135 scoped_refptr<BufferManager::Buffer> bound_array_buffer;
135 136
136 // Which textures are bound to texture units through glActiveTexture. 137 // Which textures are bound to texture units through glActiveTexture.
137 std::vector<TextureUnit> texture_units; 138 std::vector<TextureUnit> texture_units;
138 139
139 // The values for each attrib. 140 // The values for each attrib.
140 std::vector<Vec4> attrib_values; 141 std::vector<Vec4> attrib_values;
141 142
142 // Class that manages vertex attribs. 143 // Class that manages vertex attribs.
143 VertexAttribManager::Ref vertex_attrib_manager; 144 scoped_refptr<VertexAttribManager> vertex_attrib_manager;
144 145
145 // The program in use by glUseProgram 146 // The program in use by glUseProgram
146 ProgramManager::ProgramInfo::Ref current_program; 147 scoped_refptr<Program> current_program;
147 148
148 // The currently bound framebuffers 149 // The currently bound framebuffers
149 FramebufferManager::FramebufferInfo::Ref bound_read_framebuffer; 150 scoped_refptr<Framebuffer> bound_read_framebuffer;
150 FramebufferManager::FramebufferInfo::Ref bound_draw_framebuffer; 151 scoped_refptr<Framebuffer> bound_draw_framebuffer;
151 152
152 // The currently bound renderbuffer 153 // The currently bound renderbuffer
153 RenderbufferManager::RenderbufferInfo::Ref bound_renderbuffer; 154 scoped_refptr<Renderbuffer> bound_renderbuffer;
154 155
155 QueryManager::Query::Ref current_query; 156 scoped_refptr<QueryManager::Query> current_query;
156 157
157 GLenum hint_generate_mipmap; 158 GLenum hint_generate_mipmap;
158 GLenum hint_fragment_shader_derivative; 159 GLenum hint_fragment_shader_derivative;
159 160
160 bool pack_reverse_row_order; 161 bool pack_reverse_row_order;
161 162
162 FeatureInfo* feature_info_; 163 FeatureInfo* feature_info_;
163 }; 164 };
164 165
165 } // namespace gles2 166 } // namespace gles2
166 } // namespace gpu 167 } // namespace gpu
167 168
168 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_ 169 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_H_
169 170
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/context_group_unittest.cc ('k') | gpu/command_buffer/service/context_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698