Reject copying from GL_RGB10_A2 to unsized formats. glCopyTexImage2D() with an framebuffer format of GL_RGB10_A2 and internalformat of GL_LUMINANCE_ALPHA was hitting the UNIMPLEMENTED() assert. The spec states that: If an effective internal format exists that has * the same component sizes as, * component sizes greater than or equal to, or * component sizes smaller than or equal to those of the source buffer's effective internal format (for all matching components in <internalformat>), that format is chosen for the new image array and this is the effective internal format of the new texel array. There is no unorm luminance+alpha format that has all components either greater or smaller, so this operation is invalid. Also see https://www.khronos.org/members/login/bugzilla/show_bug.cgi?id=9807#c56 Bug chromium:853424 Change-Id: Ia79a50bf7411a3f2aa87cf7f9bdbcbf971bdd7ce Reviewed-on: https://swiftshader-review.googlesource.com/19768 Tested-by: Nicolas Capens <nicolascapens@google.com> Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/OpenGL/libGLESv2/libGLESv2.cpp b/src/OpenGL/libGLESv2/libGLESv2.cpp index 7ae8126..b7ae2c5 100644 --- a/src/OpenGL/libGLESv2/libGLESv2.cpp +++ b/src/OpenGL/libGLESv2/libGLESv2.cpp
@@ -930,6 +930,13 @@ // Determine the sized internal format. if(gl::IsUnsizedInternalFormat(internalformat)) { + if(colorbufferFormat == GL_RGB10_A2) + { + // Not supported with unsized internalformat. + // https://www.khronos.org/members/login/bugzilla/show_bug.cgi?id=9807#c56 + return error(GL_INVALID_OPERATION); + } + if(gl::GetBaseInternalFormat(colorbufferFormat) == internalformat) { internalformat = colorbufferFormat; @@ -959,6 +966,7 @@ } else { + printf("internalformat = %x, colorbufferFormat = %X\n", internalformat, colorbufferFormat); UNIMPLEMENTED(); return error(GL_INVALID_OPERATION);