From 656dcaad7854f685618c39647cb1eda818a86d43 Mon Sep 17 00:00:00 2001 From: "gman@chromium.org" Date: Fri, 7 May 2010 17:18:37 +0000 Subject: A few more changes for conformance tests. TEST=none BUG=none Review URL: http://codereview.chromium.org/1985006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46699 0039d316-1c4b-4281-b951-d872f2087c98 --- gpu/command_buffer/service/texture_manager.cc | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to '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 326d2b3..e854faf 100644 --- a/gpu/command_buffer/service/texture_manager.cc +++ b/gpu/command_buffer/service/texture_manager.cc @@ -199,9 +199,9 @@ void TextureManager::TextureInfo::Update() { npot_ = false; for (size_t ii = 0; ii < level_infos_.size(); ++ii) { const TextureInfo::LevelInfo& info = level_infos_[ii][0]; - if (((info.width & (info.width - 1)) != 0) || - ((info.height & (info.height - 1)) != 0) || - ((info.depth & (info.depth - 1)) != 0)) { + if (GLES2Util::IsNPOT(info.width) || + GLES2Util::IsNPOT(info.height) || + GLES2Util::IsNPOT(info.depth)) { npot_ = true; break; } @@ -277,6 +277,26 @@ TextureManager::TextureManager( } } +bool TextureManager::ValidForTarget( + GLenum target, GLint level, + GLsizei width, GLsizei height, GLsizei depth) { + GLsizei max_size = MaxSizeForTarget(target); + return level >= 0 && + width >= 0 && + height >= 0 && + depth >= 0 && + level < MaxLevelsForTarget(target) && + width <= max_size && + height <= max_size && + depth <= max_size && + (level == 0 || + (!GLES2Util::IsNPOT(width) && + !GLES2Util::IsNPOT(height) && + !GLES2Util::IsNPOT(depth))) && + (target != GL_TEXTURE_CUBE_MAP || (width == height && depth == 1)) && + (target != GL_TEXTURE_2D || (depth == 1)); +} + TextureManager::TextureInfo* TextureManager::CreateTextureInfo( GLuint client_id, GLuint service_id) { TextureInfo::Ref info(new TextureInfo(service_id)); -- cgit v1.1