Fix texture_size_promotion snorm/RGB10_A2UI issue
authorJeannot Breton <jbreton@nvidia.com>
Tue, 2 May 2017 19:41:55 +0000 (14:41 -0500)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 12 May 2017 15:46:48 +0000 (11:46 -0400)
Read color clamping was not considered in the snorm expected value,
so the change clamp the expected value

The alpha component in RGB10_A2UI didn't have enough bits to hold
an expected value of 4. So we change the expected alpha value to 1

Affects:

KHR-GL45.texture_size_promotion.functional

Components: OpenGL

VK-GL-CTS issue: 395

Change-Id: I920eb187e558faf9557f886be0269ea0c927918b

external/openglcts/modules/gl/gl3cTextureSizePromotion.cpp

index 569b958..1ead7fc 100644 (file)
@@ -870,9 +870,10 @@ bool FunctionalTest::checkDestinationTexture(TextureInternalFormatDescriptor des
                        GLU_EXPECT_NO_ERROR(gl.getError(), "glReadPixels have failed");
 
                        /* Setup expected value. */
+                       /* Signed fixed-point read color are clamped to [0, 1] by default */
                        glw::GLfloat expected_value = isChannelTypeNone(descriptor, channel) ?
                                                                                          ((channel == ALPHA_COMPONENT) ? 1.f : 0.f) :
-                                                                                         s_source_texture_data_sn[channel];
+                                                                                         deFloatClamp(s_source_texture_data_sn[channel], 0, 1);
 
                        /* Compare expected and fetched values. */
                        if (fabs(pixel - expected_value) <= getMinPrecision(descriptor, channel))
@@ -1157,7 +1158,7 @@ const glw::GLfloat FunctionalTest::s_source_texture_data_sn[] = { -0.125f, 0.25f
 
 const glw::GLint FunctionalTest::s_source_texture_data_i[] = { -1, 2, -3, 4 };
 
-const glw::GLuint FunctionalTest::s_source_texture_data_ui[] = { 1, 2, 3, 4 };
+const glw::GLuint FunctionalTest::s_source_texture_data_ui[] = { 4, 3, 2, 1 };
 
 const glw::GLfloat FunctionalTest::s_destination_texture_data_f[] = {
        5.f