Commit 5fc1e751 by Nicolas Capens Committed by Nicolas Capens

Validate cube completeness for mipmap generation.

The OpenGL ES 3.0.5 spec section 3.8.10.5 states: "For cube map textures an INVALID_OPERATION error is generated if the texture bound to target is not cube complete". Change-Id: I4304ecf125528b9406a011a95d7822b1f868ee14 Reviewed-on: https://swiftshader-review.googlesource.com/15328Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 0e92ccaa
...@@ -242,11 +242,12 @@ public: ...@@ -242,11 +242,12 @@ public:
egl::Image *getImage(int face, unsigned int level); egl::Image *getImage(int face, unsigned int level);
bool isCubeComplete() const;
protected: protected:
~TextureCubeMap() override; ~TextureCubeMap() override;
private: private:
bool isCubeComplete() const;
bool isMipmapCubeComplete() const; bool isMipmapCubeComplete() const;
// face is one of the GL_TEXTURE_CUBE_MAP_* enumerants. Returns nullptr on failure. // face is one of the GL_TEXTURE_CUBE_MAP_* enumerants. Returns nullptr on failure.
......
...@@ -2261,7 +2261,15 @@ void GenerateMipmap(GLenum target) ...@@ -2261,7 +2261,15 @@ void GenerateMipmap(GLenum target)
texture = context->getTexture2D(); texture = context->getTexture2D();
break; break;
case GL_TEXTURE_CUBE_MAP: case GL_TEXTURE_CUBE_MAP:
texture = context->getTextureCubeMap(); {
TextureCubeMap *cube = context->getTextureCubeMap();
texture = cube;
if(!cube->isCubeComplete())
{
return error(GL_INVALID_OPERATION);
}
}
break; break;
case GL_TEXTURE_2D_ARRAY: case GL_TEXTURE_2D_ARRAY:
if(clientVersion < 3) if(clientVersion < 3)
......
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