Commit 648c9683 by Jamie Madill

Minor optimizations to texture functions.

By shuffling some parameters and calls around we can reduce the number of function calls we run for texture operations. Change-Id: If6d14cb6dff668cdfcb2f1fe6705e0d488dbc03f Reviewed-on: https://chromium-review.googlesource.com/183582Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarShannon Woods <shannonwoods@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 3810bee3
...@@ -819,8 +819,10 @@ bool Texture2D::isLevelComplete(int level) const ...@@ -819,8 +819,10 @@ bool Texture2D::isLevelComplete(int level) const
return true; return true;
} }
GLsizei width = getBaseLevelWidth(); const rx::Image *baseImage = getBaseLevelImage();
GLsizei height = getBaseLevelHeight();
GLsizei width = baseImage->getWidth();
GLsizei height = baseImage->getHeight();
if (width <= 0 || height <= 0) if (width <= 0 || height <= 0)
{ {
...@@ -836,7 +838,7 @@ bool Texture2D::isLevelComplete(int level) const ...@@ -836,7 +838,7 @@ bool Texture2D::isLevelComplete(int level) const
ASSERT(level >= 1 && level <= (int)ArraySize(mImageArray) && mImageArray[level] != NULL); ASSERT(level >= 1 && level <= (int)ArraySize(mImageArray) && mImageArray[level] != NULL);
rx::Image *image = mImageArray[level]; rx::Image *image = mImageArray[level];
if (image->getInternalFormat() != getBaseLevelInternalFormat()) if (image->getInternalFormat() != baseImage->getInternalFormat())
{ {
return false; return false;
} }
...@@ -905,7 +907,7 @@ void Texture2D::updateStorage() ...@@ -905,7 +907,7 @@ void Texture2D::updateStorage()
{ {
for (int level = 0; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++) for (int level = 0; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
{ {
if (isLevelComplete(level)) if (mImageArray[level]->isDirty() && isLevelComplete(level))
{ {
updateStorageLevel(level); updateStorageLevel(level);
} }
......
...@@ -83,7 +83,7 @@ bool Image11::isDirty() const ...@@ -83,7 +83,7 @@ bool Image11::isDirty() const
{ {
// Make sure that this image is marked as dirty even if the staging texture hasn't been created yet // Make sure that this image is marked as dirty even if the staging texture hasn't been created yet
// if initialization is required before use. // if initialization is required before use.
return ((mStagingTexture || gl_d3d11::RequiresTextureDataInitialization(mInternalFormat)) && mDirty); return (mDirty && (mStagingTexture || gl_d3d11::RequiresTextureDataInitialization(mInternalFormat)));
} }
bool Image11::copyToStorage(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height) bool Image11::copyToStorage(TextureStorageInterface2D *storage, int level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment