Use glReadnPixels only if KHR_robustness is supported
authorAlexander Galazin <alexander.galazin@arm.com>
Thu, 23 Feb 2017 12:01:18 +0000 (13:01 +0100)
committerPyry Haulos <phaulos@google.com>
Fri, 10 Mar 2017 16:48:14 +0000 (16:48 +0000)
glReadnPixels is introduced in KHR_robustness/GLES 3.2.
Use of this function in GLES 3.1 tests will result in segfault
on implementations that don't support KHR_robustness.

Components: AOSP, Framework

Affects: dEQP-GLES31.functional.debug.negative_coverage.callbacks.buffer.read_pixels_format_mismatch

VK-GL-CTS issue: 166
Google bug: 36122027

Change-Id: Idbe8734f7d82882ea99c75a8b74d693ac6dd831f
(cherry picked from commit 219019495770c221e92f43df3e76a954c613210d)

framework/opengl/wrapper/glwInitExtES.inl
modules/gles31/functional/es31fNegativeBufferApiTests.cpp
scripts/opengl/src_util.py

index 75a3385..5e8005b 100644 (file)
@@ -34,6 +34,14 @@ if (de::contains(extSet, "GL_EXT_geometry_shader"))
        gl->framebufferTexture  = (glFramebufferTextureFunc)    loader->get("glFramebufferTextureEXT");
 }
 
+if (de::contains(extSet, "GL_EXT_robustness"))
+{
+       gl->getGraphicsResetStatus      = (glGetGraphicsResetStatusFunc)        loader->get("glGetGraphicsResetStatusEXT");
+       gl->getnUniformfv                       = (glGetnUniformfvFunc)                         loader->get("glGetnUniformfvEXT");
+       gl->getnUniformiv                       = (glGetnUniformivFunc)                         loader->get("glGetnUniformivEXT");
+       gl->readnPixels                         = (glReadnPixelsFunc)                           loader->get("glReadnPixelsEXT");
+}
+
 if (de::contains(extSet, "GL_EXT_texture_buffer"))
 {
        gl->texBuffer           = (glTexBufferFunc)                     loader->get("glTexBufferEXT");
index 8ca4a9b..63c65e1 100644 (file)
@@ -196,6 +196,7 @@ void read_pixels (NegativeTestContext& ctx)
 
 void readn_pixels (NegativeTestContext& ctx)
 {
+       std::vector<GLfloat>    floatData       (4);
        std::vector<GLubyte>    ubyteData       (4);
        GLuint                                  fbo                     = 0x1234;
 
@@ -223,6 +224,8 @@ void readn_pixels (NegativeTestContext& ctx)
        ctx.beginSection("GL_INVALID_OPERATION is generated by ReadnPixels if the buffer size required to store the requested data is larger than bufSize.");
        ctx.glReadnPixels(0, 0, 0x1234, 0x1234, GL_RGBA, GL_UNSIGNED_BYTE, (int) ubyteData.size(), &ubyteData[0]);
        ctx.expectError(GL_INVALID_OPERATION);
+       ctx.glReadnPixels(0, 0, 1, 1, GL_RGBA, GL_FLOAT, (int) floatData.size(), &floatData[0]);
+       ctx.expectError(GL_INVALID_OPERATION);
        ctx.endSection();
 
        ctx.beginSection("GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete.");
@@ -240,7 +243,6 @@ void read_pixels_format_mismatch (NegativeTestContext& ctx)
 {
        std::vector<GLubyte>    ubyteData       (4);
        std::vector<GLushort>   ushortData      (4);
-       std::vector<GLfloat>    floatData       (4);
        GLint                                   readFormat      = 0x1234;
        GLint                                   readType        = 0x1234;
 
@@ -257,8 +259,6 @@ void read_pixels_format_mismatch (NegativeTestContext& ctx)
        ctx.expectError(GL_INVALID_OPERATION);
        ctx.glReadPixels(0, 0, 1, 1, GL_ALPHA, GL_UNSIGNED_SHORT_5_5_5_1, &ushortData[0]);
        ctx.expectError(GL_INVALID_OPERATION);
-       ctx.glReadnPixels(0, 0, 1, 1, GL_RGBA, GL_FLOAT, (int) floatData.size(), &floatData[0]);
-       ctx.expectError(GL_INVALID_OPERATION);
        ctx.endSection();
 
        ctx.beginSection("GL_RGBA/GL_UNSIGNED_BYTE is always accepted and the other acceptable pair can be discovered by querying GL_IMPLEMENTATION_COLOR_READ_FORMAT and GL_IMPLEMENTATION_COLOR_READ_TYPE.");
index 6fe4c46..f2dd1d9 100644 (file)
@@ -48,6 +48,7 @@ EXTENSIONS                    = [
        'GL_EXT_geometry_point_size',
        'GL_EXT_tessellation_shader',
        'GL_EXT_geometry_shader',
+       'GL_EXT_robustness',
        'GL_EXT_texture_buffer',
        'GL_EXT_texture_snorm',
        'GL_EXT_primitive_bounding_box',