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/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 9587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9598 return; | 9598 return; |
9599 } | 9599 } |
9600 | 9600 |
9601 texture_manager()->SetLevelInfo( | 9601 texture_manager()->SetLevelInfo( |
9602 dest_info, GL_TEXTURE_2D, level, internal_format, source_width, | 9602 dest_info, GL_TEXTURE_2D, level, internal_format, source_width, |
9603 source_height, 1, 0, internal_format, dest_type, true); | 9603 source_height, 1, 0, internal_format, dest_type, true); |
9604 } else { | 9604 } else { |
9605 texture_manager()->SetLevelCleared(dest_info, GL_TEXTURE_2D, level, true); | 9605 texture_manager()->SetLevelCleared(dest_info, GL_TEXTURE_2D, level, true); |
9606 } | 9606 } |
9607 | 9607 |
9608 clear_state_dirty_ = true; | 9608 copy_texture_CHROMIUM_->DoCopyTexture(this, |
9609 glViewport(0, 0, source_width, source_height); | 9609 source_info->target(), |
9610 copy_texture_CHROMIUM_->DoCopyTexture(target, source_info->service_id(), | 9610 dest_info->target(), |
| 9611 source_info->service_id(), |
9611 dest_info->service_id(), level, | 9612 dest_info->service_id(), level, |
| 9613 source_width, source_height, |
9612 unpack_flip_y_, | 9614 unpack_flip_y_, |
9613 unpack_premultiply_alpha_, | 9615 unpack_premultiply_alpha_, |
9614 unpack_unpremultiply_alpha_); | 9616 unpack_unpremultiply_alpha_); |
9615 glViewport( | |
9616 state_.viewport_x, state_.viewport_y, | |
9617 state_.viewport_width, state_.viewport_height); | |
9618 | |
9619 // Restore all of the state touched by the extension. | |
9620 if (state_.current_program) | |
9621 glUseProgram(state_.current_program->service_id()); | |
9622 else | |
9623 glUseProgram(0); | |
9624 | |
9625 RestoreCurrentFramebufferBindings(); | |
9626 RestoreCurrentTexture2DBindings(); | |
9627 RestoreStateForAttrib( | |
9628 CopyTextureCHROMIUMResourceManager::kVertexPositionAttrib); | |
9629 RestoreStateForAttrib( | |
9630 CopyTextureCHROMIUMResourceManager::kVertexTextureAttrib); | |
9631 | |
9632 ApplyDirtyState(); | |
9633 } | 9617 } |
9634 | 9618 |
9635 static GLenum ExtractTypeFromStorageFormat(GLenum internalformat) { | 9619 static GLenum ExtractTypeFromStorageFormat(GLenum internalformat) { |
9636 switch (internalformat) { | 9620 switch (internalformat) { |
9637 case GL_RGB565: | 9621 case GL_RGB565: |
9638 return GL_UNSIGNED_SHORT_5_6_5; | 9622 return GL_UNSIGNED_SHORT_5_6_5; |
9639 case GL_RGBA4: | 9623 case GL_RGBA4: |
9640 return GL_UNSIGNED_SHORT_4_4_4_4; | 9624 return GL_UNSIGNED_SHORT_4_4_4_4; |
9641 case GL_RGB5_A1: | 9625 case GL_RGB5_A1: |
9642 return GL_UNSIGNED_SHORT_5_5_5_1; | 9626 return GL_UNSIGNED_SHORT_5_5_5_1; |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10153 return error::kNoError; | 10137 return error::kNoError; |
10154 } | 10138 } |
10155 | 10139 |
10156 // Include the auto-generated part of this file. We split this because it means | 10140 // Include the auto-generated part of this file. We split this because it means |
10157 // we can easily edit the non-auto generated parts right here in this file | 10141 // we can easily edit the non-auto generated parts right here in this file |
10158 // instead of having to edit some template or the code generator. | 10142 // instead of having to edit some template or the code generator. |
10159 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10143 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
10160 | 10144 |
10161 } // namespace gles2 | 10145 } // namespace gles2 |
10162 } // namespace gpu | 10146 } // namespace gpu |
OLD | NEW |