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/texture_manager.h" | 5 #include "gpu/command_buffer/service/texture_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 } | 855 } |
856 | 856 |
857 bool Texture::ValidForTexture( | 857 bool Texture::ValidForTexture( |
858 GLint target, | 858 GLint target, |
859 GLint level, | 859 GLint level, |
860 GLint xoffset, | 860 GLint xoffset, |
861 GLint yoffset, | 861 GLint yoffset, |
862 GLint zoffset, | 862 GLint zoffset, |
863 GLsizei width, | 863 GLsizei width, |
864 GLsizei height, | 864 GLsizei height, |
865 GLsizei depth, | 865 GLsizei depth) const { |
866 GLenum type) const { | |
867 size_t face_index = GLES2Util::GLTargetToFaceIndex(target); | 866 size_t face_index = GLES2Util::GLTargetToFaceIndex(target); |
868 if (level >= 0 && face_index < face_infos_.size() && | 867 if (level >= 0 && face_index < face_infos_.size() && |
869 static_cast<size_t>(level) < face_infos_[face_index].level_infos.size()) { | 868 static_cast<size_t>(level) < face_infos_[face_index].level_infos.size()) { |
870 const LevelInfo& info = face_infos_[face_index].level_infos[level]; | 869 const LevelInfo& info = face_infos_[face_index].level_infos[level]; |
871 int32 max_x; | 870 int32 max_x; |
872 int32 max_y; | 871 int32 max_y; |
873 int32 max_z; | 872 int32 max_z; |
874 return SafeAddInt32(xoffset, width, &max_x) && | 873 return SafeAddInt32(xoffset, width, &max_x) && |
875 SafeAddInt32(yoffset, height, &max_y) && | 874 SafeAddInt32(yoffset, height, &max_y) && |
876 SafeAddInt32(zoffset, depth, &max_z) && | 875 SafeAddInt32(zoffset, depth, &max_z) && |
877 xoffset >= 0 && | 876 xoffset >= 0 && |
878 yoffset >= 0 && | 877 yoffset >= 0 && |
879 zoffset >= 0 && | 878 zoffset >= 0 && |
880 max_x <= info.width && | 879 max_x <= info.width && |
881 max_y <= info.height && | 880 max_y <= info.height && |
882 max_z <= info.depth && | 881 max_z <= info.depth; |
883 type == info.type; | |
884 } | 882 } |
885 return false; | 883 return false; |
886 } | 884 } |
887 | 885 |
888 bool Texture::GetLevelSize( | 886 bool Texture::GetLevelSize( |
889 GLint target, GLint level, | 887 GLint target, GLint level, |
890 GLsizei* width, GLsizei* height, GLsizei* depth) const { | 888 GLsizei* width, GLsizei* height, GLsizei* depth) const { |
891 DCHECK(width); | 889 DCHECK(width); |
892 DCHECK(height); | 890 DCHECK(height); |
893 size_t face_index = GLES2Util::GLTargetToFaceIndex(target); | 891 size_t face_index = GLES2Util::GLTargetToFaceIndex(target); |
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2195 pmd->AddOwnershipEdge(client_guid, service_guid, importance); | 2193 pmd->AddOwnershipEdge(client_guid, service_guid, importance); |
2196 | 2194 |
2197 // Dump all sub-levels held by the texture. They will appear below the main | 2195 // Dump all sub-levels held by the texture. They will appear below the main |
2198 // gl/textures/client_X/texture_Y dump. | 2196 // gl/textures/client_X/texture_Y dump. |
2199 ref->texture()->DumpLevelMemory(pmd, memory_tracker_->ClientTracingId(), | 2197 ref->texture()->DumpLevelMemory(pmd, memory_tracker_->ClientTracingId(), |
2200 dump_name); | 2198 dump_name); |
2201 } | 2199 } |
2202 | 2200 |
2203 } // namespace gles2 | 2201 } // namespace gles2 |
2204 } // namespace gpu | 2202 } // namespace gpu |
OLD | NEW |