Support GL 4.5 in the sRGB skip decode tests
authorAlexander Galazin <alexander.galazin@arm.com>
Fri, 5 Feb 2021 10:32:07 +0000 (11:32 +0100)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Sat, 6 Mar 2021 09:58:28 +0000 (09:58 +0000)
Components: AOSP

Affects:
dEQP-GLES31.functional.srgb_texture_decode.skip_decode.*
dEQP-GL45.functional.srgb_texture_decode.skip_decode.*

Change-Id: Ica1dcf5ddf61b104f749b10c84501cc2182768f7

modules/gles31/functional/es31fSRGBDecodeTests.cpp

index 9a6cdf4..6eb22a4 100644 (file)
@@ -618,7 +618,8 @@ SRGBTestProgram::SRGBTestProgram    (Context& context, const FragmentShaderParamete
        const int                               totalShaderStages       = 2;
 
        // default vertex shader used in all tests
-       m_shaderVertex =        "#version 310 es \n"
+       std::string ver(glu::isContextTypeGLCore(m_context.getRenderContext().getType()) ? "#version 450\n" : "#version 310 es\n");
+       m_shaderVertex =        ver +
                                                "layout (location = 0) in mediump vec3 aPosition; \n"
                                                "layout (location = 1) in mediump vec2 aTexCoord; \n"
                                                "out mediump vec2 vs_aTexCoord; \n"
@@ -789,7 +790,7 @@ void SRGBTestProgram::genFragmentShader (void)
        // fragment shader cannot contain more outputs than the number of texture uniforms
        DE_ASSERT( !(static_cast<int>(m_shaderFragmentParameters.outputTotal) > static_cast<int>(m_shaderFragmentParameters.uniformTotal)) ) ;
 
-       source << "#version 310 es \n"
+       source << (glu::isContextTypeGLCore(m_context.getRenderContext().getType()) ? "#version 450\n" : "#version 310 es\n")
                << "in mediump vec2 vs_aTexCoord; \n";
 
        for (int output = 0; output < m_shaderFragmentParameters.outputTotal; output++)
@@ -945,6 +946,8 @@ SRGBTestCase::~SRGBTestCase (void)
 
 void SRGBTestCase::init (void)
 {
+       const glw::Functions& gl = m_context.getRenderContext().getFunctions();
+
        // extension requirements for test
        if ( (glu::getInternalFormat(m_internalFormat) == GL_SRGB8_ALPHA8) && !m_context.getContextInfo().isExtensionSupported("GL_EXT_texture_sRGB_decode") )
        {
@@ -957,6 +960,11 @@ void SRGBTestCase::init (void)
        }
 
        m_framebuffer = de::MovePtr<glu::Framebuffer>(new glu::Framebuffer(m_context.getRenderContext()));
+
+       if (glu::isContextTypeGLCore(m_context.getRenderContext().getType()))
+       {
+               gl.enable(GL_FRAMEBUFFER_SRGB);
+       }
 }
 
 void SRGBTestCase::deinit (void)
@@ -971,6 +979,11 @@ void SRGBTestCase::deinit (void)
        }
        m_renderBufferList.clear();
 
+       if (glu::isContextTypeGLCore(m_context.getRenderContext().getType()))
+       {
+               gl.disable(GL_FRAMEBUFFER_SRGB);
+       }
+
        for (std::size_t textureSourceIdx = 0; textureSourceIdx < m_textureSourceList.size(); textureSourceIdx++)
        {
                delete m_textureSourceList[textureSourceIdx];