Fix ES2 rbo clear tests for RGB5_A1
authorPiotr Byszewski <piotr.byszewski@mobica.com>
Fri, 19 Jan 2018 14:15:07 +0000 (15:15 +0100)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Mon, 5 Feb 2018 08:23:10 +0000 (03:23 -0500)
color_clear and stencil_clear tests for GL_RGB5_A1 format
should not perform validation for alpha channel as
test thresholds for this channel do not account for dithering.

Components: OpenGL

VK-GL-CTS issue: 348

Affects:
dEQP-GLES2.functional.fbo.render.color_clear.*
dEQP-GLES2.functional.fbo.render.stencil_clear.*

Change-Id: I72fb6ec98dacfe9b2ad8178d0a01f7bb0bee01fc

modules/gles2/functional/es2fFboRenderTest.cpp

index c517d68..0007801 100644 (file)
@@ -714,6 +714,16 @@ void ColorClearsTest::render (sglr::Context& context, Surface& dst)
        }
        else
        {
+               // clear alpha channel for GL_RGB5_A1 format because test
+               // thresholds for the alpha channel do not account for dithering
+               if(getConfig().colorbufferFormat == GL_RGB5_A1)
+               {
+                       context.colorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
+                       context.clearColor(0.0f, 0.0f, 0.0f, 1.0f);
+                       context.clear(GL_COLOR_BUFFER_BIT);
+                       context.colorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+               }
+
                // Read from fbo
                context.readPixels(dst, 0, 0, width, height);
        }
@@ -1058,7 +1068,19 @@ void StencilClearsTest::render (sglr::Context& context, Surface& dst)
                context.readPixels(dst, 0, 0, context.getWidth(), context.getHeight());
        }
        else
+       {
+               // clear alpha channel for GL_RGB5_A1 format because test
+               // thresholds for the alpha channel do not account for dithering
+               if(getConfig().colorbufferFormat == GL_RGB5_A1)
+               {
+                       context.colorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
+                       context.clearColor(0.0f, 0.0f, 0.0f, 1.0f);
+                       context.clear(GL_COLOR_BUFFER_BIT);
+                       context.colorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+               }
+
                context.readPixels(dst, 0, 0, width, height);
+       }
 }
 
 bool StencilClearsTest::isConfigSupported (const FboConfig& config)