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

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

Issue 2482673002: fix --show-composited-layer-borders on Mac (Closed)
Patch Set: small fix Created 4 years, 1 month 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
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 10
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 fbo_binding_for_scissor_workaround_dirty(false), 223 fbo_binding_for_scissor_workaround_dirty(false),
224 framebuffer_srgb_(false), 224 framebuffer_srgb_(false),
225 feature_info_(feature_info), 225 feature_info_(feature_info),
226 error_state_(ErrorState::Create(error_state_client, logger)) { 226 error_state_(ErrorState::Create(error_state_client, logger)) {
227 Initialize(); 227 Initialize();
228 } 228 }
229 229
230 ContextState::~ContextState() { 230 ContextState::~ContextState() {
231 } 231 }
232 232
233 void ContextState::SetLineWidthBounds(GLfloat min, GLfloat max) {
234 line_width_min_ = min;
235 line_width_max_ = max;
236 }
237
233 void ContextState::RestoreTextureUnitBindings( 238 void ContextState::RestoreTextureUnitBindings(
234 GLuint unit, const ContextState* prev_state) const { 239 GLuint unit, const ContextState* prev_state) const {
235 DCHECK_LT(unit, texture_units.size()); 240 DCHECK_LT(unit, texture_units.size());
236 const TextureUnit& texture_unit = texture_units[unit]; 241 const TextureUnit& texture_unit = texture_units[unit];
237 GLuint service_id_2d = Get2dServiceId(texture_unit); 242 GLuint service_id_2d = Get2dServiceId(texture_unit);
238 GLuint service_id_cube = GetCubeServiceId(texture_unit); 243 GLuint service_id_cube = GetCubeServiceId(texture_unit);
239 GLuint service_id_oes = GetOesServiceId(texture_unit); 244 GLuint service_id_oes = GetOesServiceId(texture_unit);
240 GLuint service_id_arb = GetArbServiceId(texture_unit); 245 GLuint service_id_arb = GetArbServiceId(texture_unit);
241 246
242 bool bind_texture_2d = true; 247 bool bind_texture_2d = true;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 void ContextState::RestoreUnpackState() const { 295 void ContextState::RestoreUnpackState() const {
291 glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment); 296 glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment);
292 if (bound_pixel_unpack_buffer.get()) { 297 if (bound_pixel_unpack_buffer.get()) {
293 glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 298 glBindBuffer(GL_PIXEL_UNPACK_BUFFER,
294 GetBufferId(bound_pixel_unpack_buffer.get())); 299 GetBufferId(bound_pixel_unpack_buffer.get()));
295 glPixelStorei(GL_UNPACK_ROW_LENGTH, unpack_row_length); 300 glPixelStorei(GL_UNPACK_ROW_LENGTH, unpack_row_length);
296 glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, unpack_image_height); 301 glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, unpack_image_height);
297 } 302 }
298 } 303 }
299 304
305 void ContextState::DoLineWidth(GLfloat width) const {
306 glLineWidth(
307 std::min(std::max(width, line_width_min_), line_width_max_));
308 }
309
300 void ContextState::RestoreBufferBindings() const { 310 void ContextState::RestoreBufferBindings() const {
301 if (vertex_attrib_manager.get()) { 311 if (vertex_attrib_manager.get()) {
302 Buffer* element_array_buffer = 312 Buffer* element_array_buffer =
303 vertex_attrib_manager->element_array_buffer(); 313 vertex_attrib_manager->element_array_buffer();
304 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, GetBufferId(element_array_buffer)); 314 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, GetBufferId(element_array_buffer));
305 } 315 }
306 glBindBuffer(GL_ARRAY_BUFFER, GetBufferId(bound_array_buffer.get())); 316 glBindBuffer(GL_ARRAY_BUFFER, GetBufferId(bound_array_buffer.get()));
307 if (feature_info_->IsES3Capable()) { 317 if (feature_info_->IsES3Capable()) {
308 glBindBuffer(GL_COPY_READ_BUFFER, 318 glBindBuffer(GL_COPY_READ_BUFFER,
309 GetBufferId(bound_copy_read_buffer.get())); 319 GetBufferId(bound_copy_read_buffer.get()));
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 UpdateUnpackParameters(); 720 UpdateUnpackParameters();
711 } 721 }
712 722
713 // Include the auto-generated part of this file. We split this because it means 723 // Include the auto-generated part of this file. We split this because it means
714 // we can easily edit the non-auto generated parts right here in this file 724 // we can easily edit the non-auto generated parts right here in this file
715 // instead of having to edit some template or the code generator. 725 // instead of having to edit some template or the code generator.
716 #include "gpu/command_buffer/service/context_state_impl_autogen.h" 726 #include "gpu/command_buffer/service/context_state_impl_autogen.h"
717 727
718 } // namespace gles2 728 } // namespace gles2
719 } // namespace gpu 729 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/context_state.h ('k') | gpu/command_buffer/service/context_state_impl_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698