Check the bits of channel when calling glCopyTexImage2D
authorYabin Zheng <yabin.zheng@arm.com>
Mon, 13 Aug 2018 09:25:29 +0000 (17:25 +0800)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Wed, 5 Sep 2018 07:38:13 +0000 (03:38 -0400)
This test copies some data from render target to a texture by
glCopyTexImage2D command. According to the GLES3.2 spec, "An
INVALID_OPERATION error is generated if the component sizes of
internalformat do not exactly match the corresponding component sizes of
the source buffer's effective internal format." when executing the
glCopyTexImage2D command.

Because GLES3.2 spec does not force GL_RGB10 to be a renderable format,
so in a test case, if GL_RGB10 isn't renderable, then the render target
format will be GL_RGBA8, but the texture format is GL_RGB10. So this
behavior conflicts with the spec.

I think we can check the status whether the component sizes of format
will match before calling glCopyTexImage2D.

If the GL_RGB10 is renderable by some companies, then it will call the
gl.copyTexImage2D command directly(skip the checking logical because of
completed FBO). If GL_RGB10 isn't renderable by other companies, then it
will check the corresponding component sizes of buffer between source
and dest(because of incompleted FBO).

Components: OpenGL

VK-GL-CTS issue: 1307

Affects: KHR-GLES2.core.internalformat.copy_tex_image.*

Change-Id: I91e6b6674506f2709f97796a541e203bd052030b

external/openglcts/modules/common/glcInternalformatTests.cpp

index f8c6c9d..88746f1 100644 (file)
@@ -882,6 +882,20 @@ tcu::TestNode::IterateResult CopyTexImageCase::iterate(void)
                gl.deleteFramebuffers(1, &copyFboId);
                if (copyFboColorTextureId)
                        gl.deleteTextures(1, &copyFboColorTextureId);
+               // Check the bits of each channel first, because according the GLES3.2 spec, the component sizes of internalformat
+               // must exactly match the corresponding component sizes of the source buffer's effective internal format.
+               if (glu::isContextTypeES(renderContext.getType()) && getTypeFromInternalFormat(textureInternalFormat) != GL_UNSIGNED_BYTE)
+               {
+                       m_testCtx.getLog() << tcu::TestLog::Message << "Not supported: The component sizes of internalformat do not exactly "
+                       << "match the corresponding component sizes of the source buffer's effective internal format." << tcu::TestLog::EndMessage;
+                       m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "The test format isn't renderable, and the component sizes of "
+                       "internalformat do not exactly match the corresponding component sizes of the source buffer's effective internal format.");
+                       gl.deleteFramebuffers(1, &mainFboId);
+                       gl.deleteTextures(1, &mainFboColorTextureId);
+                       gl.deleteTextures(1, &copiedTextureId);
+                       gl.deleteTextures(1, &referenceTextureId);
+                       return STOP;
+               }
        }
 
        // Copy attachment from copy FBO to tested texture (if copy FBO couldn't be created