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

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

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
« no previous file with comments | « gpu/command_buffer/service/context_state.h ('k') | gpu/command_buffer/service/feature_info.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/gl/gl_bindings.h" 8 #include "ui/gl/gl_bindings.h"
9 #include "ui/gl/gl_implementation.h" 9 #include "ui/gl/gl_implementation.h"
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 if (feature_info_->feature_flags().arb_texture_rectangle) { 64 if (feature_info_->feature_flags().arb_texture_rectangle) {
65 service_id = texture_unit.bound_texture_rectangle_arb ? 65 service_id = texture_unit.bound_texture_rectangle_arb ?
66 texture_unit.bound_texture_rectangle_arb->service_id() : 0; 66 texture_unit.bound_texture_rectangle_arb->service_id() : 0;
67 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, service_id); 67 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, service_id);
68 } 68 }
69 } 69 }
70 70
71 void ContextState::RestoreBufferBindings() const { 71 void ContextState::RestoreBufferBindings() const {
72 if (vertex_attrib_manager) { 72 if (vertex_attrib_manager) {
73 BufferManager::BufferInfo* element_array_buffer = 73 BufferManager::Buffer* element_array_buffer =
74 vertex_attrib_manager->element_array_buffer(); 74 vertex_attrib_manager->element_array_buffer();
75 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 75 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,
76 element_array_buffer ? element_array_buffer->service_id() : 0); 76 element_array_buffer ? element_array_buffer->service_id() : 0);
77 } 77 }
78 glBindBuffer( 78 glBindBuffer(
79 GL_ARRAY_BUFFER, 79 GL_ARRAY_BUFFER,
80 bound_array_buffer ? bound_array_buffer->service_id() : 0); 80 bound_array_buffer ? bound_array_buffer->service_id() : 0);
81 } 81 }
82 82
83 void ContextState::RestoreRenderbufferBindings() const { 83 void ContextState::RestoreRenderbufferBindings() const {
84 // Restore Bindings 84 // Restore Bindings
85 glBindRenderbufferEXT( 85 glBindRenderbufferEXT(
86 GL_RENDERBUFFER, 86 GL_RENDERBUFFER,
87 bound_renderbuffer ? bound_renderbuffer->service_id() : 0); 87 bound_renderbuffer ? bound_renderbuffer->service_id() : 0);
88 } 88 }
89 89
90 void ContextState::RestoreProgramBindings() const { 90 void ContextState::RestoreProgramBindings() const {
91 glUseProgram(current_program ? current_program->service_id() : 0); 91 glUseProgram(current_program ? current_program->service_id() : 0);
92 } 92 }
93 93
94 void ContextState::RestoreActiveTexture() const { 94 void ContextState::RestoreActiveTexture() const {
95 glActiveTexture(GL_TEXTURE0 + active_texture_unit); 95 glActiveTexture(GL_TEXTURE0 + active_texture_unit);
96 } 96 }
97 97
98 void ContextState::RestoreAttribute(GLuint attrib) const { 98 void ContextState::RestoreAttribute(GLuint attrib) const {
99 const VertexAttribManager::VertexAttribInfo* info = 99 const VertexAttrib* info =
100 vertex_attrib_manager->GetVertexAttribInfo(attrib); 100 vertex_attrib_manager->GetVertexAttrib(attrib);
101 const void* ptr = reinterpret_cast<const void*>(info->offset()); 101 const void* ptr = reinterpret_cast<const void*>(info->offset());
102 BufferManager::BufferInfo* buffer_info = info->buffer(); 102 BufferManager::Buffer* buffer_info = info->buffer();
103 glBindBuffer( 103 glBindBuffer(
104 GL_ARRAY_BUFFER, buffer_info ? buffer_info->service_id() : 0); 104 GL_ARRAY_BUFFER, buffer_info ? buffer_info->service_id() : 0);
105 glVertexAttribPointer( 105 glVertexAttribPointer(
106 attrib, info->size(), info->type(), info->normalized(), 106 attrib, info->size(), info->type(), info->normalized(),
107 info->gl_stride(), ptr); 107 info->gl_stride(), ptr);
108 if (info->divisor()) 108 if (info->divisor())
109 glVertexAttribDivisorANGLE(attrib, info->divisor()); 109 glVertexAttribDivisorANGLE(attrib, info->divisor());
110 // Never touch vertex attribute 0's state (in particular, never 110 // Never touch vertex attribute 0's state (in particular, never
111 // disable it) when running on desktop GL because it will never be 111 // disable it) when running on desktop GL because it will never be
112 // re-enabled. 112 // re-enabled.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 // Include the auto-generated part of this file. We split this because it means 160 // Include the auto-generated part of this file. We split this because it means
161 // we can easily edit the non-auto generated parts right here in this file 161 // we can easily edit the non-auto generated parts right here in this file
162 // instead of having to edit some template or the code generator. 162 // instead of having to edit some template or the code generator.
163 #include "gpu/command_buffer/service/context_state_impl_autogen.h" 163 #include "gpu/command_buffer/service/context_state_impl_autogen.h"
164 164
165 } // namespace gles2 165 } // namespace gles2
166 } // namespace gpu 166 } // namespace gpu
167 167
168 168
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/context_state.h ('k') | gpu/command_buffer/service/feature_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698