From d99ba132d92fb015a4008910a98a257fad1199a6 Mon Sep 17 00:00:00 2001 From: Alexander Galazin Date: Thu, 23 Feb 2017 13:01:18 +0100 Subject: [PATCH] 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) --- framework/opengl/wrapper/glwInitExtES.inl | 8 ++++++++ modules/gles31/functional/es31fNegativeBufferApiTests.cpp | 6 +++--- scripts/opengl/src_util.py | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) 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 @@ 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"); 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 read_pixels (NegativeTestContext& ctx) void readn_pixels (NegativeTestContext& ctx) { + std::vector floatData (4); std::vector 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 ubyteData (4); std::vector ushortData (4); - std::vector 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."); 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 @@ 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', -- 2.7.4