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() ...@@ -1810,6 +1810,8 @@ void Context::applyTextures()
if(texture && texture->isSamplerComplete()) if(texture && texture->isSamplerComplete())
{ {
texture->autoGenerateMipmaps();
GLenum wrapS = texture->getWrapS(); GLenum wrapS = texture->getWrapS();
GLenum wrapT = texture->getWrapT(); GLenum wrapT = texture->getWrapT();
GLenum texFilter = texture->getMinFilter(); GLenum texFilter = texture->getMinFilter();
......
...@@ -618,7 +618,7 @@ bool Texture2D::isSamplerComplete() const ...@@ -618,7 +618,7 @@ bool Texture2D::isSamplerComplete() const
if(isMipmapFiltered()) if(isMipmapFiltered())
{ {
if(!isMipmapComplete()) if(!generateMipmap && !isMipmapComplete())
{ {
return false; return false;
} }
...@@ -703,14 +703,17 @@ void Texture2D::generateMipmaps() ...@@ -703,14 +703,17 @@ void Texture2D::generateMipmaps()
} }
} }
egl::Image *Texture2D::getImage(unsigned int level) void Texture2D::autoGenerateMipmaps()
{ {
if(generateMipmap && image[0]->hasDirtyMipmaps()) if(generateMipmap && image[0]->hasDirtyMipmaps())
{ {
generateMipmaps(); generateMipmaps();
image[0]->cleanMipmaps(); image[0]->cleanMipmaps();
} }
}
egl::Image *Texture2D::getImage(unsigned int level)
{
return image[level]; return image[level];
} }
......
...@@ -95,6 +95,8 @@ public: ...@@ -95,6 +95,8 @@ public:
virtual bool isShared(GLenum target, unsigned int level) const = 0; virtual bool isShared(GLenum target, unsigned int level) const = 0;
virtual void generateMipmaps() = 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; virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source) = 0;
protected: protected:
...@@ -156,6 +158,7 @@ public: ...@@ -156,6 +158,7 @@ public:
virtual void releaseTexImage(); virtual void releaseTexImage();
virtual void generateMipmaps(); virtual void generateMipmaps();
virtual void autoGenerateMipmaps();
virtual Renderbuffer *getRenderbuffer(GLenum target); virtual Renderbuffer *getRenderbuffer(GLenum target);
virtual egl::Image *getRenderTarget(GLenum target, unsigned int level); 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