Avoids uploading levels other than 0 for incomplete textures.
TRAC #21815
Fixes compressed texture test assertion in WebGL top-of-tree conformance suite when running with debug build
Signed-off-by: Daniel Koch
Signed-off-by: Nicolas Capens
git-svn-id: http://angleproject.googlecode.com/svn/trunk@1323 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/common/version.h b/src/common/version.h
index fec98a1..c2c5956 100644
--- a/src/common/version.h
+++ b/src/common/version.h
@@ -1,7 +1,7 @@
#define MAJOR_VERSION 1
#define MINOR_VERSION 0
#define BUILD_VERSION 0
-#define BUILD_REVISION 1318
+#define BUILD_REVISION 1323
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
diff --git a/src/libGLESv2/Texture.cpp b/src/libGLESv2/Texture.cpp
index af430bf..2b96e8a 100644
--- a/src/libGLESv2/Texture.cpp
+++ b/src/libGLESv2/Texture.cpp
@@ -1476,6 +1476,23 @@
return mUsage;
}
+bool Texture::isMipmapFiltered() const
+{
+ switch (mMinFilter)
+ {
+ case GL_NEAREST:
+ case GL_LINEAR:
+ return false;
+ case GL_NEAREST_MIPMAP_NEAREST:
+ case GL_LINEAR_MIPMAP_NEAREST:
+ case GL_NEAREST_MIPMAP_LINEAR:
+ case GL_LINEAR_MIPMAP_LINEAR:
+ return true;
+ default: UNREACHABLE();
+ return false;
+ }
+}
+
void Texture::setImage(GLint unpackAlignment, const void *pixels, Image *image)
{
if (pixels != NULL)
@@ -2045,22 +2062,7 @@
return false;
}
- bool mipmapping = false;
-
- switch (mMinFilter)
- {
- case GL_NEAREST:
- case GL_LINEAR:
- mipmapping = false;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- case GL_LINEAR_MIPMAP_NEAREST:
- case GL_NEAREST_MIPMAP_LINEAR:
- case GL_LINEAR_MIPMAP_LINEAR:
- mipmapping = true;
- break;
- default: UNREACHABLE();
- }
+ bool mipmapping = isMipmapFiltered();
if ((IsFloat32Format(getInternalFormat(0)) && !getContext()->supportsFloat32LinearFilter()) ||
(IsFloat16Format(getInternalFormat(0)) && !getContext()->supportsFloat16LinearFilter()))
@@ -2187,7 +2189,9 @@
void Texture2D::updateTexture()
{
- int levels = levelCount();
+ bool mipmapping = (isMipmapFiltered() && isMipmapComplete());
+
+ int levels = (mipmapping ? levelCount() : 1);
for (int level = 0; level < levels; level++)
{
@@ -2598,24 +2602,7 @@
{
int size = mImageArray[0][0].getWidth();
- bool mipmapping;
-
- switch (mMinFilter)
- {
- case GL_NEAREST:
- case GL_LINEAR:
- mipmapping = false;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- case GL_LINEAR_MIPMAP_NEAREST:
- case GL_NEAREST_MIPMAP_LINEAR:
- case GL_LINEAR_MIPMAP_LINEAR:
- mipmapping = true;
- break;
- default:
- UNREACHABLE();
- return false;
- }
+ bool mipmapping = isMipmapFiltered();
if ((gl::ExtractType(getInternalFormat(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0)) == GL_FLOAT && !getContext()->supportsFloat32LinearFilter()) ||
(gl::ExtractType(getInternalFormat(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0) == GL_HALF_FLOAT_OES) && !getContext()->supportsFloat16LinearFilter()))
@@ -2752,9 +2739,12 @@
void TextureCubeMap::updateTexture()
{
+ bool mipmapping = isMipmapFiltered() && isMipmapCubeComplete();
+
for (int face = 0; face < 6; face++)
{
- int levels = levelCount();
+ int levels = (mipmapping ? levelCount() : 1);
+
for (int level = 0; level < levels; level++)
{
Image *image = &mImageArray[face][level];
diff --git a/src/libGLESv2/Texture.h b/src/libGLESv2/Texture.h
index 7d7378f..deb2d05 100644
--- a/src/libGLESv2/Texture.h
+++ b/src/libGLESv2/Texture.h
@@ -190,6 +190,7 @@
GLenum getWrapT() const;
float getMaxAnisotropy() const;
GLenum getUsage() const;
+ bool isMipmapFiltered() const;
virtual bool isSamplerComplete() const = 0;