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 <limits.h> | 7 #include <limits.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <stdio.h> | 10 #include <stdio.h> |
(...skipping 11520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11531 } | 11531 } |
11532 | 11532 |
11533 // Assumes the size has already been checked. | 11533 // Assumes the size has already been checked. |
11534 std::unique_ptr<char[]> zero(new char[size]); | 11534 std::unique_ptr<char[]> zero(new char[size]); |
11535 memset(zero.get(), 0, size); | 11535 memset(zero.get(), 0, size); |
11536 glBindTexture(texture->target(), texture->service_id()); | 11536 glBindTexture(texture->target(), texture->service_id()); |
11537 | 11537 |
11538 GLint y = 0; | 11538 GLint y = 0; |
11539 while (y < height) { | 11539 while (y < height) { |
11540 GLint h = y + tile_height > height ? height - y : tile_height; | 11540 GLint h = y + tile_height > height ? height - y : tile_height; |
11541 glTexSubImage2D(target, level, xoffset, yoffset + y, width, h, format, type, | 11541 glTexSubImage2D( |
11542 zero.get()); | 11542 target, level, xoffset, yoffset + y, width, h, |
| 11543 TextureManager::AdjustTexFormat(feature_info_.get(), format), |
| 11544 type, |
| 11545 zero.get()); |
11543 y += tile_height; | 11546 y += tile_height; |
11544 } | 11547 } |
11545 TextureRef* bound_texture = | 11548 TextureRef* bound_texture = |
11546 texture_manager()->GetTextureInfoForTarget(&state_, texture->target()); | 11549 texture_manager()->GetTextureInfoForTarget(&state_, texture->target()); |
11547 glBindTexture(texture->target(), | 11550 glBindTexture(texture->target(), |
11548 bound_texture ? bound_texture->service_id() : 0); | 11551 bound_texture ? bound_texture->service_id() : 0); |
11549 return true; | 11552 return true; |
11550 } | 11553 } |
11551 | 11554 |
11552 bool GLES2DecoderImpl::ClearCompressedTextureLevel(Texture* texture, | 11555 bool GLES2DecoderImpl::ClearCompressedTextureLevel(Texture* texture, |
(...skipping 3457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15010 bool valid_source_format = | 15013 bool valid_source_format = |
15011 source_internal_format == GL_RED || source_internal_format == GL_ALPHA || | 15014 source_internal_format == GL_RED || source_internal_format == GL_ALPHA || |
15012 source_internal_format == GL_RGB || source_internal_format == GL_RGBA || | 15015 source_internal_format == GL_RGB || source_internal_format == GL_RGBA || |
15013 source_internal_format == GL_RGB8 || source_internal_format == GL_RGBA8 || | 15016 source_internal_format == GL_RGB8 || source_internal_format == GL_RGBA8 || |
15014 source_internal_format == GL_LUMINANCE || | 15017 source_internal_format == GL_LUMINANCE || |
15015 source_internal_format == GL_LUMINANCE_ALPHA || | 15018 source_internal_format == GL_LUMINANCE_ALPHA || |
15016 source_internal_format == GL_BGRA_EXT || | 15019 source_internal_format == GL_BGRA_EXT || |
15017 source_internal_format == GL_BGRA8_EXT || | 15020 source_internal_format == GL_BGRA8_EXT || |
15018 source_internal_format == GL_RGB_YCBCR_420V_CHROMIUM || | 15021 source_internal_format == GL_RGB_YCBCR_420V_CHROMIUM || |
15019 source_internal_format == GL_RGB_YCBCR_422_CHROMIUM; | 15022 source_internal_format == GL_RGB_YCBCR_422_CHROMIUM; |
15020 if (!valid_source_format || !valid_dest_format) { | 15023 if (!valid_source_format) { |
| 15024 std::string msg = "invalid source internal format " + |
| 15025 GLES2Util::GetStringEnum(source_internal_format); |
15021 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, | 15026 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, |
15022 "invalid internal format"); | 15027 msg.c_str()); |
| 15028 return false; |
| 15029 } |
| 15030 if (!valid_dest_format) { |
| 15031 std::string msg = "invalid dest internal format " + |
| 15032 GLES2Util::GetStringEnum(dest_internal_format); |
| 15033 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, |
| 15034 msg.c_str()); |
15023 return false; | 15035 return false; |
15024 } | 15036 } |
15025 return true; | 15037 return true; |
15026 } | 15038 } |
15027 | 15039 |
15028 bool GLES2DecoderImpl::ValidateCompressedCopyTextureCHROMIUM( | 15040 bool GLES2DecoderImpl::ValidateCompressedCopyTextureCHROMIUM( |
15029 const char* function_name, | 15041 const char* function_name, |
15030 TextureRef* source_texture_ref, | 15042 TextureRef* source_texture_ref, |
15031 TextureRef* dest_texture_ref) { | 15043 TextureRef* dest_texture_ref) { |
15032 if (!source_texture_ref || !dest_texture_ref) { | 15044 if (!source_texture_ref || !dest_texture_ref) { |
(...skipping 2692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17725 } | 17737 } |
17726 | 17738 |
17727 // Include the auto-generated part of this file. We split this because it means | 17739 // Include the auto-generated part of this file. We split this because it means |
17728 // we can easily edit the non-auto generated parts right here in this file | 17740 // we can easily edit the non-auto generated parts right here in this file |
17729 // instead of having to edit some template or the code generator. | 17741 // instead of having to edit some template or the code generator. |
17730 #include "base/macros.h" | 17742 #include "base/macros.h" |
17731 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 17743 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
17732 | 17744 |
17733 } // namespace gles2 | 17745 } // namespace gles2 |
17734 } // namespace gpu | 17746 } // namespace gpu |
OLD | NEW |