Use glReadnPixels only if KHR_robustness is supported
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)
diff --git a/framework/opengl/wrapper/glwInitExtES.inl b/framework/opengl/wrapper/glwInitExtES.inl
index 75a3385..5e8005b 100644
--- a/framework/opengl/wrapper/glwInitExtES.inl
+++ b/framework/opengl/wrapper/glwInitExtES.inl
@@ -34,6 +34,14 @@
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");
diff --git a/modules/gles31/functional/es31fNegativeBufferApiTests.cpp b/modules/gles31/functional/es31fNegativeBufferApiTests.cpp
index 8ca4a9b..63c65e1 100644
--- a/modules/gles31/functional/es31fNegativeBufferApiTests.cpp
+++ b/modules/gles31/functional/es31fNegativeBufferApiTests.cpp
@@ -196,6 +196,7 @@
void readn_pixels (NegativeTestContext& ctx)
{
+ std::vector<GLfloat> floatData (4);
std::vector<GLubyte> ubyteData (4);
GLuint fbo = 0x1234;
@@ -223,6 +224,8 @@
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 @@
{
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 @@
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.");
diff --git a/scripts/opengl/src_util.py b/scripts/opengl/src_util.py
index 6fe4c46..f2dd1d9 100644
--- a/scripts/opengl/src_util.py
+++ b/scripts/opengl/src_util.py
@@ -48,6 +48,7 @@
'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',