From 05c93d5ee9b4d9d898b639d2fad07d412f0882f1 Mon Sep 17 00:00:00 2001 From: James Glanville Date: Wed, 4 Jul 2018 10:59:44 +0100 Subject: [PATCH] Allow glFramebufferTexture2D with level!=0 in ES2 tests with ES3 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 | 2 +- modules/gles2/functional/es2fNegativeBufferApiTests.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/gles2/functional/es2fFboApiTest.cpp b/modules/gles2/functional/es2fFboApiTest.cpp index ec70f55..bd6a5c2 100644 --- a/modules/gles2/functional/es2fFboApiTest.cpp +++ b/modules/gles2/functional/es2fFboApiTest.cpp @@ -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)); diff --git a/modules/gles2/functional/es2fNegativeBufferApiTests.cpp b/modules/gles2/functional/es2fNegativeBufferApiTests.cpp index 4dfcb70..043903a 100644 --- a/modules/gles2/functional/es2fNegativeBufferApiTests.cpp +++ b/modules/gles2/functional/es2fNegativeBufferApiTests.cpp @@ -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); -- 2.7.4