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

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

Issue 12649002: Refactor GPU code. Buffer* info to Buffer* buffer (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 #include "gpu/command_buffer/service/context_state.h" 5 #include "gpu/command_buffer/service/context_state.h"
6 6
7 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 7 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
8 #include "gpu/command_buffer/service/buffer_manager.h" 8 #include "gpu/command_buffer/service/buffer_manager.h"
9 #include "gpu/command_buffer/service/framebuffer_manager.h" 9 #include "gpu/command_buffer/service/framebuffer_manager.h"
10 #include "gpu/command_buffer/service/program_manager.h" 10 #include "gpu/command_buffer/service/program_manager.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } 96 }
97 97
98 void ContextState::RestoreActiveTexture() const { 98 void ContextState::RestoreActiveTexture() const {
99 glActiveTexture(GL_TEXTURE0 + active_texture_unit); 99 glActiveTexture(GL_TEXTURE0 + active_texture_unit);
100 } 100 }
101 101
102 void ContextState::RestoreAttribute(GLuint attrib) const { 102 void ContextState::RestoreAttribute(GLuint attrib) const {
103 const VertexAttrib* info = 103 const VertexAttrib* info =
104 vertex_attrib_manager->GetVertexAttrib(attrib); 104 vertex_attrib_manager->GetVertexAttrib(attrib);
105 const void* ptr = reinterpret_cast<const void*>(info->offset()); 105 const void* ptr = reinterpret_cast<const void*>(info->offset());
106 Buffer* buffer_info = info->buffer(); 106 Buffer* buffer = info->buffer();
107 glBindBuffer( 107 glBindBuffer(GL_ARRAY_BUFFER, buffer ? buffer->service_id() : 0);
108 GL_ARRAY_BUFFER, buffer_info ? buffer_info->service_id() : 0);
109 glVertexAttribPointer( 108 glVertexAttribPointer(
110 attrib, info->size(), info->type(), info->normalized(), 109 attrib, info->size(), info->type(), info->normalized(),
111 info->gl_stride(), ptr); 110 info->gl_stride(), ptr);
112 if (info->divisor()) 111 if (info->divisor())
113 glVertexAttribDivisorANGLE(attrib, info->divisor()); 112 glVertexAttribDivisorANGLE(attrib, info->divisor());
114 // Never touch vertex attribute 0's state (in particular, never 113 // Never touch vertex attribute 0's state (in particular, never
115 // disable it) when running on desktop GL because it will never be 114 // disable it) when running on desktop GL because it will never be
116 // re-enabled. 115 // re-enabled.
117 if (attrib != 0 || 116 if (attrib != 0 ||
118 gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2) { 117 gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 162
164 // Include the auto-generated part of this file. We split this because it means 163 // Include the auto-generated part of this file. We split this because it means
165 // we can easily edit the non-auto generated parts right here in this file 164 // we can easily edit the non-auto generated parts right here in this file
166 // instead of having to edit some template or the code generator. 165 // instead of having to edit some template or the code generator.
167 #include "gpu/command_buffer/service/context_state_impl_autogen.h" 166 #include "gpu/command_buffer/service/context_state_impl_autogen.h"
168 167
169 } // namespace gles2 168 } // namespace gles2
170 } // namespace gpu 169 } // namespace gpu
171 170
172 171
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/buffer_manager.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698