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

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

Issue 10543125: gpu: Add support for GLX_EXT_texture_from_pixmap extension. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add kGLImplementationMockGL case to gl_image_android.cc. Created 8 years, 2 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
Index: gpu/command_buffer/service/texture_manager.cc
diff --git a/gpu/command_buffer/service/texture_manager.cc b/gpu/command_buffer/service/texture_manager.cc
index 7c378d405ee0b4473d91b8beb3bc49eb8a7eaf9c..320628179908c16ae28cd538c059e65644573ef5 100644
--- a/gpu/command_buffer/service/texture_manager.cc
+++ b/gpu/command_buffer/service/texture_manager.cc
@@ -150,9 +150,13 @@ TextureManager::TextureInfo::LevelInfo::LevelInfo(const LevelInfo& rhs)
border(rhs.border),
format(rhs.format),
type(rhs.type),
+ image(rhs.image),
estimated_size(rhs.estimated_size) {
}
+TextureManager::TextureInfo::LevelInfo::~LevelInfo() {
+}
+
bool TextureManager::TextureInfo::CanRender(
const FeatureInfo* feature_info) const {
if (target_ == 0) {
@@ -252,7 +256,8 @@ bool TextureManager::TextureInfo::CanGenerateMipmaps(
(info.internal_format != first.internal_format) ||
(info.type != first.type) ||
feature_info->validators()->compressed_texture_format.IsValid(
- info.internal_format)) {
+ info.internal_format) ||
+ info.image) {
return false;
}
}
@@ -327,6 +332,7 @@ void TextureManager::TextureInfo::SetLevelInfo(
info.border = border;
info.format = format;
info.type = type;
+ info.image = 0;
estimated_size_ -= info.estimated_size;
GLES2Util::ComputeImageDataSizes(
@@ -616,6 +622,36 @@ bool TextureManager::TextureInfo::ClearLevel(
return info.cleared;
}
+void TextureManager::TextureInfo::SetLevelImage(
+ const FeatureInfo* feature_info,
+ GLenum target,
+ GLint level,
+ gfx::GLImage* image) {
+ DCHECK_GE(level, 0);
+ DCHECK_LT(static_cast<size_t>(GLTargetToFaceIndex(target)),
+ level_infos_.size());
+ DCHECK_LT(static_cast<size_t>(level),
+ level_infos_[GLTargetToFaceIndex(target)].size());
+ TextureInfo::LevelInfo& info =
+ level_infos_[GLTargetToFaceIndex(target)][level];
+ DCHECK_EQ(info.target, target);
+ DCHECK_EQ(info.level, level);
+ info.image = image;
+}
+
+gfx::GLImage* TextureManager::TextureInfo::GetLevelImage(
+ GLint face, GLint level) const {
+ size_t face_index = GLTargetToFaceIndex(face);
+ if (level >= 0 && face_index < level_infos_.size() &&
+ static_cast<size_t>(level) < level_infos_[face_index].size()) {
+ const LevelInfo& info = level_infos_[GLTargetToFaceIndex(face)][level];
+ if (info.target != 0) {
+ return info.image;
+ }
+ }
+ return 0;
+}
+
TextureManager::TextureManager(
MemoryTracker* memory_tracker,
FeatureInfo* feature_info,
@@ -1070,5 +1106,28 @@ GLsizei TextureManager::ComputeMipMapCount(
return 1 + base::bits::Log2Floor(std::max(std::max(width, height), depth));
}
+void TextureManager::SetLevelImage(
+ TextureManager::TextureInfo* info,
+ GLenum target,
+ GLint level,
+ gfx::GLImage* image) {
+ DCHECK(info);
+ if (!info->CanRender(feature_info_)) {
+ DCHECK_NE(0, num_unrenderable_textures_);
+ --num_unrenderable_textures_;
+ }
+ if (!info->SafeToRenderFrom()) {
+ DCHECK_NE(0, num_unsafe_textures_);
+ --num_unsafe_textures_;
+ }
+ info->SetLevelImage(feature_info_, target, level, image);
+ if (!info->CanRender(feature_info_)) {
+ ++num_unrenderable_textures_;
+ }
+ if (!info->SafeToRenderFrom()) {
+ ++num_unsafe_textures_;
+ }
+}
+
} // namespace gles2
} // namespace gpu
« no previous file with comments | « gpu/command_buffer/service/texture_manager.h ('k') | gpu/command_buffer/service/texture_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698