Allow glFramebufferTexture2D with level!=0 in ES2 tests with ES3
authorJames Glanville <james.glanville@imgtec.com>
Wed, 4 Jul 2018 09:59:44 +0000 (10:59 +0100)
committerTate Hornbeck <tateh@qti.qualcomm.com>
Tue, 7 Aug 2018 14:12:20 +0000 (10:12 -0400)
These ES2 tests were expecting GL errors when attaching non-zero
levels to a framebuffer where GL_OES_fbo_render_mipmap is not
supported. This functionality is core in ES3 contexts, so the tests
much assume support for mippmapped rendering in this case.

Affects:
dEQP-GLES2.functional.negative_api.buffer.framebuffer_texture2d
dEQP-GLES2.functional.fbo.api.texture_levels

Components:
dEQP

VK-GL-CTS issue: 1263

Change-Id: I3dc7c8f1f2cc7efb5c227a0aec11983b185be03c
(cherry picked from commit ccd2cb41bc3813de087747a7f173cd2c8d8180c2)

modules/gles2/functional/es2fFboApiTest.cpp
modules/gles2/functional/es2fNegativeBufferApiTests.cpp

index ec70f55..bd6a5c2 100644 (file)
@@ -638,8 +638,8 @@ void FboApiTestGroup::init (void)
 
        const glu::RenderContext& renderContext = m_context.getRenderContext();
        bool  defaultFboIsZero  = renderContext.getDefaultFramebuffer() == 0;
-       bool  hasRenderToMipmap = extensions.find("GL_OES_fbo_render_mipmap") != extensions.end();
        bool  isES3Compatible   = gls::FboUtil::checkExtensionSupport(renderContext, "DEQP_gles3_core_compatible");
+       bool  hasRenderToMipmap = isES3Compatible || extensions.find("GL_OES_fbo_render_mipmap") != extensions.end();
 
        // Valid attachments
        addChild(new FboApiCase(m_context, "valid_tex2d_attachments",                                   "Valid 2D texture attachments",                                                 validTex2DAttachmentsTest));
index 4dfcb70..043903a 100644 (file)
@@ -340,7 +340,15 @@ void NegativeBufferApiTests::init (void)
                        expectError(GL_INVALID_ENUM);
                        m_log << TestLog::EndSection;
 
-                       if (!m_context.getContextInfo().isExtensionSupported("GL_OES_fbo_render_mipmap"))
+                       // Detect compatible GLES context by querying GL_MAJOR_VERSION.
+                       // This query does not exist on GLES2 so succeeding query implies GLES3+ context.
+                       bool isES3Compatible = false;
+                       glw::GLint majorVersion = 0;
+                       glGetIntegerv(GL_MAJOR_VERSION, &majorVersion);
+                       if (glGetError() == GL_NO_ERROR)
+                               isES3Compatible = true;
+
+                       if (!(m_context.getContextInfo().isExtensionSupported("GL_OES_fbo_render_mipmap") || isES3Compatible))
                        {
                                m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if level is not 0.");
                                glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex2D, 3);