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

Unified Diff: gpu/command_buffer/service/gles2_cmd_srgb_converter.cc

Issue 2866663002: Fix overflow issue when generateMipmap for srgb texture (Closed)
Patch Set: Created 3 years, 7 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gles2_cmd_srgb_converter.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_srgb_converter.cc b/gpu/command_buffer/service/gles2_cmd_srgb_converter.cc
index 5556e9d20739c510b6c51434eff68252f51d2ac1..37e141faaa2a09cd57f59c71c50a503ea854fc88 100644
--- a/gpu/command_buffer/service/gles2_cmd_srgb_converter.cc
+++ b/gpu/command_buffer/service/gles2_cmd_srgb_converter.cc
@@ -424,8 +424,9 @@ void SRGBConverter::GenerateMipmap(const gles2::GLES2Decoder* decoder,
TextureManager::ComputeMipMapCount(target, width, height, depth);
}
const GLint max_mipmap_available_levels =
- (base_level + mipmap_levels) > max_level ? max_level
- : (base_level + mipmap_levels);
+ (base_level + mipmap_levels - 1) > max_level
yunchao 2017/05/05 08:01:48 Please check that max_level, not max_level - 1?
yizhou.jiang 2017/05/08 08:28:56 The variable name is quite confusing, so I change
+ ? max_level
+ : (base_level + mipmap_levels - 1);
glBindTexture(GL_TEXTURE_2D, srgb_converter_textures_[1]);
if (feature_info_->ext_color_buffer_float_available() &&
@@ -473,7 +474,7 @@ void SRGBConverter::GenerateMipmap(const gles2::GLES2Decoder* decoder,
// TODO(yizhou): An optimization. Attach 1 level at a time, once for every
// iteration of the loop.
- for (GLint level = base_level + 1; level < max_mipmap_available_levels;
+ for (GLint level = base_level + 1; level <= max_mipmap_available_levels;
yunchao 2017/05/05 08:01:48 I think it is <=, instead of <.
yizhou.jiang 2017/05/08 08:28:56 Done.
++level) {
// copy mipmaps level by level from srgb_converter_textures_[1] to tex
// generate mipmap for tex manually
« 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