From: Piotr Byszewski Date: Mon, 22 Jan 2018 13:31:08 +0000 (+0100) Subject: Fix negative texture and fbo attachment tests X-Git-Tag: upstream/1.3.5~2775 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6fc19de9f1e6c499556c8e9ad045ee6e88508cb7;p=platform%2Fupstream%2FVK-GL-CTS.git Fix negative texture and fbo attachment tests Negative GetFramebufferAttachmentParameteriv test for ES2 properly handles case when it is executed on ES3 capable hardware. This change also resolves enum issue for negative TexSubImage2D test. Invalid enum caused generation of different error code then expected. Components: OpenGL VK-GL-CTS issue: 316 Affects: dEQP-GLES2.functional.negative_api.texture.texsubimage2d_neg_wdt_hgt dEQP-GLES2.functional.negative_api.state.get_framebuffer_attachment_parameteriv Change-Id: Ib22eeba95fca7af3a66ab25934bdaf88362de2b2 --- diff --git a/modules/gles2/functional/es2fNegativeStateApiTests.cpp b/modules/gles2/functional/es2fNegativeStateApiTests.cpp index 72acf27..32ea573 100644 --- a/modules/gles2/functional/es2fNegativeStateApiTests.cpp +++ b/modules/gles2/functional/es2fNegativeStateApiTests.cpp @@ -502,6 +502,14 @@ void NegativeStateApiTests::init (void) }); ES2F_ADD_API_CASE(get_framebuffer_attachment_parameteriv, "Invalid glGetFramebufferAttachmentParameteriv() usage", { + // GL_MAJOR_VERSION query does not exist on GLES2 + // so succeeding query implies GLES3+ hardware. + bool isES3Compatible = false; + glw::GLint majorVersion = 0; + glGetIntegerv(GL_MAJOR_VERSION, &majorVersion); + if (glGetError() == GL_NO_ERROR) + isES3Compatible = true; + GLint params[1] = { -1 }; GLuint fbo; glGenFramebuffers(1, &fbo); @@ -513,31 +521,47 @@ void NegativeStateApiTests::init (void) m_log << TestLog::EndSection; m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if there is no attached object at the named attachment point and pname is not GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE."); - glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, ¶ms[0]); - expectError(GL_INVALID_ENUM); - m_log << TestLog::EndSection; - - m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if the attached object at the named attachment point is incompatible with pname."); - GLint attachmentObjectType = -1; - glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &attachmentObjectType); - expectError(GL_NO_ERROR); - - if (attachmentObjectType == GL_RENDERBUFFER) - glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL, ¶ms[0]); - else if (attachmentObjectType == GL_TEXTURE) - glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, -1, ¶ms[0]); - else if (attachmentObjectType == GL_NONE) - glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, ¶ms[0]); + if (isES3Compatible) + { + glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, ¶ms[0]); // TYPE is GL_NONE + expectError(GL_NO_ERROR); + glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE, ¶ms[0]); // TYPE is GL_NONE + expectError(GL_INVALID_OPERATION); + } else - m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid return value from glGetFramebufferAttachmentParameteriv()"); - - expectError(GL_INVALID_ENUM); - m_log << TestLog::EndSection; + { + glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, ¶ms[0]); + expectError(GL_INVALID_ENUM); + } + m_log << TestLog::EndSection; + + if (!isES3Compatible) + { + m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if the attached object at the named attachment point is incompatible with pname."); + GLint attachmentObjectType = -1; + glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &attachmentObjectType); + expectError(GL_NO_ERROR); + + if (attachmentObjectType == GL_RENDERBUFFER) + glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL, ¶ms[0]); + else if (attachmentObjectType == GL_TEXTURE) + glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, -1, ¶ms[0]); + else if (attachmentObjectType == GL_NONE) + glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, ¶ms[0]); + else + m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid return value from glGetFramebufferAttachmentParameteriv()"); + + expectError(GL_INVALID_ENUM); + m_log << TestLog::EndSection; + } m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if the default framebuffer object name 0 is bound."); glBindFramebuffer(GL_FRAMEBUFFER, 0); glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, ¶ms[0]); - expectError(GL_INVALID_OPERATION); + if (isES3Compatible) + expectError(GL_INVALID_OPERATION, GL_INVALID_ENUM); + else + expectError(GL_INVALID_OPERATION); m_log << TestLog::EndSection; glDeleteFramebuffers(1, &fbo); diff --git a/modules/gles2/functional/es2fNegativeTextureApiTests.cpp b/modules/gles2/functional/es2fNegativeTextureApiTests.cpp index 2ee5a59..33c102d 100644 --- a/modules/gles2/functional/es2fNegativeTextureApiTests.cpp +++ b/modules/gles2/functional/es2fNegativeTextureApiTests.cpp @@ -1732,7 +1732,7 @@ void NegativeTextureApiTests::init (void) expectError(GL_INVALID_VALUE); glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, -1, GL_RGBA, GL_UNSIGNED_BYTE, 0); expectError(GL_INVALID_VALUE); - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, -1, -1, -GL_RGBA, GL_UNSIGNED_BYTE, 0); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, -1, -1, GL_RGBA, GL_UNSIGNED_BYTE, 0); expectError(GL_INVALID_VALUE); m_log << TestLog::EndSection;