Detects a bug where ReadPixels fails on multisampled textures.
See http://crbug.com/890002
Cherry pick from:
https://android-review.googlesource.com/c/platform/external/deqp/+/796566
Components: OpenGL
New test:
dEQP-GLES2.functional.multisampled_render_to_texture.readpixels
Bug: chromium:890002
Change-Id: I6e5e5d1fa3aa15daee69271339962a0b3ffc1927
modules/gles2/functional/es2fLifetimeTests.cpp \
modules/gles2/functional/es2fLightAmountTest.cpp \
modules/gles2/functional/es2fMultisampleTests.cpp \
+ modules/gles2/functional/es2fMultisampledRenderToTextureTests.cpp \
modules/gles2/functional/es2fNegativeBufferApiTests.cpp \
modules/gles2/functional/es2fNegativeFragmentApiTests.cpp \
modules/gles2/functional/es2fNegativeShaderApiTests.cpp \
+dEQP-GLES2.functional.multisampled_render_to_texture.readpixels
dEQP-GLES2.functional.shaders.indexing.tmp_array.float_const_write_static_read_vertex
dEQP-GLES2.functional.shaders.indexing.tmp_array.float_const_write_static_read_fragment
dEQP-GLES2.functional.shaders.indexing.tmp_array.float_const_write_dynamic_read_vertex
dEQP-GLES2.functional.light_amount.12omni
dEQP-GLES2.functional.light_amount.14omni
dEQP-GLES2.functional.light_amount.16omni
+dEQP-GLES2.functional.multisampled_render_to_texture.readpixels
dEQP-GLES2.functional.shaders.preprocessor.basic.correct_phases_vertex
dEQP-GLES2.functional.shaders.preprocessor.basic.correct_phases_fragment
dEQP-GLES2.functional.shaders.preprocessor.basic.invalid_identifier_vertex
dEQP-GLES2.functional.light_amount.12omni
dEQP-GLES2.functional.light_amount.14omni
dEQP-GLES2.functional.light_amount.16omni
+dEQP-GLES2.functional.multisampled_render_to_texture.readpixels
dEQP-GLES2.functional.shaders.preprocessor.basic.correct_phases_vertex
dEQP-GLES2.functional.shaders.preprocessor.basic.correct_phases_fragment
dEQP-GLES2.functional.shaders.preprocessor.basic.invalid_identifier_vertex
dEQP-GLES2.functional.light_amount.12omni
dEQP-GLES2.functional.light_amount.14omni
dEQP-GLES2.functional.light_amount.16omni
+dEQP-GLES2.functional.multisampled_render_to_texture.readpixels
dEQP-GLES2.functional.shaders.preprocessor.basic.correct_phases_vertex
dEQP-GLES2.functional.shaders.preprocessor.basic.correct_phases_fragment
dEQP-GLES2.functional.shaders.preprocessor.basic.invalid_identifier_vertex
dEQP-GLES2.functional.light_amount.12omni
dEQP-GLES2.functional.light_amount.14omni
dEQP-GLES2.functional.light_amount.16omni
+dEQP-GLES2.functional.multisampled_render_to_texture.readpixels
dEQP-GLES2.functional.shaders.preprocessor.basic.correct_phases_vertex
dEQP-GLES2.functional.shaders.preprocessor.basic.correct_phases_fragment
dEQP-GLES2.functional.shaders.preprocessor.basic.invalid_identifier_vertex
es2fLifetimeTests.hpp
es2fLightAmountTest.cpp
es2fLightAmountTest.hpp
+ es2fMultisampledRenderToTextureTests.cpp
+ es2fMultisampledRenderToTextureTests.hpp
es2fNegativeBufferApiTests.cpp
es2fNegativeBufferApiTests.hpp
es2fNegativeFragmentApiTests.cpp
#include "es2fColorClearTest.hpp"
#include "es2fLightAmountTest.hpp"
+#include "es2fMultisampledRenderToTextureTests.hpp"
#include "es2fShaderExecuteTest.hpp"
#include "es2fFboApiTest.hpp"
#include "es2fFboRenderTest.hpp"
void FunctionalTests::init (void)
{
- addChild(new PrerequisiteTests (m_context));
- addChild(new ImplementationLimitTests (m_context));
- addChild(new ClipControlTests (m_context));
- addChild(new ColorClearTest (m_context));
- addChild(new DepthStencilClearTests (m_context));
- addChild(new BufferTests (m_context));
- addChild(new LightAmountTest (m_context));
- addChild(new ShadersTestGroup (m_context));
- addChild(new TextureTestGroup (m_context));
- addChild(new FragmentOpTests (m_context));
- addChild(new FboTestGroup (m_context));
- addChild(new VertexArrayTestGroup (m_context));
- addChild(new ShaderApiTests (m_context));
- addChild(new NegativeApiTestGroup (m_context));
- addChild(new RasterizationTests (m_context));
- addChild(createAttributeLocationTests (m_context));
- addChild(new MultisampleTests (m_context));
- addChild(new UniformApiTests (m_context));
- addChild(new ReadPixelsTests (m_context));
- addChild(new DepthRangeTests (m_context));
- addChild(new DitheringTests (m_context));
- addChild(new StateQueryTests (m_context));
- addChild(new ClippingTests (m_context));
- addChild(new PolygonOffsetTests (m_context));
- addChild(new DrawTests (m_context));
- addChild(new FlushFinishTests (m_context));
- addChild(new DefaultVertexAttributeTests(m_context));
- addChild(createLifetimeTests (m_context));
- addChild(createDebugMarkerTests (m_context));
+ addChild(new PrerequisiteTests (m_context));
+ addChild(new ImplementationLimitTests (m_context));
+ addChild(new ClipControlTests (m_context));
+ addChild(new ColorClearTest (m_context));
+ addChild(new DepthStencilClearTests (m_context));
+ addChild(new BufferTests (m_context));
+ addChild(new LightAmountTest (m_context));
+ addChild(new MultisampledRenderToTextureTests (m_context));
+ addChild(new ShadersTestGroup (m_context));
+ addChild(new TextureTestGroup (m_context));
+ addChild(new FragmentOpTests (m_context));
+ addChild(new FboTestGroup (m_context));
+ addChild(new VertexArrayTestGroup (m_context));
+ addChild(new ShaderApiTests (m_context));
+ addChild(new NegativeApiTestGroup (m_context));
+ addChild(new RasterizationTests (m_context));
+ addChild(createAttributeLocationTests (m_context));
+ addChild(new MultisampleTests (m_context));
+ addChild(new UniformApiTests (m_context));
+ addChild(new ReadPixelsTests (m_context));
+ addChild(new DepthRangeTests (m_context));
+ addChild(new DitheringTests (m_context));
+ addChild(new StateQueryTests (m_context));
+ addChild(new ClippingTests (m_context));
+ addChild(new PolygonOffsetTests (m_context));
+ addChild(new DrawTests (m_context));
+ addChild(new FlushFinishTests (m_context));
+ addChild(new DefaultVertexAttributeTests (m_context));
+ addChild(createLifetimeTests (m_context));
+ addChild(createDebugMarkerTests (m_context));
}
} // Functional
--- /dev/null
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program OpenGL ES 2.0 Module
+ * -------------------------------------------------
+ *
+ * Copyright 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */ /*!
+ * \file
+ * \brief GL_EXT_multisample_render_to_texture tests.
+ */ /*--------------------------------------------------------------------*/
+
+#include "es2fMultisampledRenderToTextureTests.hpp"
+
+#include "deString.h"
+#include "deStringUtil.hpp"
+#include "gluContextInfo.hpp"
+#include "gluPixelTransfer.hpp"
+#include "gluShaderProgram.hpp"
+#include "glw.h"
+#include "glwEnums.hpp"
+#include "glwFunctions.hpp"
+#include "tcuRenderTarget.hpp"
+#include "tcuSurface.hpp"
+#include "tcuTestLog.hpp"
+#include "tcuVector.hpp"
+
+using tcu::TestLog;
+using tcu::Vec4;
+
+namespace deqp
+{
+namespace gles2
+{
+namespace Functional
+{
+
+class MultisampledRenderToTextureReadPixelsCase : public TestCase
+{
+public:
+ MultisampledRenderToTextureReadPixelsCase(Context& context, const char* name, const char* description);
+ ~MultisampledRenderToTextureReadPixelsCase();
+ void init();
+ IterateResult iterate();
+
+private:
+ MultisampledRenderToTextureReadPixelsCase(const MultisampledRenderToTextureReadPixelsCase& other);
+ MultisampledRenderToTextureReadPixelsCase& operator=(const MultisampledRenderToTextureReadPixelsCase& other);
+};
+
+MultisampledRenderToTextureReadPixelsCase::MultisampledRenderToTextureReadPixelsCase(Context& context, const char* name, const char* description)
+ : TestCase(context, name, description)
+{
+}
+
+MultisampledRenderToTextureReadPixelsCase::~MultisampledRenderToTextureReadPixelsCase()
+{
+}
+
+void MultisampledRenderToTextureReadPixelsCase::init()
+{
+ const glu::ContextInfo& contextInfo = m_context.getContextInfo();
+ if (!contextInfo.isExtensionSupported("GL_EXT_multisampled_render_to_texture"))
+ {
+ TCU_THROW(NotSupportedError, "EXT_multisampled_render_to_texture is not supported");
+ }
+}
+
+MultisampledRenderToTextureReadPixelsCase::IterateResult MultisampledRenderToTextureReadPixelsCase::iterate()
+{
+ // Test for a bug where ReadPixels fails on multisampled textures.
+ // See http://crbug.com/890002
+ // Note that this does not test whether multisampling is working properly,
+ // only that ReadPixels is able to read from the texture.
+ const glw::Functions& gl = m_context.getRenderContext().getFunctions();
+ // Create a framebuffer with a multisampled texture and a depth-stencil
+ // renderbuffer.
+ GLuint framebuffer = 0;
+ GLuint texture = 0;
+ gl.genFramebuffers(1, &framebuffer);
+ gl.genTextures(1, &texture);
+ gl.bindFramebuffer(GL_FRAMEBUFFER, framebuffer);
+ gl.bindTexture(GL_TEXTURE_2D, texture);
+ gl.texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ GLint max_samples = 0;
+ gl.getIntegerv(GL_MAX_SAMPLES_EXT, &max_samples);
+ gl.framebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0, max_samples);
+ GLuint depthStencil = 0;
+ gl.genRenderbuffers(1, &depthStencil);
+ gl.bindRenderbuffer(GL_RENDERBUFFER, depthStencil);
+ gl.renderbufferStorageMultisampleEXT(GL_RENDERBUFFER, max_samples, GL_DEPTH24_STENCIL8, 1, 1);
+ gl.framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthStencil);
+ gl.framebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, depthStencil);
+ if (gl.checkFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
+ TCU_THROW(NotSupportedError, "Framebuffer format not supported.");
+ }
+ gl.clearColor(1, 0, 1, 0);
+ gl.clear(GL_COLOR_BUFFER_BIT);
+ GLU_EXPECT_NO_ERROR(gl.getError(), "init");
+
+ // ReadPixels should implicitly resolve the multisampled buffer.
+ GLubyte pixel[4] = { 0, 1, 0, 1 };
+ gl.readPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &pixel);
+ GLU_EXPECT_NO_ERROR(gl.getError(), "ReadPixels");
+
+ if (pixel[0] != 255 || pixel[1] != 0 || pixel[2] != 255 || pixel[3] != 0)
+ {
+ std::ostringstream msg;
+ msg << "ReadPixels read incorrect values: [" << (int)pixel[0] << ", " << (int)pixel[1] << ", " << (int)pixel[2] << ", " << (int)pixel[3] << "]";
+ m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, msg.str().c_str());
+ }
+ else
+ {
+ m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
+ }
+
+ gl.bindFramebuffer(GL_FRAMEBUFFER, 0);
+ gl.bindTexture(GL_TEXTURE_2D, 0);
+ gl.bindRenderbuffer(GL_RENDERBUFFER, 0);
+ gl.deleteFramebuffers(1, &framebuffer);
+ gl.deleteRenderbuffers(1, &depthStencil);
+ gl.deleteTextures(1, &texture);
+ return STOP;
+}
+
+MultisampledRenderToTextureTests::MultisampledRenderToTextureTests(Context& context) : TestCaseGroup(context, "multisampled_render_to_texture", "EXT_multisampled_render_to_texture tests")
+{
+}
+
+MultisampledRenderToTextureTests::~MultisampledRenderToTextureTests()
+{
+}
+
+void MultisampledRenderToTextureTests::init()
+{
+ addChild(new MultisampledRenderToTextureReadPixelsCase(m_context, "readpixels", "Test ReadPixels with EXT_multisampled_render_to_texture"));
+}
+
+} // namespace Functional
+} // namespace gles2
+} // namespace deqp
--- /dev/null
+#ifndef _ES2FMULTISAMPLEDRENDERTOTEXTURETESTS_HPP
+#define _ES2FMULTISAMPLEDRENDERTOTEXTURETESTS_HPP
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program OpenGL ES 2.0 Module
+ * -------------------------------------------------
+ *
+ * Copyright 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */ /*!
+ * \file
+ * \brief GL_EXT_multisample_render_to_texture tests.
+*/ /*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "tes2TestCase.hpp"
+
+namespace deqp
+{
+namespace gles2
+{
+namespace Functional
+{
+
+class MultisampledRenderToTextureTests : public TestCaseGroup
+{
+public:
+ MultisampledRenderToTextureTests(Context& context);
+ ~MultisampledRenderToTextureTests();
+
+ void init();
+
+private:
+ MultisampledRenderToTextureTests(const MultisampledRenderToTextureTests& other);
+ MultisampledRenderToTextureTests& operator=(const MultisampledRenderToTextureTests& other);
+};
+
+} // namespace Functional
+} // namespace gles2
+} // namespace deqp
+
+#endif // _ES2FMULTISAMPLEDRENDERTOTEXTURETESTS_HPP