Commit d6e2fb2b by Nicolas Capens

Fix auto generating mipmaps for incomplete textures.

Bug 21278131 Change-Id: I1969f40ab4cb5e475c9c0a4e5f7d4238a3deb7be Reviewed-on: https://swiftshader-review.googlesource.com/3220Tested-by: 's avatarNicolas Capens <capn@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Tested-by: 's avatarPing-Hao Wu <pinghao@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 80b651df
......@@ -1810,6 +1810,8 @@ void Context::applyTextures()
if(texture && texture->isSamplerComplete())
{
texture->autoGenerateMipmaps();
GLenum wrapS = texture->getWrapS();
GLenum wrapT = texture->getWrapT();
GLenum texFilter = texture->getMinFilter();
......
......@@ -618,7 +618,7 @@ bool Texture2D::isSamplerComplete() const
if(isMipmapFiltered())
{
if(!isMipmapComplete())
if(!generateMipmap && !isMipmapComplete())
{
return false;
}
......@@ -703,14 +703,17 @@ void Texture2D::generateMipmaps()
}
}
egl::Image *Texture2D::getImage(unsigned int level)
void Texture2D::autoGenerateMipmaps()
{
if(generateMipmap && image[0]->hasDirtyMipmaps())
{
generateMipmaps();
image[0]->cleanMipmaps();
}
}
egl::Image *Texture2D::getImage(unsigned int level)
{
return image[level];
}
......
......@@ -95,6 +95,8 @@ public:
virtual bool isShared(GLenum target, unsigned int level) const = 0;
virtual void generateMipmaps() = 0;
virtual void autoGenerateMipmaps() = 0;
virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source) = 0;
protected:
......@@ -156,6 +158,7 @@ public:
virtual void releaseTexImage();
virtual void generateMipmaps();
virtual void autoGenerateMipmaps();
virtual Renderbuffer *getRenderbuffer(GLenum target);
virtual egl::Image *getRenderTarget(GLenum target, unsigned int level);
......
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