Commit 05bcbe6b by Alexis Hetu Committed by Alexis Hétu

glGenerateMipmap validation

- Added *ALPHA8*/*LUMINANCE8* formats and *_SNORM formats to non color renderable formats - Added a new function IsMipMappable in order to allow mipmapping of the *ALPHA8*/*LUMINANCE8* formats Fixes all (24) failures in: dEQP-GLES3.functional.texture.mipmap.2d.generate* dEQP-GLES3.functional.texture.mipmap.cube.generate* Also fixes WebGL test: conformance/textures/misc/texture-npot.html Change-Id: I5f3210094fbc5b2e5bae25c88a5ef4f1ffb69cbd Reviewed-on: https://swiftshader-review.googlesource.com/14130Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 05878213
...@@ -2306,8 +2306,7 @@ void GenerateMipmap(GLenum target) ...@@ -2306,8 +2306,7 @@ void GenerateMipmap(GLenum target)
return error(GL_INVALID_OPERATION); return error(GL_INVALID_OPERATION);
} }
if(!IsColorRenderable(texture->getFormat(target, 0), clientVersion, true) || if(!IsMipmappable(texture->getFormat(target, 0), texture->getInternalFormat(target, 0), clientVersion))
sw::Surface::isNonNormalizedInteger(texture->getInternalFormat(target, 0)))
{ {
return error(GL_INVALID_OPERATION); return error(GL_INVALID_OPERATION);
} }
......
...@@ -1126,6 +1126,13 @@ namespace es2 ...@@ -1126,6 +1126,13 @@ namespace es2
case GL_RGBA32UI: case GL_RGBA32UI:
case GL_R11F_G11F_B10F: case GL_R11F_G11F_B10F:
return clientVersion >= 3; return clientVersion >= 3;
case GL_R8_SNORM:
case GL_RG8_SNORM:
case GL_RGB8_SNORM:
case GL_RGBA8_SNORM:
case GL_ALPHA8_EXT:
case GL_LUMINANCE8_EXT:
case GL_LUMINANCE8_ALPHA8_EXT:
case GL_DEPTH_COMPONENT24: case GL_DEPTH_COMPONENT24:
case GL_DEPTH_COMPONENT32_OES: case GL_DEPTH_COMPONENT32_OES:
case GL_DEPTH_COMPONENT32F: case GL_DEPTH_COMPONENT32F:
...@@ -1141,6 +1148,24 @@ namespace es2 ...@@ -1141,6 +1148,24 @@ namespace es2
return false; return false;
} }
bool IsMipmappable(GLenum internalformat, sw::Format internalFormat, GLint clientVersion)
{
if(sw::Surface::isNonNormalizedInteger(internalFormat))
{
return false;
}
switch(internalformat)
{
case GL_ALPHA8_EXT:
case GL_LUMINANCE8_EXT:
case GL_LUMINANCE8_ALPHA8_EXT:
return true;
default:
return IsColorRenderable(internalformat, clientVersion, true);
}
}
bool IsDepthRenderable(GLenum internalformat, GLint clientVersion) bool IsDepthRenderable(GLenum internalformat, GLint clientVersion)
{ {
switch(internalformat) switch(internalformat)
......
...@@ -57,6 +57,7 @@ namespace es2 ...@@ -57,6 +57,7 @@ namespace es2
GLsizei GetTypeSize(GLenum type); GLsizei GetTypeSize(GLenum type);
bool IsColorRenderable(GLenum internalformat, GLint clientVersion, bool isTexture); bool IsColorRenderable(GLenum internalformat, GLint clientVersion, bool isTexture);
bool IsMipmappable(GLenum format, sw::Format internalFormat, GLint clientVersion);
bool IsDepthRenderable(GLenum internalformat, GLint clientVersion); bool IsDepthRenderable(GLenum internalformat, GLint clientVersion);
bool IsStencilRenderable(GLenum internalformat, GLint clientVersion); bool IsStencilRenderable(GLenum internalformat, GLint clientVersion);
......
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