OLD | NEW |
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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 glBindTexture(GL_TEXTURE_CUBE_MAP, service_id_cube); | 258 glBindTexture(GL_TEXTURE_CUBE_MAP, service_id_cube); |
259 } | 259 } |
260 if (bind_texture_oes) { | 260 if (bind_texture_oes) { |
261 glBindTexture(GL_TEXTURE_EXTERNAL_OES, service_id_oes); | 261 glBindTexture(GL_TEXTURE_EXTERNAL_OES, service_id_oes); |
262 } | 262 } |
263 if (bind_texture_arb) { | 263 if (bind_texture_arb) { |
264 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, service_id_arb); | 264 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, service_id_arb); |
265 } | 265 } |
266 } | 266 } |
267 | 267 |
| 268 void ContextState::PushTextureDecompressionUnpackState() const { |
| 269 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); |
| 270 |
| 271 if (bound_pixel_unpack_buffer.get()) { |
| 272 glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); |
| 273 glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); |
| 274 glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0); |
| 275 } |
| 276 } |
| 277 |
| 278 void ContextState::RestoreUnpackState() const { |
| 279 glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment); |
| 280 if (bound_pixel_unpack_buffer.get()) { |
| 281 glBindBuffer(GL_PIXEL_UNPACK_BUFFER, |
| 282 GetBufferId(bound_pixel_unpack_buffer.get())); |
| 283 glPixelStorei(GL_UNPACK_ROW_LENGTH, unpack_row_length); |
| 284 glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, unpack_image_height); |
| 285 } |
| 286 } |
| 287 |
268 void ContextState::RestoreBufferBindings() const { | 288 void ContextState::RestoreBufferBindings() const { |
269 if (vertex_attrib_manager.get()) { | 289 if (vertex_attrib_manager.get()) { |
270 Buffer* element_array_buffer = | 290 Buffer* element_array_buffer = |
271 vertex_attrib_manager->element_array_buffer(); | 291 vertex_attrib_manager->element_array_buffer(); |
272 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, GetBufferId(element_array_buffer)); | 292 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, GetBufferId(element_array_buffer)); |
273 } | 293 } |
274 glBindBuffer(GL_ARRAY_BUFFER, GetBufferId(bound_array_buffer.get())); | 294 glBindBuffer(GL_ARRAY_BUFFER, GetBufferId(bound_array_buffer.get())); |
275 if (feature_info_->IsES3Capable()) { | 295 if (feature_info_->IsES3Capable()) { |
276 glBindBuffer(GL_COPY_READ_BUFFER, | 296 glBindBuffer(GL_COPY_READ_BUFFER, |
277 GetBufferId(bound_copy_read_buffer.get())); | 297 GetBufferId(bound_copy_read_buffer.get())); |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 UpdateUnpackParameters(); | 687 UpdateUnpackParameters(); |
668 } | 688 } |
669 | 689 |
670 // Include the auto-generated part of this file. We split this because it means | 690 // Include the auto-generated part of this file. We split this because it means |
671 // we can easily edit the non-auto generated parts right here in this file | 691 // we can easily edit the non-auto generated parts right here in this file |
672 // instead of having to edit some template or the code generator. | 692 // instead of having to edit some template or the code generator. |
673 #include "gpu/command_buffer/service/context_state_impl_autogen.h" | 693 #include "gpu/command_buffer/service/context_state_impl_autogen.h" |
674 | 694 |
675 } // namespace gles2 | 695 } // namespace gles2 |
676 } // namespace gpu | 696 } // namespace gpu |
OLD | NEW |