Commit 680bcf50 by Nicolas Capens Committed by Alexis Hétu

Fix glCopyTexImage support for BGRA color buffers.

Neither GL_EXT_texture_format_BGRA8888 nor GL_APPLE_texture_format_BGRA8888 make mention of GL_BGRA_EXT or GL_BGRA8_EXT being accepted as the internalformat parameter of glCopyTexImage2D, but there's a reasonable assumption that textures with BGRA format can be used as the read color buffer. GL_EXT_texture_format_BGRA8888 does mention that the format is color-renderable, and GL_APPLE_texture_format_BGRA8888 adds it to table 3.2 (but fails to mention changes to table 3.16). Bug swiftshader:96 Change-Id: I6d18faeaded73164a2c6af87ae6109fc77825964 Reviewed-on: https://swiftshader-review.googlesource.com/17448Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 92593eb2
......@@ -920,7 +920,9 @@ void CopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x,
if(colorbufferFormat != GL_RGBA &&
colorbufferFormat != GL_RGBA4_OES &&
colorbufferFormat != GL_RGB5_A1_OES &&
colorbufferFormat != GL_RGBA8_OES)
colorbufferFormat != GL_RGBA8_OES &&
colorbufferFormat != GL_BGRA_EXT && // GL_EXT_texture_format_BGRA8888
colorbufferFormat != GL_BGRA8_EXT) // GL_EXT_texture_format_BGRA8888
{
return error(GL_INVALID_OPERATION);
}
......@@ -929,6 +931,7 @@ void CopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x,
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
return error(GL_INVALID_OPERATION);
case GL_BGRA_EXT: // GL_EXT_texture_format_BGRA8888 doesn't mention the format to be accepted by glCopyTexImage2D.
default:
return error(GL_INVALID_ENUM);
}
......
......@@ -623,7 +623,8 @@ namespace es2
break;
case GL_LUMINANCE_ALPHA:
case GL_RGBA:
if(baseColorbufferFormat != GL_RGBA)
if(baseColorbufferFormat != GL_RGBA &&
baseColorbufferFormat != GL_BGRA_EXT) // GL_EXT_texture_format_BGRA8888 / GL_APPLE_texture_format_BGRA8888
{
return error(GL_INVALID_OPERATION, false);
}
......@@ -656,6 +657,7 @@ namespace es2
case GL_DEPTH_COMPONENT:
case GL_DEPTH_STENCIL_OES:
return error(GL_INVALID_OPERATION, false);
case GL_BGRA_EXT: // GL_EXT_texture_format_BGRA8888 nor GL_APPLE_texture_format_BGRA8888 mention the format to be accepted by glCopyTexImage2D.
default:
return error(GL_INVALID_ENUM, false);
}
......
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