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

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

Issue 2117183006: gpu: Clarify sized texture format is available only if ES3 context or immutable texture is supported (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rely on right extension Created 4 years, 5 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 unified diff | Download patch
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 15078 matching lines...) Expand 10 before | Expand all | Expand 10 after
15089 if (dimension == ContextState::k2D) { 15089 if (dimension == ContextState::k2D) {
15090 glTexStorage2DEXT(target, levels, internal_format, width, height); 15090 glTexStorage2DEXT(target, levels, internal_format, width, height);
15091 } else { 15091 } else {
15092 glTexStorage3D(target, levels, internal_format, width, height, depth); 15092 glTexStorage3D(target, levels, internal_format, width, height, depth);
15093 } 15093 }
15094 15094
15095 { 15095 {
15096 GLsizei level_width = width; 15096 GLsizei level_width = width;
15097 GLsizei level_height = height; 15097 GLsizei level_height = height;
15098 GLsizei level_depth = depth; 15098 GLsizei level_depth = depth;
15099 GLenum adjusted_format =
15100 feature_info_->IsES3Enabled() ? internal_format : format;
dshwang 2016/10/10 15:45:49 Remove this hack. Rationale 1. After ES3 support,
15101 for (int ii = 0; ii < levels; ++ii) { 15099 for (int ii = 0; ii < levels; ++ii) {
15102 if (target == GL_TEXTURE_CUBE_MAP) { 15100 if (target == GL_TEXTURE_CUBE_MAP) {
15103 for (int jj = 0; jj < 6; ++jj) { 15101 for (int jj = 0; jj < 6; ++jj) {
15104 GLenum face = GL_TEXTURE_CUBE_MAP_POSITIVE_X + jj; 15102 GLenum face = GL_TEXTURE_CUBE_MAP_POSITIVE_X + jj;
15105 texture_manager()->SetLevelInfo(texture_ref, face, ii, 15103 texture_manager()->SetLevelInfo(
15106 adjusted_format, 15104 texture_ref, face, ii, internal_format, level_width, level_height,
15107 level_width, level_height, 1, 15105 1, 0, format, type, gfx::Rect());
15108 0, format, type, gfx::Rect());
15109 } 15106 }
15110 } else { 15107 } else {
15111 texture_manager()->SetLevelInfo(texture_ref, target, ii, 15108 texture_manager()->SetLevelInfo(
15112 adjusted_format, 15109 texture_ref, target, ii, internal_format, level_width, level_height,
15113 level_width, level_height, level_depth, 15110 level_depth, 0, format, type, gfx::Rect());
15114 0, format, type, gfx::Rect());
15115 } 15111 }
15116 level_width = std::max(1, level_width >> 1); 15112 level_width = std::max(1, level_width >> 1);
15117 level_height = std::max(1, level_height >> 1); 15113 level_height = std::max(1, level_height >> 1);
15118 if (target == GL_TEXTURE_3D) 15114 if (target == GL_TEXTURE_3D)
15119 level_depth = std::max(1, level_depth >> 1); 15115 level_depth = std::max(1, level_depth >> 1);
15120 } 15116 }
15121 texture->SetImmutable(true); 15117 texture->SetImmutable(true);
15122 } 15118 }
15123 } 15119 }
15124 15120
(...skipping 1966 matching lines...) Expand 10 before | Expand all | Expand 10 after
17091 } 17087 }
17092 17088
17093 // Include the auto-generated part of this file. We split this because it means 17089 // Include the auto-generated part of this file. We split this because it means
17094 // we can easily edit the non-auto generated parts right here in this file 17090 // we can easily edit the non-auto generated parts right here in this file
17095 // instead of having to edit some template or the code generator. 17091 // instead of having to edit some template or the code generator.
17096 #include "base/macros.h" 17092 #include "base/macros.h"
17097 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 17093 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
17098 17094
17099 } // namespace gles2 17095 } // namespace gles2
17100 } // namespace gpu 17096 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/feature_info.cc ('k') | gpu/command_buffer/service/texture_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698