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

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

Issue 2497013002: Fix a bug in compressed texture code path. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | 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/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 13659 matching lines...) Expand 10 before | Expand all | Expand 10 after
13670 } 13670 }
13671 13671
13672 if (!ValidateCompressedTexFuncData( 13672 if (!ValidateCompressedTexFuncData(
13673 func_name, width, height, depth, format, image_size, data) || 13673 func_name, width, height, depth, format, image_size, data) ||
13674 !ValidateCompressedTexSubDimensions( 13674 !ValidateCompressedTexSubDimensions(
13675 func_name, target, level, xoffset, yoffset, zoffset, 13675 func_name, target, level, xoffset, yoffset, zoffset,
13676 width, height, depth, format, texture)) { 13676 width, height, depth, format, texture)) {
13677 return error::kNoError; 13677 return error::kNoError;
13678 } 13678 }
13679 13679
13680 // Note: There is no need to deal with texture cleared tracking here 13680 if (!texture->IsLevelCleared(target, level)) {
13681 // because the validation above means you can only get here if the level 13681 // This can only happen if the compressed texture was allocated
13682 // is already a matching compressed format and in that case 13682 // using TexStorage{2|3}D.
13683 // CompressedTexImage{2|3}D already cleared the texture. 13683 DCHECK(texture->IsImmutable());
13684 DCHECK(texture->IsLevelCleared(target, level)); 13684 GLsizei level_width = 0, level_height = 0, level_depth = 0;
13685 bool success = texture->GetLevelSize(
13686 target, level, &level_width, &level_height, &level_depth);
13687 DCHECK(success);
13688 if (xoffset == 0 && width == level_width &&
13689 yoffset == 0 && height == level_height &&
13690 zoffset == 0 && depth == level_depth) {
13691 // We can skip the clear if we're uploading the entire level.
13692 texture_manager()->SetLevelCleared(texture_ref, target, level, true);
13693 } else {
13694 texture_manager()->ClearTextureLevel(this, texture_ref, target, level);
13695 }
13696 DCHECK(texture->IsLevelCleared(target, level));
13697 }
13685 13698
13686 const CompressedFormatInfo* format_info = 13699 const CompressedFormatInfo* format_info =
13687 GetCompressedFormatInfo(internal_format); 13700 GetCompressedFormatInfo(internal_format);
13688 if (format_info != nullptr && !format_info->support_check(*feature_info_)) { 13701 if (format_info != nullptr && !format_info->support_check(*feature_info_)) {
13689 std::unique_ptr<uint8_t[]> decompressed_data = DecompressTextureData( 13702 std::unique_ptr<uint8_t[]> decompressed_data = DecompressTextureData(
13690 state_, *format_info, width, height, depth, image_size, data); 13703 state_, *format_info, width, height, depth, image_size, data);
13691 if (!decompressed_data) { 13704 if (!decompressed_data) {
13692 MarkContextLost(error::kGuilty); 13705 MarkContextLost(error::kGuilty);
13693 group_->LoseContexts(error::kInnocent); 13706 group_->LoseContexts(error::kInnocent);
13694 return error::kLostContext; 13707 return error::kLostContext;
(...skipping 5150 matching lines...) Expand 10 before | Expand all | Expand 10 after
18845 } 18858 }
18846 18859
18847 // Include the auto-generated part of this file. We split this because it means 18860 // Include the auto-generated part of this file. We split this because it means
18848 // we can easily edit the non-auto generated parts right here in this file 18861 // we can easily edit the non-auto generated parts right here in this file
18849 // instead of having to edit some template or the code generator. 18862 // instead of having to edit some template or the code generator.
18850 #include "base/macros.h" 18863 #include "base/macros.h"
18851 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 18864 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
18852 18865
18853 } // namespace gles2 18866 } // namespace gles2
18854 } // namespace gpu 18867 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698