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

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

Issue 1421903006: ui/gl: Move GLImage into gl namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ozone demo Created 5 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
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/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 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 } 1233 }
1234 } 1234 }
1235 1235
1236 UpdateMipCleared(&info, info.width, info.height, 1236 UpdateMipCleared(&info, info.width, info.height,
1237 gfx::Rect(info.width, info.height)); 1237 gfx::Rect(info.width, info.height));
1238 return true; 1238 return true;
1239 } 1239 }
1240 1240
1241 void Texture::SetLevelImage(GLenum target, 1241 void Texture::SetLevelImage(GLenum target,
1242 GLint level, 1242 GLint level,
1243 gfx::GLImage* image, 1243 gl::GLImage* image,
1244 ImageState state) { 1244 ImageState state) {
1245 DCHECK_GE(level, 0); 1245 DCHECK_GE(level, 0);
1246 size_t face_index = GLES2Util::GLTargetToFaceIndex(target); 1246 size_t face_index = GLES2Util::GLTargetToFaceIndex(target);
1247 DCHECK_LT(static_cast<size_t>(face_index), 1247 DCHECK_LT(static_cast<size_t>(face_index),
1248 face_infos_.size()); 1248 face_infos_.size());
1249 DCHECK_LT(static_cast<size_t>(level), 1249 DCHECK_LT(static_cast<size_t>(level),
1250 face_infos_[face_index].level_infos.size()); 1250 face_infos_[face_index].level_infos.size());
1251 Texture::LevelInfo& info = 1251 Texture::LevelInfo& info =
1252 face_infos_[face_index].level_infos[level]; 1252 face_infos_[face_index].level_infos[level];
1253 DCHECK_EQ(info.target, target); 1253 DCHECK_EQ(info.target, target);
1254 DCHECK_EQ(info.level, level); 1254 DCHECK_EQ(info.level, level);
1255 info.image = image; 1255 info.image = image;
1256 info.image_state = state; 1256 info.image_state = state;
1257 UpdateCanRenderCondition(); 1257 UpdateCanRenderCondition();
1258 UpdateHasImages(); 1258 UpdateHasImages();
1259 } 1259 }
1260 1260
1261 gfx::GLImage* Texture::GetLevelImage(GLint target, 1261 gl::GLImage* Texture::GetLevelImage(GLint target,
1262 GLint level, 1262 GLint level,
1263 ImageState* state) const { 1263 ImageState* state) const {
1264 if (target != GL_TEXTURE_2D && target != GL_TEXTURE_EXTERNAL_OES && 1264 if (target != GL_TEXTURE_2D && target != GL_TEXTURE_EXTERNAL_OES &&
1265 target != GL_TEXTURE_RECTANGLE_ARB) { 1265 target != GL_TEXTURE_RECTANGLE_ARB) {
1266 return NULL; 1266 return NULL;
1267 } 1267 }
1268 1268
1269 size_t face_index = GLES2Util::GLTargetToFaceIndex(target); 1269 size_t face_index = GLES2Util::GLTargetToFaceIndex(target);
1270 if (level >= 0 && face_index < face_infos_.size() && 1270 if (level >= 0 && face_index < face_infos_.size() &&
1271 static_cast<size_t>(level) < face_infos_[face_index].level_infos.size()) { 1271 static_cast<size_t>(level) < face_infos_[face_index].level_infos.size()) {
1272 const LevelInfo& info = face_infos_[face_index].level_infos[level]; 1272 const LevelInfo& info = face_infos_[face_index].level_infos[level];
1273 if (info.target != 0) { 1273 if (info.target != 0) {
1274 if (state) 1274 if (state)
1275 *state = info.image_state; 1275 *state = info.image_state;
1276 return info.image.get(); 1276 return info.image.get();
1277 } 1277 }
1278 } 1278 }
1279 return NULL; 1279 return NULL;
1280 } 1280 }
1281 1281
1282 gfx::GLImage* Texture::GetLevelImage(GLint target, GLint level) const { 1282 gl::GLImage* Texture::GetLevelImage(GLint target, GLint level) const {
1283 return GetLevelImage(target, level, nullptr); 1283 return GetLevelImage(target, level, nullptr);
1284 } 1284 }
1285 1285
1286 void Texture::DumpLevelMemory(base::trace_event::ProcessMemoryDump* pmd, 1286 void Texture::DumpLevelMemory(base::trace_event::ProcessMemoryDump* pmd,
1287 uint64_t client_tracing_id, 1287 uint64_t client_tracing_id,
1288 const std::string& dump_name) const { 1288 const std::string& dump_name) const {
1289 for (uint32_t face_index = 0; face_index < face_infos_.size(); ++face_index) { 1289 for (uint32_t face_index = 0; face_index < face_infos_.size(); ++face_index) {
1290 const auto& level_infos = face_infos_[face_index].level_infos; 1290 const auto& level_infos = face_infos_[face_index].level_infos;
1291 for (uint32_t level_index = 0; level_index < level_infos.size(); 1291 for (uint32_t level_index = 0; level_index < level_infos.size();
1292 ++level_index) { 1292 ++level_index) {
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
1718 return 1; 1718 return 1;
1719 default: 1719 default:
1720 return 1 + 1720 return 1 +
1721 base::bits::Log2Floor(std::max(std::max(width, height), depth)); 1721 base::bits::Log2Floor(std::max(std::max(width, height), depth));
1722 } 1722 }
1723 } 1723 }
1724 1724
1725 void TextureManager::SetLevelImage(TextureRef* ref, 1725 void TextureManager::SetLevelImage(TextureRef* ref,
1726 GLenum target, 1726 GLenum target,
1727 GLint level, 1727 GLint level,
1728 gfx::GLImage* image, 1728 gl::GLImage* image,
1729 Texture::ImageState state) { 1729 Texture::ImageState state) {
1730 DCHECK(ref); 1730 DCHECK(ref);
1731 ref->texture()->SetLevelImage(target, level, image, state); 1731 ref->texture()->SetLevelImage(target, level, image, state);
1732 } 1732 }
1733 1733
1734 size_t TextureManager::GetSignatureSize() const { 1734 size_t TextureManager::GetSignatureSize() const {
1735 return sizeof(TextureTag) + sizeof(TextureSignature); 1735 return sizeof(TextureTag) + sizeof(TextureSignature);
1736 } 1736 }
1737 1737
1738 void TextureManager::AddToSignature( 1738 void TextureManager::AddToSignature(
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
2163 pmd->AddOwnershipEdge(client_guid, service_guid, importance); 2163 pmd->AddOwnershipEdge(client_guid, service_guid, importance);
2164 2164
2165 // Dump all sub-levels held by the texture. They will appear below the main 2165 // Dump all sub-levels held by the texture. They will appear below the main
2166 // gl/textures/client_X/texture_Y dump. 2166 // gl/textures/client_X/texture_Y dump.
2167 ref->texture()->DumpLevelMemory(pmd, memory_tracker_->ClientTracingId(), 2167 ref->texture()->DumpLevelMemory(pmd, memory_tracker_->ClientTracingId(),
2168 dump_name); 2168 dump_name);
2169 } 2169 }
2170 2170
2171 } // namespace gles2 2171 } // namespace gles2
2172 } // namespace gpu 2172 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698