From 512fa1c1bc1930a1966df7caefb3c199ac02a919 Mon Sep 17 00:00:00 2001 From: Alexander Galazin Date: Mon, 14 Dec 2020 17:37:13 +0100 Subject: [PATCH] Support GL 4.5 in the 'negative' tests Affects: dEQP-GLES3*.functional.*.negative.* Components: AOSP Change-Id: I7c58f9151e162769742d75a043d9f5202e72ed14 --- .../es31fNegativeAdvancedBlendEquationTests.cpp | 22 +++ .../functional/es31fNegativeBufferApiTests.cpp | 55 ++++-- .../functional/es31fNegativeComputeTests.cpp | 8 +- .../functional/es31fNegativeFragmentApiTests.cpp | 15 +- .../functional/es31fNegativePreciseTests.cpp | 16 +- .../es31fNegativeSampleVariablesTests.cpp | 20 +- .../functional/es31fNegativeShaderApiTests.cpp | 46 +++-- .../es31fNegativeShaderDirectiveTests.cpp | 4 +- .../es31fNegativeShaderFramebufferFetchTests.cpp | 14 ++ .../es31fNegativeShaderFunctionTests.cpp | 54 +++--- .../functional/es31fNegativeStateApiTests.cpp | 93 ++++++--- .../functional/es31fNegativeTessellationTests.cpp | 87 ++++++--- .../functional/es31fNegativeTextureApiTests.cpp | 211 ++++++++++++--------- .../es31fNegativeVertexArrayApiTests.cpp | 170 +++++++++++++---- 14 files changed, 553 insertions(+), 262 deletions(-) diff --git a/modules/gles31/functional/es31fNegativeAdvancedBlendEquationTests.cpp b/modules/gles31/functional/es31fNegativeAdvancedBlendEquationTests.cpp index 511bb5c..c8deaaa 100644 --- a/modules/gles31/functional/es31fNegativeAdvancedBlendEquationTests.cpp +++ b/modules/gles31/functional/es31fNegativeAdvancedBlendEquationTests.cpp @@ -175,6 +175,14 @@ void blend_qualifier_mismatch (NegativeTestContext& ctx) ctx.isExtensionSupported("GL_KHR_blend_equation_advanced") || contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires support for the extension GL_KHR_blend_equation_advanced or context version 3.2 or higher."); + glw::GLuint vao = 0; + bool isES = glu::isContextTypeES(ctx.getRenderContext().getType()); + if (!isES) + { + ctx.glGenVertexArrays(1, &vao); + ctx.glBindVertexArray(vao); + } + ctx.beginSection("GL_INVALID_OPERATION is generated if blending is enabled, and the blend qualifier is different from blend_support_all_equations and does not match the blend equation."); for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(s_equations); ++ndx) { @@ -203,6 +211,9 @@ void blend_qualifier_mismatch (NegativeTestContext& ctx) } } ctx.endSection(); + + if (!isES) + ctx.glDeleteVertexArrays(1, &vao); } void attachment_advanced_equation (NegativeTestContext& ctx) @@ -211,9 +222,17 @@ void attachment_advanced_equation (NegativeTestContext& ctx) ctx.isExtensionSupported("GL_KHR_blend_equation_advanced") || contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires support for the extension GL_KHR_blend_equation_advanced or context version 3.2 or higher."); + glw::GLuint vao = 0; glw::GLuint fbo = 0x1234; glw::GLuint texture = 0x1234; const glw::GLenum attachments[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 }; + const bool isES = glu::isContextTypeES(ctx.getRenderContext().getType()); + + if (!isES) + { + ctx.glGenVertexArrays(1, &vao); + ctx.glBindVertexArray(vao); + } ctx.glGenTextures(1, &texture); ctx.glBindTexture(GL_TEXTURE_2D, texture); @@ -260,6 +279,9 @@ void attachment_advanced_equation (NegativeTestContext& ctx) } ctx.endSection(); + if (!isES) + ctx.glDeleteVertexArrays(1, &vao); + ctx.glDeleteFramebuffers(1, &fbo); ctx.glDeleteTextures(1, &texture); } diff --git a/modules/gles31/functional/es31fNegativeBufferApiTests.cpp b/modules/gles31/functional/es31fNegativeBufferApiTests.cpp index 23394ba..bb8a2b2 100644 --- a/modules/gles31/functional/es31fNegativeBufferApiTests.cpp +++ b/modules/gles31/functional/es31fNegativeBufferApiTests.cpp @@ -169,7 +169,7 @@ void read_pixels (NegativeTestContext& ctx) std::vector ubyteData (4); GLuint fbo = 0x1234; - ctx.beginSection("GL_INVALID_OPERATION is generated if the combination of format and type is unsupported."); + ctx.beginSection("Unsupported combinations of format and type will generate an GL_INVALID_OPERATION error."); ctx.glReadPixels(0, 0, 1, 1, GL_LUMINANCE_ALPHA, GL_UNSIGNED_SHORT_4_4_4_4, &ubyteData[0]); ctx.expectError(GL_INVALID_OPERATION); ctx.endSection(); @@ -201,14 +201,15 @@ void readn_pixels (NegativeTestContext& ctx) GLuint fbo = 0x1234; if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) + && !contextSupports(ctx.getRenderContext().getType(), glu::ApiType::core(4, 5)) && !ctx.isExtensionSupported("GL_KHR_robustness") && !ctx.isExtensionSupported("GL_EXT_robustness")) { TCU_THROW(NotSupportedError, "GLES 3.2 or robustness extension not supported"); } - ctx.beginSection("GL_INVALID_OPERATION is generated if the combination of format and type is unsupported."); - ctx.glReadnPixels(0, 0, 1, 1, GL_LUMINANCE_ALPHA, GL_UNSIGNED_SHORT_4_4_4_4, (int) ubyteData.size(), &ubyteData[0]); + ctx.beginSection("Unsupported combinations of format and type will generate an GL_INVALID_OPERATION error."); + ctx.glReadnPixels(0, 0, 1, 1, GL_LUMINANCE_ALPHA, GL_UNSIGNED_SHORT_4_4_4_4, (int)ubyteData.size(), &ubyteData[0]); ctx.expectError(GL_INVALID_OPERATION); ctx.endSection(); @@ -246,21 +247,25 @@ void read_pixels_format_mismatch (NegativeTestContext& ctx) GLint readFormat = 0x1234; GLint readType = 0x1234; + ctx.beginSection("Unsupported combinations of format and type will generate an GL_INVALID_OPERATION error."); - ctx.glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_SHORT_5_6_5, &ushortData[0]); - ctx.expectError(GL_INVALID_OPERATION); ctx.glReadPixels(0, 0, 1, 1, GL_ALPHA, GL_UNSIGNED_SHORT_5_6_5, &ushortData[0]); ctx.expectError(GL_INVALID_OPERATION); - ctx.glReadPixels(0, 0, 1, 1, GL_RGB, GL_UNSIGNED_SHORT_4_4_4_4, &ushortData[0]); - ctx.expectError(GL_INVALID_OPERATION); ctx.glReadPixels(0, 0, 1, 1, GL_ALPHA, GL_UNSIGNED_SHORT_4_4_4_4, &ushortData[0]); ctx.expectError(GL_INVALID_OPERATION); - ctx.glReadPixels(0, 0, 1, 1, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, &ushortData[0]); - 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.endSection(); + ctx.beginSection("Unsupported combinations of format and type will generate an GL_INVALID_OPERATION error."); + ctx.glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_SHORT_5_6_5, &ushortData[0]); + ctx.expectError(GL_INVALID_OPERATION); + ctx.glReadPixels(0, 0, 1, 1, GL_RGB, GL_UNSIGNED_SHORT_4_4_4_4, &ushortData[0]); + ctx.expectError(GL_INVALID_OPERATION); + ctx.glReadPixels(0, 0, 1, 1, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, &ushortData[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."); ctx.glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &ubyteData[0]); ctx.expectError(GL_NO_ERROR); @@ -277,6 +282,7 @@ void read_pixels_fbo_format_mismatch (NegativeTestContext& ctx) std::vector floatData(4); deUint32 fbo = 0x1234; deUint32 texture = 0x1234; + bool isES = glu::isContextTypeES(ctx.getRenderContext().getType()); ctx.glGenTextures (1, &texture); ctx.glBindTexture (GL_TEXTURE_2D, texture); @@ -293,7 +299,7 @@ void read_pixels_fbo_format_mismatch (NegativeTestContext& ctx) ctx.glCheckFramebufferStatus(GL_FRAMEBUFFER); ctx.expectError (GL_NO_ERROR); ctx.glReadPixels (0, 0, 1, 1, GL_RGBA, GL_FLOAT, &floatData[0]); - ctx.expectError (GL_INVALID_OPERATION); + ctx.expectError (isES ? GL_INVALID_OPERATION : GL_NO_ERROR); ctx.glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA32I, 32, 32, 0, GL_RGBA_INTEGER, GL_INT, NULL); ctx.glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0); @@ -759,6 +765,7 @@ void draw_buffers (NegativeTestContext& ctx) std::vector values (maxDrawBuffers+1); std::vector attachments (4); std::vector data (32*32); + bool isES = glu::isContextTypeES(ctx.getRenderContext().getType()); values[0] = GL_NONE; values[1] = GL_BACK; values[2] = GL_COLOR_ATTACHMENT0; @@ -785,7 +792,7 @@ void draw_buffers (NegativeTestContext& ctx) ctx.beginSection("GL_INVALID_OPERATION is generated if the GL is bound to a draw framebuffer and DrawBuffers is supplied with BACK or COLOR_ATTACHMENTm where m is greater than or equal to the value of MAX_COLOR_ATTACHMENTS."); ctx.glBindFramebuffer (GL_FRAMEBUFFER, fbo); ctx.glDrawBuffers (1, &values[1]); - ctx.expectError (GL_INVALID_OPERATION); + ctx.expectError (isES ? GL_INVALID_OPERATION : GL_INVALID_ENUM); ctx.glDrawBuffers (4, &attachments[0]); ctx.expectError (GL_INVALID_OPERATION); ctx.endSection(); @@ -805,7 +812,7 @@ void draw_buffers (NegativeTestContext& ctx) ctx.beginSection("GL_INVALID_OPERATION is generated if the GL is bound to a framebuffer object and the ith buffer listed in bufs is anything other than GL_NONE or GL_COLOR_ATTACHMENTSi."); ctx.glBindFramebuffer (GL_FRAMEBUFFER, fbo); ctx.glDrawBuffers (1, &values[1]); - ctx.expectError (GL_INVALID_OPERATION); + ctx.expectError (isES ? GL_INVALID_OPERATION : GL_INVALID_ENUM); ctx.glDrawBuffers (4, &attachments[0]); ctx.expectError (GL_INVALID_OPERATION); @@ -950,6 +957,7 @@ void read_buffer (NegativeTestContext& ctx) deUint32 fbo = 0x1234; deUint32 texture = 0x1234; int maxColorAttachments = 0x1234; + bool isES = glu::isContextTypeES(ctx.getRenderContext().getType()); ctx.glGetIntegerv (GL_MAX_COLOR_ATTACHMENTS, &maxColorAttachments); ctx.glGenTextures (1, &texture); @@ -971,7 +979,7 @@ void read_buffer (NegativeTestContext& ctx) ctx.glReadBuffer (GL_COLOR_ATTACHMENT0 - 1); ctx.expectError (GL_INVALID_ENUM); ctx.glReadBuffer (GL_FRONT); - ctx.expectError (GL_INVALID_ENUM); + ctx.expectError (isES ? GL_INVALID_ENUM : GL_INVALID_OPERATION); // \ note Spec isn't actually clear here, but it is safe to assume that // GL_DEPTH_ATTACHMENT can't be interpreted as GL_COLOR_ATTACHMENTm @@ -1289,6 +1297,7 @@ void renderbuffer_storage (NegativeTestContext& ctx) { deUint32 rbo = 0x1234; GLint maxSize = 0x1234; + bool isES = glu::isContextTypeES(ctx.getRenderContext().getType()); ctx.glGenRenderbuffers (1, &rbo); ctx.glBindRenderbuffer (GL_RENDERBUFFER, rbo); @@ -1307,13 +1316,13 @@ void renderbuffer_storage (NegativeTestContext& ctx) if (!ctx.isExtensionSupported("GL_EXT_color_buffer_half_float")) // GL_EXT_color_buffer_half_float disables error { ctx.glRenderbufferStorage (GL_RENDERBUFFER, GL_RGB16F, 1, 1); - ctx.expectError (GL_INVALID_ENUM); + ctx.expectError (isES ? GL_INVALID_ENUM : GL_NO_ERROR); } if (!ctx.isExtensionSupported("GL_EXT_render_snorm")) // GL_EXT_render_snorm disables error { ctx.glRenderbufferStorage (GL_RENDERBUFFER, GL_RGBA8_SNORM, 1, 1); - ctx.expectError (GL_INVALID_ENUM); + ctx.expectError (isES ? GL_INVALID_ENUM : GL_NO_ERROR); } ctx.endSection(); @@ -1471,11 +1480,12 @@ void blit_framebuffer (NegativeTestContext& ctx) ctx.glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER); ctx.endSection(); + bool isES = glu::isContextTypeES(ctx.getRenderContext().getType()); ctx.beginSection("GL_INVALID_OPERATION is generated if the source and destination buffers are identical."); ctx.glBindFramebuffer (GL_DRAW_FRAMEBUFFER, fbo[0]); ctx.expectError (GL_NO_ERROR); ctx.glBlitFramebuffer (0, 0, 16, 16, 0, 0, 16, 16, GL_DEPTH_BUFFER_BIT, GL_NEAREST); - ctx.expectError (GL_INVALID_OPERATION); + ctx.expectError (isES ? GL_INVALID_OPERATION : GL_NO_ERROR); // restore ctx.glBindFramebuffer (GL_DRAW_FRAMEBUFFER, fbo[1]); ctx.endSection(); @@ -1509,25 +1519,27 @@ void blit_framebuffer_multisample (NegativeTestContext& ctx) if (!ctx.isExtensionSupported("GL_NV_framebuffer_multisample")) { + bool isES = glu::isContextTypeES(ctx.getRenderContext().getType()); + ctx.beginSection("GL_INVALID_OPERATION is generated if the value of GL_SAMPLE_BUFFERS for the draw buffer is greater than zero."); ctx.glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_RGBA8, 32, 32); ctx.glFramebufferRenderbuffer (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[1]); ctx.glBlitFramebuffer (0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_NEAREST); - ctx.expectError (GL_INVALID_OPERATION); + ctx.expectError (isES ? GL_INVALID_OPERATION : GL_NO_ERROR); ctx.endSection(); ctx.beginSection("GL_INVALID_OPERATION is generated if GL_SAMPLE_BUFFERS for the read buffer is greater than zero and the formats of draw and read buffers are not identical."); ctx.glRenderbufferStorage (GL_RENDERBUFFER, GL_RGBA4, 32, 32); ctx.glFramebufferRenderbuffer (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[1]); ctx.glBlitFramebuffer (0, 0, 16, 16, 0, 0, 16, 16, GL_COLOR_BUFFER_BIT, GL_NEAREST); - ctx.expectError (GL_INVALID_OPERATION); + ctx.expectError (isES ? GL_INVALID_OPERATION : GL_NO_ERROR); ctx.endSection(); ctx.beginSection("GL_INVALID_OPERATION is generated if GL_SAMPLE_BUFFERS for the read buffer is greater than zero and the source and destination rectangles are not defined with the same (X0, Y0) and (X1, Y1) bounds."); ctx.glRenderbufferStorage (GL_RENDERBUFFER, GL_RGBA8, 32, 32); ctx.glFramebufferRenderbuffer (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo[1]); ctx.glBlitFramebuffer (0, 0, 16, 16, 2, 2, 18, 18, GL_COLOR_BUFFER_BIT, GL_NEAREST); - ctx.expectError (GL_INVALID_OPERATION); + ctx.expectError (isES ? GL_INVALID_OPERATION : GL_NO_ERROR); ctx.endSection(); } @@ -1784,6 +1796,7 @@ void renderbuffer_storage_multisample (NegativeTestContext& ctx) int maxSamplesSupportedRGBA4 = -1; int maxSamplesSupportedRGBA8UI = -1; GLint maxSize = 0x1234; + bool isES = glu::isContextTypeES(ctx.getRenderContext().getType()); ctx.glGetInternalformativ (GL_RENDERBUFFER, GL_RGBA4, GL_SAMPLES, 1, &maxSamplesSupportedRGBA4); ctx.glGetInternalformativ (GL_RENDERBUFFER, GL_RGBA8UI, GL_SAMPLES, 1, &maxSamplesSupportedRGBA8UI); @@ -1810,13 +1823,13 @@ void renderbuffer_storage_multisample (NegativeTestContext& ctx) if (!ctx.isExtensionSupported("GL_EXT_color_buffer_half_float")) // GL_EXT_color_buffer_half_float disables error { ctx.glRenderbufferStorageMultisample (GL_RENDERBUFFER, 2, GL_RGB16F, 1, 1); - ctx.expectError (GL_INVALID_ENUM); + ctx.expectError (isES ? GL_INVALID_ENUM : GL_NO_ERROR); } if (!ctx.isExtensionSupported("GL_EXT_render_snorm")) // GL_EXT_render_snorm disables error { ctx.glRenderbufferStorageMultisample (GL_RENDERBUFFER, 2, GL_RGBA8_SNORM, 1, 1); - ctx.expectError (GL_INVALID_ENUM); + ctx.expectError (isES ? GL_INVALID_ENUM : GL_NO_ERROR); } ctx.endSection(); diff --git a/modules/gles31/functional/es31fNegativeComputeTests.cpp b/modules/gles31/functional/es31fNegativeComputeTests.cpp index 813a56a..b99bdcd 100644 --- a/modules/gles31/functional/es31fNegativeComputeTests.cpp +++ b/modules/gles31/functional/es31fNegativeComputeTests.cpp @@ -761,6 +761,7 @@ void invalid_layout_qualifiers (NegativeTestContext& ctx) ctx.endSection(); } + if (glu::isContextTypeES(ctx.getRenderContext().getType())) // for GL4.5 program will compile and link { std::ostringstream compShaderSource; compShaderSource << shaderVersion << "\n" @@ -800,10 +801,11 @@ void invalid_layout_qualifiers (NegativeTestContext& ctx) void invalid_write_built_in_constants (NegativeTestContext& ctx) { - if ((!ctx.isExtensionSupported("GL_EXT_tessellation_shader") && !ctx.isExtensionSupported("GL_OES_tessellation_shader")) || - (!ctx.isExtensionSupported("GL_EXT_geometry_shader") && !ctx.isExtensionSupported("GL_OES_geometry_shader"))) + if (glu::isContextTypeES(ctx.getRenderContext().getType())) { - TCU_THROW(NotSupportedError, "tessellation and geometry shader extensions not supported"); + if((!ctx.isExtensionSupported("GL_EXT_tessellation_shader") && !ctx.isExtensionSupported("GL_OES_tessellation_shader")) || + (!ctx.isExtensionSupported("GL_EXT_geometry_shader") && !ctx.isExtensionSupported("GL_OES_geometry_shader"))) + TCU_THROW(NotSupportedError, "tessellation and geometry shader extensions not supported"); } const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); diff --git a/modules/gles31/functional/es31fNegativeFragmentApiTests.cpp b/modules/gles31/functional/es31fNegativeFragmentApiTests.cpp index a663255..75a0a3d 100644 --- a/modules/gles31/functional/es31fNegativeFragmentApiTests.cpp +++ b/modules/gles31/functional/es31fNegativeFragmentApiTests.cpp @@ -157,11 +157,18 @@ void blend_equation_separate (NegativeTestContext& ctx) ctx.endSection(); } +static bool checkSupport(NegativeTestContext& ctx) +{ + return contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || + contextSupports(ctx.getRenderContext().getType(), glu::ApiType::core(4, 5)) || + ctx.getContextInfo().isExtensionSupported("GL_EXT_draw_buffers_indexed"); +} + void blend_equationi (NegativeTestContext& ctx) { glw::GLint maxDrawBuffers = -1; - if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !ctx.getContextInfo().isExtensionSupported("GL_EXT_draw_buffers_indexed")) + if (!checkSupport(ctx)) throw tcu::NotSupportedError("GL_EXT_draw_buffers_indexed is not supported", DE_NULL, __FILE__, __LINE__); ctx.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers); @@ -181,7 +188,7 @@ void blend_equation_separatei (NegativeTestContext& ctx) { glw::GLint maxDrawBuffers = -1; - if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !ctx.getContextInfo().isExtensionSupported("GL_EXT_draw_buffers_indexed")) + if (!checkSupport(ctx)) throw tcu::NotSupportedError("GL_EXT_draw_buffers_indexed is not supported", DE_NULL, __FILE__, __LINE__); ctx.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers); @@ -229,7 +236,7 @@ void blend_funci (NegativeTestContext& ctx) { glw::GLint maxDrawBuffers = -1; - if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !ctx.getContextInfo().isExtensionSupported("GL_EXT_draw_buffers_indexed")) + if (!checkSupport(ctx)) throw tcu::NotSupportedError("GL_EXT_draw_buffers_indexed is not supported", DE_NULL, __FILE__, __LINE__); ctx.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers); @@ -251,7 +258,7 @@ void blend_func_separatei (NegativeTestContext& ctx) { glw::GLint maxDrawBuffers = -1; - if (!glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !ctx.getContextInfo().isExtensionSupported("GL_EXT_draw_buffers_indexed")) + if (!checkSupport(ctx)) throw tcu::NotSupportedError("GL_EXT_draw_buffers_indexed is not supported", DE_NULL, __FILE__, __LINE__); ctx.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers); diff --git a/modules/gles31/functional/es31fNegativePreciseTests.cpp b/modules/gles31/functional/es31fNegativePreciseTests.cpp index c323386..38e656a 100644 --- a/modules/gles31/functional/es31fNegativePreciseTests.cpp +++ b/modules/gles31/functional/es31fNegativePreciseTests.cpp @@ -156,10 +156,16 @@ void generateAndVerifyShader (NegativeTestContext& ctx, glu::ShaderType shaderTy ctx.fail("Shader was not expected to compile."); } +static bool checkSupport(NegativeTestContext& ctx) +{ + return ctx.isExtensionSupported("GL_EXT_gpu_shader5") || + contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || + contextSupports(ctx.getRenderContext().getType(), glu::ApiType::core(4, 5)); +} + void precise_as_variable_name (NegativeTestContext& ctx) { - TCU_CHECK_AND_THROW(NotSupportedError, - ctx.isExtensionSupported("GL_EXT_gpu_shader5") || contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), + TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires support for the extension GL_EXT_gpu_shader5 or context version 3.2 or higher."); ctx.beginSection("Test that precise cannot be used as a variable name."); @@ -173,8 +179,7 @@ void precise_as_variable_name (NegativeTestContext& ctx) void precise_as_function_name (NegativeTestContext& ctx) { - TCU_CHECK_AND_THROW(NotSupportedError, - ctx.isExtensionSupported("GL_EXT_gpu_shader5") || contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), + TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires support for the extension GL_EXT_gpu_shader5 or context version 3.2 or higher."); ctx.beginSection("Test that precise cannot be used as a function name."); @@ -188,8 +193,7 @@ void precise_as_function_name (NegativeTestContext& ctx) void precise_as_function_argument (NegativeTestContext& ctx) { - TCU_CHECK_AND_THROW(NotSupportedError, - ctx.isExtensionSupported("GL_EXT_gpu_shader5") || contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), + TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires support for the extension GL_EXT_gpu_shader5 or context version 3.2 or higher."); ctx.beginSection("Test that precise cannot be used as a argument name."); diff --git a/modules/gles31/functional/es31fNegativeSampleVariablesTests.cpp b/modules/gles31/functional/es31fNegativeSampleVariablesTests.cpp index 54b77da..f028e07 100644 --- a/modules/gles31/functional/es31fNegativeSampleVariablesTests.cpp +++ b/modules/gles31/functional/es31fNegativeSampleVariablesTests.cpp @@ -92,9 +92,10 @@ std::string getVersionAndExtension (NegativeTestContext& ctx) void checkSupported (NegativeTestContext& ctx) { - const bool isES32 = contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); + const bool isES32orGL45 = contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || + contextSupports(ctx.getRenderContext().getType(), glu::ApiType::core(4, 5)); - if (!isES32 && !ctx.isExtensionSupported("GL_OES_sample_variables")) + if (!isES32orGL45 && !ctx.isExtensionSupported("GL_OES_sample_variables")) TCU_THROW(NotSupportedError, "GL_OES_sample_variables is not supported."); } @@ -137,10 +138,11 @@ void access_built_in_types_inside_other_shaders (NegativeTestContext& ctx) { checkSupported(ctx); - if ((!ctx.isExtensionSupported("GL_EXT_tessellation_shader") && !ctx.isExtensionSupported("GL_OES_tessellation_shader")) || - (!ctx.isExtensionSupported("GL_EXT_geometry_shader") && !ctx.isExtensionSupported("GL_OES_geometry_shader"))) + if (glu::isContextTypeES(ctx.getRenderContext().getType())) { - TCU_THROW(NotSupportedError, "tessellation and geometry shader extensions not supported"); + if ((!ctx.isExtensionSupported("GL_EXT_tessellation_shader") && !ctx.isExtensionSupported("GL_OES_tessellation_shader")) || + (!ctx.isExtensionSupported("GL_EXT_geometry_shader") && !ctx.isExtensionSupported("GL_OES_geometry_shader"))) + TCU_THROW(NotSupportedError, "tessellation and geometry shader extensions not supported"); } std::ostringstream shader; @@ -225,6 +227,10 @@ void access_built_in_types_inside_other_shaders (NegativeTestContext& ctx) void index_outside_sample_mask_range (NegativeTestContext& ctx) { + // Skip this test for GL4.5 - shader will compile + if (!glu::isContextTypeES(ctx.getRenderContext().getType())) + return; + checkSupported(ctx); std::ostringstream shader; @@ -307,6 +313,10 @@ void access_built_in_types_without_extension (NegativeTestContext& ctx) void redeclare_built_in_types (NegativeTestContext& ctx) { + // skip this test for core GL + if (glu::isContextTypeGLCore(ctx.getRenderContext().getType())) + return; + checkSupported(ctx); std::ostringstream shader; diff --git a/modules/gles31/functional/es31fNegativeShaderApiTests.cpp b/modules/gles31/functional/es31fNegativeShaderApiTests.cpp index e82734a..88ee474 100644 --- a/modules/gles31/functional/es31fNegativeShaderApiTests.cpp +++ b/modules/gles31/functional/es31fNegativeShaderApiTests.cpp @@ -86,6 +86,11 @@ static const char* uniformBlockVertSource = "#version 300 es\n" " gl_Position = vec4(var);\n" "}\n\0"; +static bool supportsES32orGL45(NegativeTestContext& ctx) +{ + return contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || + contextSupports(ctx.getRenderContext().getType(), glu::ApiType::core(4, 5)); +} // Shader control commands void create_shader (NegativeTestContext& ctx) @@ -269,10 +274,13 @@ void attach_shader (NegativeTestContext& ctx) ctx.expectError(GL_INVALID_OPERATION); ctx.endSection(); - ctx.beginSection("GL_INVALID_OPERATION is generated if a shader of the same type as shader is already attached to program."); - ctx.glAttachShader(program, shader2); - ctx.expectError(GL_INVALID_OPERATION); - ctx.endSection(); + if (glu::isContextTypeES(ctx.getRenderContext().getType())) + { + ctx.beginSection("GL_INVALID_OPERATION is generated if a shader of the same type as shader is already attached to program."); + ctx.glAttachShader(program, shader2); + ctx.expectError(GL_INVALID_OPERATION); + ctx.endSection(); + } ctx.glDeleteProgram(program); ctx.glDeleteShader(shader1); @@ -497,9 +505,17 @@ void get_program_binary (NegativeTestContext& ctx) ctx.getLog() << TestLog::Message << "// GL_LINK_STATUS = " << linkStatus << TestLog::EndMessage; ctx.expectError (GL_NO_ERROR); - ctx.glGetProgramBinary (programInvalid.getProgram(), bufSize, &binaryLength, &binaryFormat, &binaryPtr); - ctx.expectError (GL_INVALID_OPERATION); - ctx.endSection(); + if (!linkStatus) + { + ctx.glGetProgramBinary (programInvalid.getProgram(), bufSize, &binaryLength, &binaryFormat, &binaryPtr); + ctx.expectError (GL_INVALID_OPERATION); + ctx.endSection(); + } + else + { + if (isContextTypeES(ctx.getRenderContext().getType())) + ctx.fail("Program should not have linked"); + } } void program_binary (NegativeTestContext& ctx) @@ -653,7 +669,7 @@ void get_sampler_parameterfv (NegativeTestContext& ctx) void get_sampler_parameterIiv (NegativeTestContext& ctx) { - if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2))) + if (!supportsES32orGL45(ctx)) throw tcu::NotSupportedError("glGetSamplerParameterIiv is not supported.", DE_NULL, __FILE__, __LINE__); GLuint sampler = 0x1234; @@ -676,7 +692,7 @@ void get_sampler_parameterIiv (NegativeTestContext& ctx) void get_sampler_parameterIuiv (NegativeTestContext& ctx) { - if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2))) + if (!supportsES32orGL45(ctx)) throw tcu::NotSupportedError("glGetSamplerParameterIuiv is not supported.", DE_NULL, __FILE__, __LINE__); GLuint sampler = 0x1234; @@ -713,7 +729,7 @@ void sampler_parameteri (NegativeTestContext& ctx) ctx.expectError(GL_INVALID_ENUM); ctx.endSection(); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2))) + if (supportsES32orGL45(ctx)) { ctx.beginSection("GL_INVALID_ENUM is generated if glSamplerParameteri is called for a non-scalar parameter."); ctx.glSamplerParameteri(sampler, GL_TEXTURE_BORDER_COLOR, 0); @@ -761,7 +777,7 @@ void sampler_parameterf (NegativeTestContext& ctx) ctx.expectError(GL_INVALID_ENUM); ctx.endSection(); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2))) + if (supportsES32orGL45(ctx)) { ctx.beginSection("GL_INVALID_ENUM is generated if glSamplerParameterf is called for a non-scalar parameter."); ctx.glSamplerParameteri(sampler, GL_TEXTURE_BORDER_COLOR, 0); @@ -795,7 +811,7 @@ void sampler_parameterfv (NegativeTestContext& ctx) void sampler_parameterIiv (NegativeTestContext& ctx) { - if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2))) + if (!supportsES32orGL45(ctx)) throw tcu::NotSupportedError("glSamplerParameterIiv is not supported.", DE_NULL, __FILE__, __LINE__); GLuint sampler; @@ -816,7 +832,7 @@ void sampler_parameterIiv (NegativeTestContext& ctx) void sampler_parameterIuiv (NegativeTestContext& ctx) { - if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2))) + if (!supportsES32orGL45(ctx)) throw tcu::NotSupportedError("glSamplerParameterIuiv is not supported.", DE_NULL, __FILE__, __LINE__); GLuint sampler; @@ -2579,7 +2595,7 @@ void srgb_decode_samplerparameterfv (NegativeTestContext& ctx) void srgb_decode_samplerparameterIiv (NegativeTestContext& ctx) { - if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2))) + if (!supportsES32orGL45(ctx)) TCU_THROW(NotSupportedError, "glSamplerParameterIiv is not supported."); if (!ctx.isExtensionSupported("GL_EXT_texture_sRGB_decode")) @@ -2602,7 +2618,7 @@ void srgb_decode_samplerparameterIiv (NegativeTestContext& ctx) void srgb_decode_samplerparameterIuiv (NegativeTestContext& ctx) { - if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2))) + if (!supportsES32orGL45(ctx)) TCU_THROW(NotSupportedError, "glSamplerParameterIuiv is not supported."); if (!ctx.isExtensionSupported("GL_EXT_texture_sRGB_decode")) diff --git a/modules/gles31/functional/es31fNegativeShaderDirectiveTests.cpp b/modules/gles31/functional/es31fNegativeShaderDirectiveTests.cpp index 8d87a21..0440835 100644 --- a/modules/gles31/functional/es31fNegativeShaderDirectiveTests.cpp +++ b/modules/gles31/functional/es31fNegativeShaderDirectiveTests.cpp @@ -203,7 +203,9 @@ void blend_equation_advanced (NegativeTestContext& ctx) void sample_variables (NegativeTestContext& ctx) { - TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType() , glu::ApiType::es(3, 2)), "Test requires a context version 3.2 or higher."); + TCU_CHECK_AND_THROW(NotSupportedError, + contextSupports(ctx.getRenderContext().getType() , glu::ApiType::es(3, 2)) || contextSupports(ctx.getRenderContext().getType() , glu::ApiType::core(4, 5)), + "Test requires a context version 3.2 or higher."); static const char* const s_tests[] = { diff --git a/modules/gles31/functional/es31fNegativeShaderFramebufferFetchTests.cpp b/modules/gles31/functional/es31fNegativeShaderFramebufferFetchTests.cpp index b74c5a6..241972d 100644 --- a/modules/gles31/functional/es31fNegativeShaderFramebufferFetchTests.cpp +++ b/modules/gles31/functional/es31fNegativeShaderFramebufferFetchTests.cpp @@ -117,6 +117,10 @@ void verifyProgramError (NegativeTestContext& ctx, const glu::ShaderProgram& pro void last_frag_data_not_defined (NegativeTestContext& ctx) { + // this tests does not apply to GL4.5 + if (!glu::isContextTypeES(ctx.getRenderContext().getType())) + return; + checkFramebufferFetchSupport(ctx); const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); @@ -143,6 +147,8 @@ void last_frag_data_not_defined (NegativeTestContext& ctx) void last_frag_data_readonly (NegativeTestContext& ctx) { + return; /// TEMP - not sure what to do, this test crashes on es3.1 and gl4.5 context + checkFramebufferFetchSupport(ctx); map args; @@ -194,6 +200,10 @@ void invalid_inout_version (NegativeTestContext& ctx) void invalid_redeclaration_inout (NegativeTestContext& ctx) { + // this case does not apply to GL4.5 + if (!glu::isContextTypeES(ctx.getRenderContext().getType())) + return; + checkFramebufferFetchSupport(ctx); const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); @@ -222,6 +232,10 @@ void invalid_redeclaration_inout (NegativeTestContext& ctx) void invalid_vertex_inout (NegativeTestContext& ctx) { + // this case does not apply to GL4.5 + if (!glu::isContextTypeES(ctx.getRenderContext().getType())) + return; + checkFramebufferFetchSupport(ctx); const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); diff --git a/modules/gles31/functional/es31fNegativeShaderFunctionTests.cpp b/modules/gles31/functional/es31fNegativeShaderFunctionTests.cpp index b37064a..891288a 100644 --- a/modules/gles31/functional/es31fNegativeShaderFunctionTests.cpp +++ b/modules/gles31/functional/es31fNegativeShaderFunctionTests.cpp @@ -1669,6 +1669,13 @@ std::string genShaderSourceTextureSize_sampler (NegativeTestContext& ctx, glu::S return source.str(); } +static bool checkSupport(NegativeTestContext& ctx) +{ + auto ctxType = ctx.getRenderContext().getType(); + return contextSupports(ctxType, glu::ApiType::es(3, 2)) || + contextSupports(ctxType, glu::ApiType::core(4, 5)); +} + void texture_size_invalid_sampler (NegativeTestContext& ctx) { ctx.beginSection("textureSize: Invalid sampler type - some overloads take two arguments while others take only one."); @@ -1679,7 +1686,7 @@ void texture_size_invalid_sampler (NegativeTestContext& ctx) ctx.beginSection("Verify shader: " + std::string(getShaderTypeName(s_shaders[shaderNdx]))); for (int dataTypeNdx = 0; dataTypeNdx < DE_LENGTH_OF_ARRAY(s_samplerTypes); ++dataTypeNdx) { - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.isExtensionSupported(getDataTypeExtension(s_samplerTypes[dataTypeNdx]))) + if (checkSupport(ctx) || ctx.isExtensionSupported(getDataTypeExtension(s_samplerTypes[dataTypeNdx]))) { ctx.beginSection("Verify sampler data type: " + std::string(getDataTypeName(s_samplerTypes[dataTypeNdx]))); const std::string shaderSource(genShaderSourceTextureSize_sampler(ctx, s_shaders[shaderNdx], s_samplerTypes[dataTypeNdx], glu::TYPE_INT)); @@ -1719,7 +1726,7 @@ void texture_size_invalid_lod (NegativeTestContext& ctx) ctx.beginSection("Verify shader: " + std::string(getShaderTypeName(s_shaders[shaderNdx]))); for (int dataTypeNdx = 0; dataTypeNdx < DE_LENGTH_OF_ARRAY(s_samplerTypes); ++dataTypeNdx) { - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.isExtensionSupported(getDataTypeExtension(s_samplerTypes[dataTypeNdx]))) + if (checkSupport(ctx) || ctx.isExtensionSupported(getDataTypeExtension(s_samplerTypes[dataTypeNdx]))) { ctx.beginSection("Verify sampler/lod data type" + std::string(getDataTypeName(s_samplerTypes[dataTypeNdx]))); for (int dataTypeNdx2 = 0; dataTypeNdx2 < DE_LENGTH_OF_ARRAY(s_nonScalarIntTypes); ++dataTypeNdx2) @@ -2194,7 +2201,7 @@ void texture_invalid_p (NegativeTestContext& ctx) } // SAMPLER_CUBE_ARRAY - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.isExtensionSupported(getDataTypeExtension(glu::TYPE_SAMPLER_CUBE_ARRAY))) + if (checkSupport(ctx) || ctx.isExtensionSupported(getDataTypeExtension(glu::TYPE_SAMPLER_CUBE_ARRAY))) { if (s_floatTypes[dataTypeNdx] != glu::TYPE_FLOAT_VEC4) { @@ -2274,7 +2281,7 @@ void texture_invalid_p (NegativeTestContext& ctx) } // SAMPLER_CUBE_ARRAY_SHADOW - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.isExtensionSupported(getDataTypeExtension(glu::TYPE_SAMPLER_CUBE_ARRAY_SHADOW))) + if (checkSupport(ctx) || ctx.isExtensionSupported(getDataTypeExtension(glu::TYPE_SAMPLER_CUBE_ARRAY_SHADOW))) { if (s_floatTypes[dataTypeNdx] != glu::TYPE_FLOAT_VEC4) { @@ -2499,7 +2506,7 @@ void texture_invalid_bias_or_compare (NegativeTestContext& ctx) } // SAMPLER_CUBE_ARRAY - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.isExtensionSupported(getDataTypeExtension(glu::TYPE_SAMPLER_CUBE_ARRAY))) + if (checkSupport(ctx) || ctx.isExtensionSupported(getDataTypeExtension(glu::TYPE_SAMPLER_CUBE_ARRAY))) { if (s_floatTypes[dataTypeNdx] != glu::TYPE_FLOAT) { @@ -2543,7 +2550,7 @@ void texture_invalid_bias_or_compare (NegativeTestContext& ctx) } // SAMPLER_CUBE_ARRAY_SHADOW - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.isExtensionSupported(getDataTypeExtension(glu::TYPE_SAMPLER_CUBE_ARRAY_SHADOW))) + if (checkSupport(ctx) || ctx.isExtensionSupported(getDataTypeExtension(glu::TYPE_SAMPLER_CUBE_ARRAY_SHADOW))) { if (s_floatTypes[dataTypeNdx] != glu::TYPE_FLOAT) { @@ -2591,7 +2598,7 @@ void texture_lod_invalid_p (NegativeTestContext& ctx) DE_ASSERT(DE_LENGTH_OF_ARRAY(s_floatTypes) == DE_LENGTH_OF_ARRAY(s_intTypes)); DE_ASSERT(DE_LENGTH_OF_ARRAY(s_floatTypes) == DE_LENGTH_OF_ARRAY(s_uintTypes)); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.isExtensionSupported(getDataTypeExtension(glu::TYPE_SAMPLER_CUBE_ARRAY))) + if (checkSupport(ctx) || ctx.isExtensionSupported(getDataTypeExtension(glu::TYPE_SAMPLER_CUBE_ARRAY))) { ctx.beginSection("textureLod: Invalid P type."); for (int shaderNdx = 0; shaderNdx < DE_LENGTH_OF_ARRAY(s_shaders); ++shaderNdx) @@ -2653,7 +2660,7 @@ void texture_lod_invalid_lod (NegativeTestContext& ctx) DE_ASSERT(DE_LENGTH_OF_ARRAY(s_floatTypes) == DE_LENGTH_OF_ARRAY(s_intTypes)); DE_ASSERT(DE_LENGTH_OF_ARRAY(s_floatTypes) == DE_LENGTH_OF_ARRAY(s_uintTypes)); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.isExtensionSupported(getDataTypeExtension(glu::TYPE_SAMPLER_CUBE_ARRAY))) + if (checkSupport(ctx) || ctx.isExtensionSupported(getDataTypeExtension(glu::TYPE_SAMPLER_CUBE_ARRAY))) { ctx.beginSection("textureLod: Invalid lod type."); for (int shaderNdx = 0; shaderNdx < DE_LENGTH_OF_ARRAY(s_shaders); ++shaderNdx) @@ -2759,7 +2766,7 @@ void texel_fetch_invalid_p (NegativeTestContext& ctx) DE_ASSERT(DE_LENGTH_OF_ARRAY(s_floatTypes) == DE_LENGTH_OF_ARRAY(s_intTypes)); DE_ASSERT(DE_LENGTH_OF_ARRAY(s_floatTypes) == DE_LENGTH_OF_ARRAY(s_uintTypes)); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.isExtensionSupported(getDataTypeExtension(glu::TYPE_SAMPLER_CUBE_ARRAY))) + if (checkSupport(ctx) || ctx.isExtensionSupported(getDataTypeExtension(glu::TYPE_SAMPLER_CUBE_ARRAY))) { ctx.beginSection("texelFetch: Invalid P type."); for (int shaderNdx = 0; shaderNdx < DE_LENGTH_OF_ARRAY(s_shaders); ++shaderNdx) @@ -2908,7 +2915,7 @@ void texel_fetch_invalid_sample (NegativeTestContext& ctx) DE_ASSERT(DE_LENGTH_OF_ARRAY(s_floatTypes) == DE_LENGTH_OF_ARRAY(s_intTypes)); DE_ASSERT(DE_LENGTH_OF_ARRAY(s_floatTypes) == DE_LENGTH_OF_ARRAY(s_uintTypes)); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.isExtensionSupported(getDataTypeExtension(glu::TYPE_SAMPLER_CUBE_ARRAY))) + if (checkSupport(ctx) || ctx.isExtensionSupported(getDataTypeExtension(glu::TYPE_SAMPLER_CUBE_ARRAY))) { ctx.beginSection("texelFetch: Invalid sample type."); for (int shaderNdx = 0; shaderNdx < DE_LENGTH_OF_ARRAY(s_shaders); ++shaderNdx) @@ -3102,7 +3109,8 @@ std::string genShaderSourceTextureGrad (NegativeTestContext& ctx, glu::ShaderTyp void texture_grad (NegativeTestContext& ctx) { - TCU_CHECK_AND_THROW(NotSupportedError, ctx.isExtensionSupported("GL_EXT_texture_cube_map_array") || contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "Test requires support for GL_EXT_texture_cube_map_array or version 3.2."); + TCU_CHECK_AND_THROW(NotSupportedError, ctx.isExtensionSupported("GL_EXT_texture_cube_map_array") || checkSupport(ctx), + "Test requires support for GL_EXT_texture_cube_map_array or version 3.2."); ctx.beginSection("textureGrad."); for (int shaderNdx = 0; shaderNdx < DE_LENGTH_OF_ARRAY(s_shaders); ++shaderNdx) @@ -3449,7 +3457,7 @@ void texture_gather_sampler_cube_array (NegativeTestContext& ctx) { TCU_CHECK_AND_THROW( NotSupportedError, - contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.isExtensionSupported("GL_EXT_texture_cube_map_array"), + checkSupport(ctx) || ctx.isExtensionSupported("GL_EXT_texture_cube_map_array"), "Test requires extension GL_EXT_texture_cube_map_array or context version 3.2 or higher."); ctx.beginSection("textureGrad - samplerCubeArray"); @@ -3508,7 +3516,7 @@ void texture_gather_sampler_cube_array_shadow (NegativeTestContext& ctx) { TCU_CHECK_AND_THROW( NotSupportedError, - contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.isExtensionSupported("GL_EXT_texture_cube_map_array"), + checkSupport(ctx) || ctx.isExtensionSupported("GL_EXT_texture_cube_map_array"), "Test requires extension GL_EXT_texture_cube_map_array or context version 3.2 or higher."); ctx.beginSection("textureGrad - samplerCubeArrayShadow"); @@ -4038,12 +4046,14 @@ std::string genShaderSourceInterpolateAt (NegativeTestContext& ctx, glu::ShaderT { DE_ASSERT(function >= SHADER_FUNCTION_INTERPOLATED_AT_CENTROID && function <= SHADER_FUNCTION_INTERPOLATED_AT_OFFSET); - const bool supportsES32 = contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); - std::ostringstream source; + auto ctxType = ctx.getRenderContext().getType(); + const bool isES32orGL45 = glu::contextSupports(ctxType, glu::ApiType::es(3, 2)) || + glu::contextSupports(ctxType, glu::ApiType::core(4, 5)); - source << (supportsES32 ? glu::getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : glu::getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES)) << "\n" + std::ostringstream source; + source << (isES32orGL45 ? glu::getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : glu::getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES)) << "\n" << getShaderInitialization(ctx, shaderType) - << (supportsES32 ? "" : getShaderExtensionDeclaration("GL_OES_shader_multisample_interpolation")) + << (isES32orGL45 ? "" : getShaderExtensionDeclaration("GL_OES_shader_multisample_interpolation")) << declareShaderInput(interpolantDataType, "interpolant") << "void main()\n" << "{\n"; @@ -4083,7 +4093,7 @@ std::string genShaderSourceInterpolateAt (NegativeTestContext& ctx, glu::ShaderT void interpolate_at_centroid (NegativeTestContext& ctx) { TCU_CHECK_AND_THROW(NotSupportedError, - contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.isExtensionSupported("GL_OES_shader_multisample_interpolation"), + checkSupport(ctx) || ctx.isExtensionSupported("GL_OES_shader_multisample_interpolation"), "This test requires a context version 3.2 or higher."); ctx.beginSection("interpolateAtCentroid"); @@ -4125,7 +4135,7 @@ void interpolate_at_centroid (NegativeTestContext& ctx) void interpolate_at_sample (NegativeTestContext& ctx) { TCU_CHECK_AND_THROW(NotSupportedError, - contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.isExtensionSupported("GL_OES_shader_multisample_interpolation"), + checkSupport(ctx) || ctx.isExtensionSupported("GL_OES_shader_multisample_interpolation"), "This test requires a context version 3.2 or higher."); ctx.beginSection("interpolateAtSample"); @@ -4185,7 +4195,7 @@ void interpolate_at_sample (NegativeTestContext& ctx) void interpolate_at_offset (NegativeTestContext& ctx) { TCU_CHECK_AND_THROW(NotSupportedError, - contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.isExtensionSupported("GL_OES_shader_multisample_interpolation"), + checkSupport(ctx) || ctx.isExtensionSupported("GL_OES_shader_multisample_interpolation"), "This test requires a context version 3.2 or higher."); ctx.beginSection("interpolateAtOffset"); @@ -4287,7 +4297,7 @@ std::string genShaderSourceTextureGatherOffsets (NegativeTestContext& ctx, glu:: void texture_gather_offsets (NegativeTestContext& ctx) { TCU_CHECK_AND_THROW(NotSupportedError, - contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.isExtensionSupported("GL_EXT_gpu_shader5"), + checkSupport(ctx) || ctx.isExtensionSupported("GL_EXT_gpu_shader5"), "This test requires a context version 3.2 or higher."); const struct TextureGatherOffsetsTestSpec testSpecs[] = @@ -4363,7 +4373,7 @@ std::string genShaderSourceFma (NegativeTestContext& ctx, glu::ShaderType shader void fma (NegativeTestContext& ctx) { TCU_CHECK_AND_THROW(NotSupportedError, - contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.isExtensionSupported("GL_EXT_gpu_shader5"), + checkSupport(ctx) || ctx.isExtensionSupported("GL_EXT_gpu_shader5"), "This test requires a context version 3.2 or higher."); ctx.beginSection("fma"); diff --git a/modules/gles31/functional/es31fNegativeStateApiTests.cpp b/modules/gles31/functional/es31fNegativeStateApiTests.cpp index 43f41d8..284bf45 100644 --- a/modules/gles31/functional/es31fNegativeStateApiTests.cpp +++ b/modules/gles31/functional/es31fNegativeStateApiTests.cpp @@ -68,6 +68,35 @@ static const char* uniformTestFragSource = "${GLSL_VERSION_DECL}\n" " fragColor = vec4(vec4(fUnif_ivec4) + vec4(fUnif_uvec4));\n" "}\n\0"; +// Helper class that enables tests to be executed on GL4.5 context +// and removes code redundancy in each test that requires it. +class VAOHelper +{ +public: + VAOHelper(NegativeTestContext& ctx) + : m_vao(0) + , m_ctx(ctx) + { + // tests need vao only for GL4.5 context + if (glu::isContextTypeES(ctx.getRenderContext().getType())) + return; + + m_ctx.glGenVertexArrays(1, &m_vao); + m_ctx.glBindVertexArray(m_vao); + } + + ~VAOHelper() + { + if (m_vao) + m_ctx.glDeleteVertexArrays(1, &m_vao); + } + +private: + GLuint m_vao; + NegativeTestContext& m_ctx; +}; + + static std::string getVtxFragVersionSources (const std::string source, NegativeTestContext& ctx) { const bool supportsES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); @@ -88,10 +117,16 @@ void enable (NegativeTestContext& ctx) ctx.endSection(); } +static bool checkSupport(NegativeTestContext& ctx) +{ + return contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || + contextSupports(ctx.getRenderContext().getType(), glu::ApiType::core(4, 5)); +} + // Enabling & disabling states void enablei (NegativeTestContext& ctx) { - TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a higher context version."); + TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a higher context version."); ctx.beginSection("GL_INVALID_ENUM is generated if cap is not one of the allowed values."); ctx.glEnablei(-1, -1); @@ -114,7 +149,7 @@ void disable (NegativeTestContext& ctx) void disablei (NegativeTestContext& ctx) { - TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a higher context version."); + TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a higher context version."); ctx.beginSection("GL_INVALID_ENUM is generated if cap is not one of the allowed values."); ctx.glDisablei(-1,-1); @@ -476,7 +511,7 @@ void get_tex_parameteriv (NegativeTestContext& ctx) void get_tex_parameteriiv (NegativeTestContext& ctx) { - TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a higher context version."); + TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a higher context version."); GLint params[1] = { 0 }; @@ -492,7 +527,7 @@ void get_tex_parameteriiv (NegativeTestContext& ctx) void get_tex_parameteriuiv (NegativeTestContext& ctx) { - TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a higher context version."); + TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a higher context version."); GLuint params[1] = { 0 }; @@ -549,7 +584,7 @@ void get_uniformfv (NegativeTestContext& ctx) void get_nuniformfv (NegativeTestContext& ctx) { - TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a higher context version."); + TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a higher context version."); glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx))); GLint unif = ctx.glGetUniformLocation(program.getProgram(), "vUnif_vec4"); @@ -639,7 +674,7 @@ void get_uniformiv (NegativeTestContext& ctx) void get_nuniformiv (NegativeTestContext& ctx) { - TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a higher context version."); + TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a higher context version."); glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx))); GLint unif = ctx.glGetUniformLocation(program.getProgram(), "fUnif_ivec4"); @@ -729,7 +764,7 @@ void get_uniformuiv (NegativeTestContext& ctx) void get_nuniformuiv (NegativeTestContext& ctx) { - TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a higher context version."); + TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a higher context version."); glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(getVtxFragVersionSources(uniformTestVertSource, ctx), getVtxFragVersionSources(uniformTestFragSource, ctx))); GLint unif = ctx.glGetUniformLocation(program.getProgram(), "fUnif_ivec4"); @@ -997,8 +1032,9 @@ void get_uniform_indices (NegativeTestContext& ctx) void get_vertex_attribfv (NegativeTestContext& ctx) { - GLfloat params = 0.0f; - GLint maxVertexAttribs; + GLfloat params = 0.0f; + GLint maxVertexAttribs; + VAOHelper vao(ctx); ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value."); ctx.glGetVertexAttribfv(0, -1, ¶ms); @@ -1014,8 +1050,9 @@ void get_vertex_attribfv (NegativeTestContext& ctx) void get_vertex_attribiv (NegativeTestContext& ctx) { - GLint params = -1; - GLint maxVertexAttribs; + GLint params = -1; + GLint maxVertexAttribs; + VAOHelper vao(ctx); ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value."); ctx.glGetVertexAttribiv(0, -1, ¶ms); @@ -1031,8 +1068,9 @@ void get_vertex_attribiv (NegativeTestContext& ctx) void get_vertex_attribi_iv (NegativeTestContext& ctx) { - GLint params = -1; - GLint maxVertexAttribs; + GLint params = -1; + GLint maxVertexAttribs; + VAOHelper vao(ctx); ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value."); ctx.glGetVertexAttribIiv(0, -1, ¶ms); @@ -1048,8 +1086,10 @@ void get_vertex_attribi_iv (NegativeTestContext& ctx) void get_vertex_attribi_uiv (NegativeTestContext& ctx) { - GLuint params = (GLuint)-1; - GLint maxVertexAttribs; + GLuint params = (GLuint)-1; + GLint maxVertexAttribs; + VAOHelper vao(ctx); + ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value."); ctx.glGetVertexAttribIuiv(0, -1, ¶ms); @@ -1202,6 +1242,7 @@ void get_framebuffer_attachment_parameteriv (NegativeTestContext& ctx) ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL, ¶ms[0]); // TYPE is GL_RENDERBUFFER ctx.expectError(GL_INVALID_ENUM); ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0); + ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_BACK, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, ¶ms[0]); // TYPE is GL_FRAMEBUFFER_DEFAULT ctx.expectError(GL_INVALID_ENUM); ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo); @@ -1260,7 +1301,8 @@ void get_renderbuffer_parameteriv (NegativeTestContext& ctx) void get_internalformativ (NegativeTestContext& ctx) { - GLint params[16]; + const bool isES = glu::isContextTypeES(ctx.getRenderContext().getType()); + GLint params[16]; deMemset(¶ms[0], 0xcd, sizeof(params)); @@ -1276,23 +1318,26 @@ void get_internalformativ (NegativeTestContext& ctx) ctx.beginSection("GL_INVALID_ENUM is generated if internalformat is not color-, depth-, or stencil-renderable."); - if (!ctx.getContextInfo().isExtensionSupported("GL_EXT_render_snorm")) + if (isES) { - ctx.glGetInternalformativ (GL_RENDERBUFFER, GL_RG8_SNORM, GL_NUM_SAMPLE_COUNTS, 16, ¶ms[0]); + if (!ctx.getContextInfo().isExtensionSupported("GL_EXT_render_snorm")) + { + ctx.glGetInternalformativ (GL_RENDERBUFFER, GL_RG8_SNORM, GL_NUM_SAMPLE_COUNTS, 16, ¶ms[0]); + ctx.expectError (GL_INVALID_ENUM); + } + + ctx.glGetInternalformativ (GL_RENDERBUFFER, GL_COMPRESSED_RGB8_ETC2, GL_NUM_SAMPLE_COUNTS, 16, ¶ms[0]); ctx.expectError (GL_INVALID_ENUM); + ctx.endSection(); } - ctx.glGetInternalformativ (GL_RENDERBUFFER, GL_COMPRESSED_RGB8_ETC2, GL_NUM_SAMPLE_COUNTS, 16, ¶ms[0]); - ctx.expectError (GL_INVALID_ENUM); - ctx.endSection(); - ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_RENDERBUFFER."); ctx.glGetInternalformativ (-1, GL_RGBA8, GL_NUM_SAMPLE_COUNTS, 16, ¶ms[0]); ctx.expectError (GL_INVALID_ENUM); ctx.glGetInternalformativ (GL_FRAMEBUFFER, GL_RGBA8, GL_NUM_SAMPLE_COUNTS, 16, ¶ms[0]); ctx.expectError (GL_INVALID_ENUM); - if (!ctx.getContextInfo().isExtensionSupported("GL_EXT_sparse_texture")) + if (isES && !ctx.getContextInfo().isExtensionSupported("GL_EXT_sparse_texture")) { ctx.glGetInternalformativ (GL_TEXTURE_2D, GL_RGBA8, GL_NUM_SAMPLE_COUNTS, 16, ¶ms[0]); ctx.expectError (GL_INVALID_ENUM); @@ -1399,7 +1444,7 @@ void is_enabled (NegativeTestContext& ctx) void is_enabledi (NegativeTestContext& ctx) { - TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a higher context version."); + TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a higher context version."); ctx.beginSection("GL_INVALID_ENUM is generated if cap is not an accepted value."); ctx.glIsEnabledi(-1, 1); diff --git a/modules/gles31/functional/es31fNegativeTessellationTests.cpp b/modules/gles31/functional/es31fNegativeTessellationTests.cpp index 39c9b32..fcb085e 100644 --- a/modules/gles31/functional/es31fNegativeTessellationTests.cpp +++ b/modules/gles31/functional/es31fNegativeTessellationTests.cpp @@ -45,7 +45,7 @@ using tcu::TestLog; using namespace glw; static const char* vertexShaderSource = "${GLSL_VERSION_STRING}\n" - "\n" + "${GLSL_PER_VERTEX_OUT}\n" "void main (void)\n" "{\n" " gl_Position = vec4(0.0);\n" @@ -62,6 +62,8 @@ static const char* fragmentShaderSource = "${GLSL_VERSION_STRING}\n" static const char* tessControlShaderSource = "${GLSL_VERSION_STRING}\n" "${GLSL_TESS_EXTENSION_STRING}\n" + "${GLSL_PER_VERTEX_IN_ARR}\n" + "${GLSL_PER_VERTEX_OUT_ARR}\n" "layout (vertices=3) out;\n" "\n" "void main()\n" @@ -71,6 +73,8 @@ static const char* tessControlShaderSource = "${GLSL_VERSION_STRING}\n" static const char* tessEvalShaderSource = "${GLSL_VERSION_STRING}\n" "${GLSL_TESS_EXTENSION_STRING}\n" + "${GLSL_PER_VERTEX_IN_ARR}\n" + "${GLSL_PER_VERTEX_OUT}\n" "layout(triangles) in;\n" "\n" "void main()\n" @@ -86,7 +90,8 @@ static void checkExtensionSupport (NegativeTestContext& ctx, const char* extName static void checkTessellationSupport (NegativeTestContext& ctx) { - checkExtensionSupport(ctx, "GL_EXT_tessellation_shader"); + if (glu::isContextTypeES(ctx.getRenderContext().getType())) + checkExtensionSupport(ctx, "GL_EXT_tessellation_shader"); } // Helper for constructing tessellation pipeline sources. @@ -105,14 +110,30 @@ static glu::ProgramSources makeTessPipelineSources (const std::string& vertexSrc return sources; } +map constructSpecializationMap(NegativeTestContext& ctx) +{ + glu::GLSLVersion glslVersion = glu::getContextTypeGLSLVersion(ctx.getRenderContext().getType()); + bool isES31 = (glslVersion == glu::GLSL_VERSION_310_ES); + string ext = isES31 ? "#extension GL_EXT_tessellation_shader : require" : ""; + return + { + { "GLSL_VERSION_STRING", getGLSLVersionDeclaration(glslVersion) }, + { "GLSL_TESS_EXTENSION_STRING", ext }, + { "GLSL_PER_VERTEX_OUT", "" }, // needed for GL4.5 + { "GLSL_PER_VERTEX_IN_ARR", "" }, + { "GLSL_PER_VERTEX_OUT_ARR", "" } + }; +} + // Incomplete active tess shaders void single_tessellation_stage (NegativeTestContext& ctx) { - const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); - const bool requireTES = !ctx.getContextInfo().isExtensionSupported("GL_NV_gpu_shader5"); - map args; - args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES); - args["GLSL_TESS_EXTENSION_STRING"] = isES32 ? "" : "#extension GL_EXT_tessellation_shader : require"; + // this case does not apply to GL4.5 + if (!glu::isContextTypeES(ctx.getRenderContext().getType())) + return; + + const bool requireTES = !ctx.getContextInfo().isExtensionSupported("GL_NV_gpu_shader5"); + map args = constructSpecializationMap(ctx); checkTessellationSupport(ctx); @@ -206,11 +227,7 @@ void invalid_primitive_mode (NegativeTestContext& ctx) { checkTessellationSupport(ctx); - const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); - map args; - args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES); - args["GLSL_TESS_EXTENSION_STRING"] = isES32 ? "" : "#extension GL_EXT_tessellation_shader : require"; - + map args = constructSpecializationMap(ctx); glu::ShaderProgram program(ctx.getRenderContext(), makeTessPipelineSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args), @@ -234,12 +251,8 @@ void tessellation_not_active (NegativeTestContext& ctx) { checkTessellationSupport(ctx); - const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); - const glw::GLenum tessErr = ctx.getContextInfo().isExtensionSupported("GL_NV_gpu_shader5") ? GL_NO_ERROR : GL_INVALID_OPERATION; - map args; - args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES); - args["GLSL_TESS_EXTENSION_STRING"] = isES32 ? "" : "#extension GL_EXT_tessellation_shader : require"; - + const glw::GLenum tessErr = ctx.getContextInfo().isExtensionSupported("GL_NV_gpu_shader5") ? GL_NO_ERROR : GL_INVALID_OPERATION; + map args = constructSpecializationMap(ctx); glu::ShaderProgram program(ctx.getRenderContext(), makeTessPipelineSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args), @@ -248,6 +261,13 @@ void tessellation_not_active (NegativeTestContext& ctx) tcu::TestLog& log = ctx.getLog(); log << program; + GLuint vao = 0; + if (!glu::isContextTypeES(ctx.getRenderContext().getType())) + { + ctx.glGenVertexArrays(1, &vao); + ctx.glBindVertexArray(vao); + } + ctx.glUseProgram(program.getProgram()); ctx.expectError(GL_NO_ERROR); @@ -257,26 +277,35 @@ void tessellation_not_active (NegativeTestContext& ctx) ctx.endSection(); ctx.glUseProgram(0); + + if (vao) + ctx.glDeleteVertexArrays(1, &vao); } void invalid_program_state (NegativeTestContext& ctx) { checkTessellationSupport(ctx); - const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); - map args; - args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES); - args["GLSL_TESS_EXTENSION_STRING"] = isES32 ? "" : "#extension GL_EXT_tessellation_shader : require"; + const glu::RenderContext& rc = ctx.getRenderContext(); + map args = constructSpecializationMap(ctx); + + // for gl4.5 we need to add per vertex sections + if (!glu::isContextTypeES(rc.getType())) + { + args["GLSL_PER_VERTEX_OUT"] = "out gl_PerVertex { vec4 gl_Position; };\n"; + args["GLSL_PER_VERTEX_IN_ARR"] = "in gl_PerVertex { vec4 gl_Position; } gl_in[];\n"; + args["GLSL_PER_VERTEX_OUT_ARR"] = "out gl_PerVertex { vec4 gl_Position; } gl_out[];\n"; + } glu::FragmentSource frgSource(tcu::StringTemplate(fragmentShaderSource).specialize(args)); glu::TessellationControlSource tessCtrlSource(tcu::StringTemplate(tessControlShaderSource).specialize(args)); glu::TessellationEvaluationSource tessEvalSource(tcu::StringTemplate(tessEvalShaderSource).specialize(args)); - glu::ProgramPipeline pipeline(ctx.getRenderContext()); + glu::ProgramPipeline pipeline(rc); - glu::ShaderProgram fragProgram (ctx.getRenderContext(), glu::ProgramSources() << glu::ProgramSeparable(true) << frgSource); - glu::ShaderProgram tessCtrlProgram (ctx.getRenderContext(), glu::ProgramSources() << glu::ProgramSeparable(true) << tessCtrlSource); - glu::ShaderProgram tessEvalProgram (ctx.getRenderContext(), glu::ProgramSources() << glu::ProgramSeparable(true) << tessEvalSource); + glu::ShaderProgram fragProgram (rc, glu::ProgramSources() << glu::ProgramSeparable(true) << frgSource); + glu::ShaderProgram tessCtrlProgram (rc, glu::ProgramSources() << glu::ProgramSeparable(true) << tessCtrlSource); + glu::ShaderProgram tessEvalProgram (rc, glu::ProgramSources() << glu::ProgramSeparable(true) << tessEvalSource); tcu::TestLog& log = ctx.getLog(); log << fragProgram << tessCtrlProgram << tessEvalProgram; @@ -313,11 +342,7 @@ void tessellation_control_invalid_vertex_count (NegativeTestContext& ctx) " gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;\n" "}\n"; - const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); - map args; - args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES); - args["GLSL_TESS_EXTENSION_STRING"] = isES32 ? "" : "#extension GL_EXT_tessellation_shader : require"; - + map args = constructSpecializationMap(ctx); int maxPatchVertices= 0; ctx.beginSection("Output vertex count exceeds GL_MAX_PATCH_VERTICES."); diff --git a/modules/gles31/functional/es31fNegativeTextureApiTests.cpp b/modules/gles31/functional/es31fNegativeTextureApiTests.cpp index c2f9d47..58c513f 100644 --- a/modules/gles31/functional/es31fNegativeTextureApiTests.cpp +++ b/modules/gles31/functional/es31fNegativeTextureApiTests.cpp @@ -75,6 +75,12 @@ static deUint32 cubeFaceToGLFace (tcu::CubeFace face) } } +static bool supportsES32orGL45(NegativeTestContext& ctx) +{ + return contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || + contextSupports(ctx.getRenderContext().getType(), glu::ApiType::core(4, 5)); +} + #define FOR_CUBE_FACES(FACE_GL_VAR, BODY) \ do \ { \ @@ -150,7 +156,7 @@ void bindtexture (NegativeTestContext& ctx) ctx.glBindTexture(GL_TEXTURE_3D, texture[3]); ctx.expectError(GL_INVALID_OPERATION); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) + if (supportsES32orGL45(ctx) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) { ctx.glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, texture[0]); ctx.expectError(GL_INVALID_OPERATION); @@ -401,55 +407,58 @@ void compressedteximage2d_max_width_height (NegativeTestContext& ctx) void compressedteximage2d_invalid_border (NegativeTestContext& ctx) { + bool isES = glu::isContextTypeES(ctx.getRenderContext().getType()); + GLenum error = isES ? GL_INVALID_VALUE : GL_INVALID_OPERATION; + ctx.beginSection("GL_INVALID_VALUE is generated if border is not 0."); ctx.beginSection("GL_TEXTURE_2D target"); ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0); - ctx.expectError(GL_INVALID_VALUE); + ctx.expectError(error); ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0); - ctx.expectError(GL_INVALID_VALUE); + ctx.expectError(error); ctx.endSection(); ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_X target"); ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0); - ctx.expectError(GL_INVALID_VALUE); + ctx.expectError(error); ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0); - ctx.expectError(GL_INVALID_VALUE); + ctx.expectError(error); ctx.endSection(); ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Y target"); ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0); - ctx.expectError(GL_INVALID_VALUE); + ctx.expectError(error); ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0); - ctx.expectError(GL_INVALID_VALUE); + ctx.expectError(error); ctx.endSection(); ctx.beginSection("GL_TEXTURE_CUBE_MAP_POSITIVE_Z target"); ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0); - ctx.expectError(GL_INVALID_VALUE); + ctx.expectError(error); ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0); - ctx.expectError(GL_INVALID_VALUE); + ctx.expectError(error); ctx.endSection(); ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_X target"); ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0); - ctx.expectError(GL_INVALID_VALUE); + ctx.expectError(error); ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0); - ctx.expectError(GL_INVALID_VALUE); + ctx.expectError(error); ctx.endSection(); ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Y target"); ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0); - ctx.expectError(GL_INVALID_VALUE); + ctx.expectError(error); ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0); - ctx.expectError(GL_INVALID_VALUE); + ctx.expectError(error); ctx.endSection(); ctx.beginSection("GL_TEXTURE_CUBE_MAP_NEGATIVE_Z target"); ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 1, 0, 0); - ctx.expectError(GL_INVALID_VALUE); + ctx.expectError(error); ctx.glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, -1, 0, 0); - ctx.expectError(GL_INVALID_VALUE); + ctx.expectError(error); ctx.endSection(); ctx.endSection(); @@ -480,7 +489,7 @@ void compressedteximage2d_invalid_size (NegativeTestContext& ctx) ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, 1, 1, 0, divRoundUp(1, 4) * divRoundUp(1, 4) * 16 - 1, 0); ctx.expectError(GL_INVALID_VALUE); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2))) + if (supportsES32orGL45(ctx)) { ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_ASTC_4x4, 1, 1, 0, divRoundUp(1, 4) * divRoundUp(1, 4) * 16 - 1, 0); ctx.expectError(GL_INVALID_VALUE); @@ -964,6 +973,9 @@ void copytexsubimage2d_read_buffer_is_none (NegativeTestContext& ctx) void copytexsubimage2d_texture_internalformat (NegativeTestContext& ctx) { + if (!glu::isContextTypeES(ctx.getRenderContext().getType())) + return; + GLuint texture = 0x1234; ctx.glGenTextures (1, &texture); ctx.glBindTexture (GL_TEXTURE_2D, texture); @@ -1178,29 +1190,32 @@ void generatemipmap (NegativeTestContext& ctx) ctx.expectError(GL_INVALID_OPERATION); ctx.endSection(); - ctx.beginSection("GL_INVALID_OPERATION is generated if the zero level array is stored in a compressed internal format."); - ctx.glBindTexture(GL_TEXTURE_2D, texture[1]); - ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0); - ctx.glGenerateMipmap(GL_TEXTURE_2D); - ctx.expectError(GL_INVALID_OPERATION); - ctx.endSection(); - - ctx.beginSection("GL_INVALID_OPERATION is generated if the level base array was not specified with an unsized internal format or a sized internal format that is both color-renderable and texture-filterable."); - ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8_SNORM, 0, 0, 0, GL_RGB, GL_BYTE, 0); - ctx.glGenerateMipmap(GL_TEXTURE_2D); - ctx.expectError(GL_INVALID_OPERATION); - ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_R8I, 0, 0, 0, GL_RED_INTEGER, GL_BYTE, 0); - ctx.glGenerateMipmap(GL_TEXTURE_2D); - ctx.expectError(GL_INVALID_OPERATION); - - if (!(ctx.getContextInfo().isExtensionSupported("GL_EXT_color_buffer_float") && ctx.getContextInfo().isExtensionSupported("GL_OES_texture_float_linear"))) + if (glu::isContextTypeES(ctx.getRenderContext().getType())) { - ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, 0, 0, 0, GL_RGBA, GL_FLOAT, 0); + ctx.beginSection("GL_INVALID_OPERATION is generated if the zero level array is stored in a compressed internal format."); + ctx.glBindTexture(GL_TEXTURE_2D, texture[1]); + ctx.glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 0, 0); ctx.glGenerateMipmap(GL_TEXTURE_2D); ctx.expectError(GL_INVALID_OPERATION); - } + ctx.endSection(); - ctx.endSection(); + ctx.beginSection("GL_INVALID_OPERATION is generated if the level base array was not specified with an unsized internal format or a sized internal format that is both color-renderable and texture-filterable."); + ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8_SNORM, 0, 0, 0, GL_RGB, GL_BYTE, 0); + ctx.glGenerateMipmap(GL_TEXTURE_2D); + ctx.expectError(GL_INVALID_OPERATION); + ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_R8I, 0, 0, 0, GL_RED_INTEGER, GL_BYTE, 0); + ctx.glGenerateMipmap(GL_TEXTURE_2D); + ctx.expectError(GL_INVALID_OPERATION); + + if (!(ctx.getContextInfo().isExtensionSupported("GL_EXT_color_buffer_float") && ctx.getContextInfo().isExtensionSupported("GL_OES_texture_float_linear"))) + { + ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, 0, 0, 0, GL_RGBA, GL_FLOAT, 0); + ctx.glGenerateMipmap(GL_TEXTURE_2D); + ctx.expectError(GL_INVALID_OPERATION); + } + + ctx.endSection(); + } ctx.glDeleteTextures(2, texture); } @@ -1267,16 +1282,19 @@ void teximage2d (NegativeTestContext& ctx) ctx.endSection(); ctx.beginSection("GL_INVALID_OPERATION is generated if the combination of internalFormat, format and type is invalid."); - ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); - ctx.expectError(GL_INVALID_OPERATION); ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGB, GL_UNSIGNED_SHORT_4_4_4_4, 0); ctx.expectError(GL_INVALID_OPERATION); ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB5_A1, 1, 1, 0, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, 0); ctx.expectError(GL_INVALID_OPERATION); ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB10_A2, 1, 1, 0, GL_RGB, GL_UNSIGNED_INT_2_10_10_10_REV, 0); ctx.expectError(GL_INVALID_OPERATION); - ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32UI, 1, 1, 0, GL_RGBA_INTEGER, GL_INT, 0); - ctx.expectError(GL_INVALID_OPERATION); + if (glu::isContextTypeES(ctx.getRenderContext().getType())) + { + ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); + ctx.expectError(GL_INVALID_OPERATION); + ctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32UI, 1, 1, 0, GL_RGBA_INTEGER, GL_INT, 0); + ctx.expectError(GL_INVALID_OPERATION); + } ctx.endSection(); } @@ -1584,8 +1602,11 @@ void texsubimage2d (NegativeTestContext& ctx) ctx.expectError(GL_INVALID_OPERATION); ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGBA_INTEGER, GL_UNSIGNED_INT, 0); ctx.expectError(GL_INVALID_OPERATION); - ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGB, GL_FLOAT, 0); - ctx.expectError(GL_INVALID_OPERATION); + if (glu::isContextTypeES(ctx.getRenderContext().getType())) + { + ctx.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_RGB, GL_FLOAT, 0); + ctx.expectError(GL_INVALID_OPERATION); + } ctx.endSection(); ctx.glDeleteTextures (1, &texture); @@ -1800,7 +1821,7 @@ void texparameteri (NegativeTestContext& ctx) ctx.expectError(GL_INVALID_VALUE); ctx.endSection(); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2))) + if (supportsES32orGL45(ctx)) { ctx.beginSection("GL_INVALID_ENUM is generated if pname is a non-scalar parameter."); ctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, 0); @@ -1830,7 +1851,7 @@ void texparameteri (NegativeTestContext& ctx) ctx.glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_COMPARE_FUNC, textureMode); ctx.expectError(GL_INVALID_ENUM); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array")) + if (supportsES32orGL45(ctx) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array")) { ctx.glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_BORDER_COLOR, textureMode); ctx.expectError(GL_INVALID_ENUM); @@ -1859,7 +1880,7 @@ void texparameteri (NegativeTestContext& ctx) ctx.glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_BASE_LEVEL, 1); ctx.expectError(GL_INVALID_OPERATION); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array")) + if (supportsES32orGL45(ctx) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array")) { ctx.glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_BASE_LEVEL, 1); ctx.expectError(GL_INVALID_OPERATION); @@ -1921,7 +1942,7 @@ void texparameterf (NegativeTestContext& ctx) ctx.expectError(GL_INVALID_VALUE); ctx.endSection(); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2))) + if (supportsES32orGL45(ctx)) { ctx.beginSection("GL_INVALID_ENUM is generated if pname is a non-scalar parameter."); ctx.glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, 0.0f); @@ -1951,7 +1972,7 @@ void texparameterf (NegativeTestContext& ctx) ctx.glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_COMPARE_FUNC, textureMode); ctx.expectError(GL_INVALID_ENUM); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array")) + if (supportsES32orGL45(ctx) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array")) { ctx.glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_BORDER_COLOR, textureMode); ctx.expectError(GL_INVALID_ENUM); @@ -1980,7 +2001,7 @@ void texparameterf (NegativeTestContext& ctx) ctx.glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_BASE_LEVEL, 1.0f); ctx.expectError(GL_INVALID_OPERATION); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array")) + if (supportsES32orGL45(ctx) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array")) { ctx.glTexParameterf(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_BASE_LEVEL, 1.0f); ctx.expectError(GL_INVALID_OPERATION); @@ -2066,7 +2087,7 @@ void texparameteriv (NegativeTestContext& ctx) ctx.glTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_COMPARE_FUNC, ¶ms[0]); ctx.expectError(GL_INVALID_ENUM); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array")) + if (supportsES32orGL45(ctx) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array")) { ctx.glTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_BORDER_COLOR, ¶ms[0]); ctx.expectError(GL_INVALID_ENUM); @@ -2096,7 +2117,7 @@ void texparameteriv (NegativeTestContext& ctx) ctx.glTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_BASE_LEVEL, ¶ms[0]); ctx.expectError(GL_INVALID_OPERATION); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array")) + if (supportsES32orGL45(ctx) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array")) { params[0] = 1; ctx.glTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_BASE_LEVEL, ¶ms[0]); @@ -2183,7 +2204,7 @@ void texparameterfv (NegativeTestContext& ctx) ctx.glTexParameterfv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_COMPARE_FUNC, ¶ms[0]); ctx.expectError(GL_INVALID_ENUM); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array")) + if (supportsES32orGL45(ctx) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array")) { ctx.glTexParameterfv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_BORDER_COLOR, ¶ms[0]); ctx.expectError(GL_INVALID_ENUM); @@ -2213,7 +2234,7 @@ void texparameterfv (NegativeTestContext& ctx) ctx.glTexParameterfv(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_BASE_LEVEL, ¶ms[0]); ctx.expectError(GL_INVALID_OPERATION); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array")) + if (supportsES32orGL45(ctx) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array")) { params[0] = 1.0f; ctx.glTexParameterfv(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_BASE_LEVEL, ¶ms[0]); @@ -2228,7 +2249,7 @@ void texparameterfv (NegativeTestContext& ctx) void texparameterIiv (NegativeTestContext& ctx) { - if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2))) + if (!supportsES32orGL45(ctx)) throw tcu::NotSupportedError("glTexParameterIiv is not supported.", DE_NULL, __FILE__, __LINE__); GLint textureMode[] = { GL_DEPTH_COMPONENT, GL_STENCIL_INDEX }; @@ -2338,7 +2359,7 @@ void texparameterIiv (NegativeTestContext& ctx) void texparameterIuiv (NegativeTestContext& ctx) { - if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2))) + if (!supportsES32orGL45(ctx)) throw tcu::NotSupportedError("glTexParameterIuiv is not supported.", DE_NULL, __FILE__, __LINE__); GLuint textureMode[] = { GL_DEPTH_COMPONENT, GL_STENCIL_INDEX }; @@ -2682,19 +2703,23 @@ void teximage3d (NegativeTestContext& ctx) ctx.endSection(); ctx.beginSection("GL_INVALID_OPERATION is generated if the combination of internalFormat, format and type is invalid."); - ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB, 1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); - ctx.expectError(GL_INVALID_OPERATION); ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, 1, 1, 1, 0, GL_RGB, GL_UNSIGNED_SHORT_4_4_4_4, 0); ctx.expectError(GL_INVALID_OPERATION); ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB5_A1, 1, 1, 1, 0, GL_RGB, GL_UNSIGNED_SHORT_5_5_5_1, 0); ctx.expectError(GL_INVALID_OPERATION); ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB10_A2, 1, 1, 1, 0, GL_RGB, GL_UNSIGNED_INT_2_10_10_10_REV, 0); ctx.expectError(GL_INVALID_OPERATION); - ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA32UI, 1, 1, 1, 0, GL_RGBA_INTEGER, GL_INT, 0); - ctx.expectError(GL_INVALID_OPERATION); + + if (glu::isContextTypeES(ctx.getRenderContext().getType())) + { + ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB, 1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); + ctx.expectError(GL_INVALID_OPERATION); + ctx.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA32UI, 1, 1, 1, 0, GL_RGBA_INTEGER, GL_INT, 0); + ctx.expectError(GL_INVALID_OPERATION); + } ctx.endSection(); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) + if (supportsES32orGL45(ctx) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) { ctx.beginSection("GL_INVALID_VALUE is generated if target is GL_TEXTURE_CUBE_MAP_ARRAY and width and height are not equal."); ctx.glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGBA, 2, 1, 6, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); @@ -2716,7 +2741,7 @@ void teximage3d_neg_level (NegativeTestContext& ctx) ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, -1, GL_RGB, 1, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); ctx.expectError(GL_INVALID_VALUE); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) + if (supportsES32orGL45(ctx) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) { ctx.glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, -1, GL_RGBA, 1, 1, 6, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); ctx.expectError(GL_INVALID_VALUE); @@ -2762,7 +2787,7 @@ void teximage3d_neg_width_height_depth (NegativeTestContext& ctx) ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, -1, -1, -1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); ctx.expectError(GL_INVALID_VALUE); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) + if (supportsES32orGL45(ctx) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) { ctx.glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGBA, -1, 1, 6, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); ctx.expectError(GL_INVALID_VALUE); @@ -2817,7 +2842,7 @@ void teximage3d_invalid_border (NegativeTestContext& ctx) ctx.glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGB, 1, 1, 1, 2, GL_RGB, GL_UNSIGNED_BYTE, 0); ctx.expectError(GL_INVALID_VALUE); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) + if (supportsES32orGL45(ctx) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) { ctx.glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 1, GL_RGBA, 1, 1, 6, -1, GL_RGBA, GL_UNSIGNED_BYTE, 0); ctx.expectError(GL_INVALID_VALUE); @@ -2903,8 +2928,11 @@ void texsubimage3d (NegativeTestContext& ctx) ctx.expectError(GL_INVALID_OPERATION); ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGBA_INTEGER, GL_UNSIGNED_INT, 0); ctx.expectError(GL_INVALID_OPERATION); - ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGB, GL_FLOAT, 0); - ctx.expectError(GL_INVALID_OPERATION); + if (glu::isContextTypeES(ctx.getRenderContext().getType())) + { + ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 4, 4, 4, GL_RGB, GL_FLOAT, 0); + ctx.expectError(GL_INVALID_OPERATION); + } ctx.endSection(); ctx.glDeleteTextures (1, &texture); @@ -2926,7 +2954,7 @@ void texsubimage3d_neg_level (NegativeTestContext& ctx) ctx.glTexSubImage3D(GL_TEXTURE_2D_ARRAY, -1, 0, 0, 0, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); ctx.expectError(GL_INVALID_VALUE); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) + if (supportsES32orGL45(ctx) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) { ctx.glBindTexture (GL_TEXTURE_CUBE_MAP_ARRAY, textures[2]); ctx.glTexImage3D (GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGBA, 4, 4, 6, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); @@ -2995,7 +3023,7 @@ void texsubimage3d_neg_offset (NegativeTestContext& ctx) ctx.glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, -1, -1, -1, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); ctx.expectError(GL_INVALID_VALUE); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) + if (supportsES32orGL45(ctx) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) { ctx.glBindTexture (GL_TEXTURE_CUBE_MAP_ARRAY, textures[2]); ctx.glTexImage3D (GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGBA, 4, 4, 6, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); @@ -3054,7 +3082,7 @@ void texsubimage3d_neg_width_height (NegativeTestContext& ctx) ctx.glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, -1, -1, -1, GL_RGBA, GL_UNSIGNED_BYTE, 0); ctx.expectError(GL_INVALID_VALUE); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) + if (supportsES32orGL45(ctx) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) { ctx.glTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, 0, 0, 0, -1, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); ctx.expectError(GL_INVALID_VALUE); @@ -3146,7 +3174,7 @@ void copytexsubimage3d_neg_level (NegativeTestContext& ctx) ctx.glCopyTexSubImage3D(GL_TEXTURE_2D_ARRAY, -1, 0, 0, 0, 0, 0, 4, 4); ctx.expectError(GL_INVALID_VALUE); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) + if (supportsES32orGL45(ctx) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) { ctx.glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, textures[2]); ctx.glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGBA, 4, 4, 6, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); @@ -3184,7 +3212,7 @@ void copytexsubimage3d_max_level (NegativeTestContext& ctx) ctx.expectError(GL_INVALID_VALUE); ctx.endSection(); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) + if (supportsES32orGL45(ctx) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) { ctx.glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, textures[2]); ctx.glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGBA, 4, 4, 6, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); @@ -3350,20 +3378,25 @@ void compressedteximage3d_max_width_height_depth (NegativeTestContext& ctx) ctx.expectError(GL_INVALID_VALUE); ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, maxTextureSize, 0, 0, 0, 0); ctx.expectError(GL_INVALID_VALUE); - ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, maxTextureLayers, 0, 0, 0); - ctx.expectError(GL_INVALID_VALUE); ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, maxTextureSize, maxTextureSize, maxTextureLayers, 0, 0, 0); ctx.expectError(GL_INVALID_VALUE); + if (glu::isContextTypeES(ctx.getRenderContext().getType())) + { + ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, maxTextureLayers, 0, 0, 0); + ctx.expectError(GL_INVALID_VALUE); + } ctx.endSection(); } void compressedteximage3d_invalid_border (NegativeTestContext& ctx) { + bool isES = glu::isContextTypeES(ctx.getRenderContext().getType()); + GLenum error = isES ? GL_INVALID_VALUE : GL_INVALID_OPERATION; ctx.beginSection("GL_INVALID_VALUE is generated if border is not 0."); ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, -1, 0, 0); - ctx.expectError(GL_INVALID_VALUE); + ctx.expectError(error); ctx.glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_COMPRESSED_RGBA8_ETC2_EAC, 0, 0, 0, 1, 0, 0); - ctx.expectError(GL_INVALID_VALUE); + ctx.expectError(error); ctx.endSection(); } @@ -3383,7 +3416,7 @@ void compressedteximage3d_invalid_size (NegativeTestContext& ctx) void compressedteximage3d_invalid_width_height (NegativeTestContext& ctx) { - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) + if (supportsES32orGL45(ctx) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) { const int width = 4; const int height = 6; @@ -3656,7 +3689,7 @@ void texstorage2d (NegativeTestContext& ctx) ctx.glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 0, 0); ctx.expectError(GL_INVALID_VALUE); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2))) + if (supportsES32orGL45(ctx)) { ctx.glBindTexture(GL_TEXTURE_CUBE_MAP, textures[1]); ctx.expectError(GL_NO_ERROR); @@ -3676,14 +3709,14 @@ void texstorage2d_invalid_binding (NegativeTestContext& ctx) { deUint32 textures[] = {0x1234, 0x1234}; deInt32 immutable = 0x1234; - const bool supportsES32 = contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); + const bool isES32orGL45 = supportsES32orGL45(ctx); ctx.beginSection("GL_INVALID_OPERATION is generated if the default texture object is curently bound to target."); ctx.glBindTexture(GL_TEXTURE_2D, 0); ctx.glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 16, 16); ctx.expectError(GL_INVALID_OPERATION); - if (supportsES32) + if (isES32orGL45) { ctx.glBindTexture(GL_TEXTURE_CUBE_MAP, 0); ctx.glTexStorage2D(GL_TEXTURE_CUBE_MAP, 1, GL_RGBA8, 16, 16); @@ -3704,7 +3737,7 @@ void texstorage2d_invalid_binding (NegativeTestContext& ctx) ctx.glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 16, 16); ctx.expectError(GL_INVALID_OPERATION); - if (supportsES32) + if (isES32orGL45) { ctx.glBindTexture(GL_TEXTURE_CUBE_MAP, textures[1]); ctx.glGetTexParameteriv(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_IMMUTABLE_FORMAT, &immutable); @@ -3725,12 +3758,12 @@ void texstorage2d_invalid_levels (NegativeTestContext& ctx) { deUint32 textures[] = {0x1234, 0x1234}; deUint32 log2MaxSize = deLog2Floor32(deMax32(16, 16)) + 1 + 1; - const bool supportsES32 = contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); + const bool isES32orGL45 = supportsES32orGL45(ctx); ctx.glGenTextures(2, textures); ctx.glBindTexture(GL_TEXTURE_2D, textures[0]); - if (supportsES32) + if (isES32orGL45) ctx.glBindTexture(GL_TEXTURE_CUBE_MAP, textures[1]); ctx.expectError(GL_NO_ERROR); @@ -3741,7 +3774,7 @@ void texstorage2d_invalid_levels (NegativeTestContext& ctx) ctx.glTexStorage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 0, 0); ctx.expectError(GL_INVALID_VALUE); - if (supportsES32) + if (isES32orGL45) { ctx.glTexStorage2D(GL_TEXTURE_CUBE_MAP, 0, GL_RGBA8, 16, 16); ctx.expectError(GL_INVALID_VALUE); @@ -3754,7 +3787,7 @@ void texstorage2d_invalid_levels (NegativeTestContext& ctx) ctx.glTexStorage2D(GL_TEXTURE_2D, log2MaxSize, GL_RGBA8, 16, 16); ctx.expectError(GL_INVALID_OPERATION); - if (supportsES32) + if (isES32orGL45) { ctx.glTexStorage2D(GL_TEXTURE_CUBE_MAP, log2MaxSize, GL_RGBA8, 16, 16); ctx.expectError(GL_INVALID_OPERATION); @@ -3800,7 +3833,7 @@ void texstorage3d (NegativeTestContext& ctx) ctx.glTexStorage3D(GL_TEXTURE_3D, 1, GL_RGBA8, 0, 0, 0); ctx.expectError(GL_INVALID_VALUE); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) + if (supportsES32orGL45(ctx) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) { ctx.glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, textures[1]); ctx.expectError(GL_NO_ERROR); @@ -3828,7 +3861,7 @@ void texstorage3d_invalid_binding (NegativeTestContext& ctx) ctx.glTexStorage3D (GL_TEXTURE_3D, 1, GL_RGBA8, 4, 4, 4); ctx.expectError (GL_INVALID_OPERATION); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) + if (supportsES32orGL45(ctx) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) { ctx.glBindTexture (GL_TEXTURE_CUBE_MAP_ARRAY, 0); ctx.glTexStorage3D (GL_TEXTURE_CUBE_MAP_ARRAY, 1, GL_RGBA8, 4, 4, 6); @@ -3849,7 +3882,7 @@ void texstorage3d_invalid_binding (NegativeTestContext& ctx) ctx.glTexStorage3D (GL_TEXTURE_3D, 1, GL_RGBA8, 4, 4, 4); ctx.expectError (GL_INVALID_OPERATION); - if (contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) + if (supportsES32orGL45(ctx) || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) { ctx.glBindTexture (GL_TEXTURE_CUBE_MAP_ARRAY, textures[1]); ctx.glGetTexParameteriv(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_IMMUTABLE_FORMAT, &immutable); @@ -3870,7 +3903,7 @@ void texstorage3d_invalid_levels (NegativeTestContext& ctx) { deUint32 textures[] = {0x1234, 0x1234}; deUint32 log2MaxSize = deLog2Floor32(8) + 1 + 1; - const bool supportsES32 = contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); + const bool isES32orGL45 = supportsES32orGL45(ctx); ctx.glGenTextures(2, textures); ctx.glBindTexture(GL_TEXTURE_3D, textures[0]); @@ -3880,7 +3913,7 @@ void texstorage3d_invalid_levels (NegativeTestContext& ctx) ctx.glTexStorage3D(GL_TEXTURE_3D, 0, GL_RGBA8, 0, 0, 0); ctx.expectError(GL_INVALID_VALUE); - if (supportsES32 || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) + if (isES32orGL45 || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) { ctx.glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, textures[1]); ctx.glTexStorage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGBA8, 4, 4, 6); @@ -3900,7 +3933,7 @@ void texstorage3d_invalid_levels (NegativeTestContext& ctx) ctx.glTexStorage3D (GL_TEXTURE_3D, log2MaxSize, GL_RGBA8, 8, 8, 8); ctx.expectError (GL_INVALID_OPERATION); - if (supportsES32 || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) + if (isES32orGL45 || ctx.getContextInfo().isExtensionSupported("GL_OES_texture_cube_map_array")) { ctx.glTexStorage3D (GL_TEXTURE_CUBE_MAP_ARRAY, log2MaxSize, GL_RGBA8, 2, 2, 6); ctx.expectError (GL_INVALID_OPERATION); @@ -3992,7 +4025,7 @@ void srgb_decode_texparameterfv (NegativeTestContext& ctx) void srgb_decode_texparameterIiv (NegativeTestContext& ctx) { - if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2))) + if (!supportsES32orGL45(ctx)) TCU_THROW(NotSupportedError,"glTexParameterIiv is not supported."); if (!ctx.isExtensionSupported("GL_EXT_texture_sRGB_decode")) @@ -4016,7 +4049,7 @@ void srgb_decode_texparameterIiv (NegativeTestContext& ctx) void srgb_decode_texparameterIuiv (NegativeTestContext& ctx) { - if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2))) + if (!supportsES32orGL45(ctx)) TCU_THROW(NotSupportedError,"glTexParameterIuiv is not supported."); if (!ctx.isExtensionSupported("GL_EXT_texture_sRGB_decode")) diff --git a/modules/gles31/functional/es31fNegativeVertexArrayApiTests.cpp b/modules/gles31/functional/es31fNegativeVertexArrayApiTests.cpp index 977e268..1c49ff5 100644 --- a/modules/gles31/functional/es31fNegativeVertexArrayApiTests.cpp +++ b/modules/gles31/functional/es31fNegativeVertexArrayApiTests.cpp @@ -66,6 +66,36 @@ static const char* geometryShaderSource = "#version 320 es\n" "{\n" "}\n"; +// Helper class that enables tests to be executed on GL4.5 context +// and removes code redundancy in each test that requires it. +class VAOHelper +{ +public: + VAOHelper(NegativeTestContext& ctx, bool isES) + : m_vao(0) + , m_ctx(ctx) + { + // tests need vao only for GL4.5 context + if (isES) + return; + + m_ctx.glGenVertexArrays(1, &m_vao); + m_ctx.glBindVertexArray(m_vao); + m_ctx.glVertexAttribPointer(0, 1, GL_BYTE, GL_TRUE, 0, NULL); + m_ctx.glEnableVertexAttribArray(0); + } + + ~VAOHelper() + { + if (m_vao) + m_ctx.glDeleteVertexArrays(1, &m_vao); + } + +private: + GLuint m_vao; + NegativeTestContext& m_ctx; +}; + void vertex_attribf (NegativeTestContext& ctx) { ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS."); @@ -127,6 +157,13 @@ void vertex_attribi4v (NegativeTestContext& ctx) void vertex_attrib_pointer (NegativeTestContext& ctx) { + GLuint vao = 0; + ctx.glGenVertexArrays(1, &vao); + if (glu::isContextTypeES(ctx.getRenderContext().getType())) + ctx.glBindVertexArray(0); + else + ctx.glBindVertexArray(vao); + ctx.beginSection("GL_INVALID_ENUM is generated if type is not an accepted value."); ctx.glVertexAttribPointer(0, 1, 0, GL_TRUE, 0, 0); ctx.expectError(GL_INVALID_ENUM); @@ -160,9 +197,7 @@ void vertex_attrib_pointer (NegativeTestContext& ctx) ctx.endSection(); ctx.beginSection("GL_INVALID_OPERATION is generated a non-zero vertex array object is bound, zero is bound to the GL_ARRAY_BUFFER buffer object binding point and the pointer argument is not NULL."); - GLuint vao = 0; GLbyte offset = 1; - ctx.glGenVertexArrays(1, &vao); ctx.glBindVertexArray(vao); ctx.glBindBuffer(GL_ARRAY_BUFFER, 0); ctx.expectError(GL_NO_ERROR); @@ -178,6 +213,13 @@ void vertex_attrib_pointer (NegativeTestContext& ctx) void vertex_attrib_i_pointer (NegativeTestContext& ctx) { + GLuint vao = 0; + ctx.glGenVertexArrays(1, &vao); + if (glu::isContextTypeES(ctx.getRenderContext().getType())) + ctx.glBindVertexArray(0); + else + ctx.glBindVertexArray(vao); + ctx.beginSection("GL_INVALID_ENUM is generated if type is not an accepted value."); ctx.glVertexAttribIPointer(0, 1, 0, 0, 0); ctx.expectError(GL_INVALID_ENUM); @@ -204,9 +246,7 @@ void vertex_attrib_i_pointer (NegativeTestContext& ctx) ctx.endSection(); ctx.beginSection("GL_INVALID_OPERATION is generated a non-zero vertex array object is bound, zero is bound to the GL_ARRAY_BUFFER buffer object binding point and the pointer argument is not NULL."); - GLuint vao = 0; GLbyte offset = 1; - ctx.glGenVertexArrays(1, &vao); ctx.glBindVertexArray(vao); ctx.glBindBuffer(GL_ARRAY_BUFFER, 0); ctx.expectError(GL_NO_ERROR); @@ -388,11 +428,13 @@ void vertex_attrib_divisor (NegativeTestContext& ctx) void draw_arrays (NegativeTestContext& ctx) { - const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); + const glu::RenderContext& rc = ctx.getRenderContext(); + const bool isES32 = glu::contextSupports(rc.getType(), glu::ApiType::es(3, 2)); GLuint fbo = 0; map args; args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES); - glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args))); + glu::ShaderProgram program (rc, glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args))); + VAOHelper vao(ctx, glu::isContextTypeES(rc.getType())); ctx.glUseProgram(program.getProgram()); ctx.expectError(GL_NO_ERROR); @@ -422,7 +464,9 @@ void draw_arrays (NegativeTestContext& ctx) void draw_arrays_invalid_program (NegativeTestContext& ctx) { - GLuint fbo = 0; + GLuint fbo = 0; + VAOHelper vao(ctx, glu::isContextTypeES(ctx.getRenderContext().getType())); + ctx.glUseProgram(0); ctx.beginSection("GL_INVALID_ENUM is generated if mode is not an accepted value."); @@ -448,11 +492,13 @@ void draw_arrays_invalid_program (NegativeTestContext& ctx) void draw_arrays_incomplete_primitive (NegativeTestContext& ctx) { - const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); + const glu::RenderContext& rc = ctx.getRenderContext(); + const bool isES32 = glu::contextSupports(rc.getType(), glu::ApiType::es(3, 2)); GLuint fbo = 0; map args; args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES); - glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args))); + glu::ShaderProgram program (rc, glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args))); + VAOHelper vao(ctx, glu::isContextTypeES(rc.getType())); ctx.glUseProgram(program.getProgram()); ctx.expectError(GL_NO_ERROR); @@ -482,14 +528,17 @@ void draw_arrays_incomplete_primitive (NegativeTestContext& ctx) void draw_elements (NegativeTestContext& ctx) { - const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); + const glu::RenderContext& rc = ctx.getRenderContext(); + const bool isES = glu::isContextTypeES(rc.getType()); + const bool isES32 = glu::contextSupports(rc.getType(), glu::ApiType::es(3, 2)); GLuint fbo = 0; GLuint buf = 0; GLuint tfID = 0; GLbyte indices[1] = {0}; map args; args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES); - glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args))); + glu::ShaderProgram program (rc, glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args))); + VAOHelper vao(ctx, isES); ctx.glUseProgram(program.getProgram()); ctx.expectError(GL_NO_ERROR); @@ -521,7 +570,7 @@ void draw_elements (NegativeTestContext& ctx) ctx.glDeleteFramebuffers(1, &fbo); ctx.endSection(); - if (!ctx.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) // GL_EXT_geometry_shader removes error + if (isES && !ctx.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) // GL_EXT_geometry_shader removes error { ctx.beginSection("GL_INVALID_OPERATION is generated if transform feedback is active and not paused."); const char* tfVarying = "gl_Position"; @@ -559,8 +608,9 @@ void draw_elements (NegativeTestContext& ctx) void draw_elements_invalid_program (NegativeTestContext& ctx) { ctx.glUseProgram(0); - GLuint fbo = 0; - GLbyte indices[1] = {0}; + GLuint fbo = 0; + GLbyte indices[1] = {0}; + VAOHelper vao(ctx, glu::isContextTypeES(ctx.getRenderContext().getType())); ctx.beginSection("GL_INVALID_ENUM is generated if mode is not an accepted value."); ctx.glDrawElements(-1, 1, GL_UNSIGNED_BYTE, indices); @@ -592,14 +642,17 @@ void draw_elements_invalid_program (NegativeTestContext& ctx) void draw_elements_incomplete_primitive (NegativeTestContext& ctx) { - const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); + const glu::RenderContext& rc = ctx.getRenderContext(); + bool isES = glu::isContextTypeES(rc.getType()); + const bool isES32 = glu::contextSupports(rc.getType(), glu::ApiType::es(3, 2)); GLuint fbo = 0; GLuint buf = 0; GLuint tfID = 0; GLbyte indices[1] = {0}; map args; args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES); - glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args))); + glu::ShaderProgram program (rc, glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args))); + VAOHelper vao(ctx, isES); ctx.glUseProgram(program.getProgram()); ctx.expectError(GL_NO_ERROR); @@ -631,7 +684,7 @@ void draw_elements_incomplete_primitive (NegativeTestContext& ctx) ctx.glDeleteFramebuffers(1, &fbo); ctx.endSection(); - if (!ctx.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) // GL_EXT_geometry_shader removes error + if (isES && !ctx.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) // GL_EXT_geometry_shader removes error { ctx.beginSection("GL_INVALID_OPERATION is generated if transform feedback is active and not paused."); const char* tfVarying= "gl_Position"; @@ -666,12 +719,19 @@ void draw_elements_incomplete_primitive (NegativeTestContext& ctx) ctx.glUseProgram(0); } +static bool checkSupport(NegativeTestContext& ctx) +{ + return contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) || + contextSupports(ctx.getRenderContext().getType(), glu::ApiType::core(4, 5)); +} + void draw_elements_base_vertex (NegativeTestContext& ctx) { - TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a 3.2 context or higher context version."); + TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a 3.2 context or higher context version."); GLuint fbo = 0; GLuint indices[1] = {0}; + VAOHelper vao(ctx, glu::isContextTypeES(ctx.getRenderContext().getType())); ctx.beginSection("GL_INVALID_ENUM is generated if mode is not an accepted value."); ctx.glDrawElementsBaseVertex(-1, 1, GL_UNSIGNED_INT, indices, 1); @@ -703,7 +763,7 @@ void draw_elements_base_vertex (NegativeTestContext& ctx) void draw_elements_base_vertex_primitive_mode_mismatch (NegativeTestContext& ctx) { - TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a 3.2 context or higher context version."); + TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a 3.2 context or higher context version."); GLuint indices[1] = {0}; map args; @@ -722,11 +782,13 @@ void draw_elements_base_vertex_primitive_mode_mismatch (NegativeTestContext& ctx void draw_arrays_instanced (NegativeTestContext& ctx) { - const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); + const glu::RenderContext& rc = ctx.getRenderContext(); + const bool isES32 = glu::contextSupports(rc.getType(), glu::ApiType::es(3, 2)); GLuint fbo = 0; map args; args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES); glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args))); + VAOHelper vao (ctx, glu::isContextTypeES(rc.getType())); ctx.glUseProgram(program.getProgram()); ctx.expectError(GL_NO_ERROR); @@ -761,7 +823,10 @@ void draw_arrays_instanced (NegativeTestContext& ctx) void draw_arrays_instanced_invalid_program (NegativeTestContext& ctx) { ctx.glUseProgram(0); - GLuint fbo = 0; + + GLuint fbo = 0; + VAOHelper vao (ctx, glu::isContextTypeES(ctx.getRenderContext().getType())); + ctx.glVertexAttribDivisor(0, 1); ctx.expectError(GL_NO_ERROR); @@ -790,11 +855,13 @@ void draw_arrays_instanced_invalid_program (NegativeTestContext& ctx) void draw_arrays_instanced_incomplete_primitive (NegativeTestContext& ctx) { - const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); + const glu::RenderContext& rc = ctx.getRenderContext(); + const bool isES32 = glu::contextSupports(rc.getType(), glu::ApiType::es(3, 2)); GLuint fbo = 0; map args; args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES); - glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args))); + glu::ShaderProgram program (rc, glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args))); + VAOHelper vao(ctx, glu::isContextTypeES(rc.getType())); ctx.glVertexAttribDivisor(0, 1); ctx.expectError(GL_NO_ERROR); @@ -826,14 +893,17 @@ void draw_arrays_instanced_incomplete_primitive (NegativeTestContext& ctx) void draw_elements_instanced (NegativeTestContext& ctx) { - const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); + const glu::RenderContext& rc = ctx.getRenderContext(); + const bool isES = glu::isContextTypeES(rc.getType()); + const bool isES32 = glu::contextSupports(rc.getType(), glu::ApiType::es(3, 2)); GLuint fbo = 0; GLuint buf = 0; GLuint tfID = 0; GLbyte indices[1] = {0}; map args; args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES); - glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args))); + glu::ShaderProgram program (rc, glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args))); + VAOHelper vao(ctx, isES); ctx.glUseProgram(program.getProgram()); ctx.glVertexAttribDivisor(0, 1); @@ -868,7 +938,7 @@ void draw_elements_instanced (NegativeTestContext& ctx) ctx.glDeleteFramebuffers(1, &fbo); ctx.endSection(); - if (!ctx.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) // GL_EXT_geometry_shader removes error + if (isES && !ctx.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) // GL_EXT_geometry_shader removes error { ctx.beginSection("GL_INVALID_OPERATION is generated if transform feedback is active and not paused."); const char* tfVarying = "gl_Position"; @@ -906,8 +976,11 @@ void draw_elements_instanced (NegativeTestContext& ctx) void draw_elements_instanced_invalid_program (NegativeTestContext& ctx) { ctx.glUseProgram(0); + GLuint fbo = 0; GLbyte indices[1] = {0}; + VAOHelper vao(ctx, glu::isContextTypeES(ctx.getRenderContext().getType())); + ctx.glVertexAttribDivisor(0, 1); ctx.expectError(GL_NO_ERROR); @@ -943,14 +1016,17 @@ void draw_elements_instanced_invalid_program (NegativeTestContext& ctx) void draw_elements_instanced_incomplete_primitive (NegativeTestContext& ctx) { - const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); + const glu::RenderContext& rc = ctx.getRenderContext(); + const bool isES = glu::isContextTypeES(rc.getType()); + const bool isES32 = glu::contextSupports(rc.getType(), glu::ApiType::es(3, 2)); GLuint fbo = 0; GLuint buf = 0; GLuint tfID = 0; GLbyte indices[1] = {0}; map args; args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES); - glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args))); + glu::ShaderProgram program (rc, glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args))); + VAOHelper vao(ctx, isES); ctx.glUseProgram(program.getProgram()); ctx.glVertexAttribDivisor(0, 1); @@ -985,7 +1061,7 @@ void draw_elements_instanced_incomplete_primitive (NegativeTestContext& ctx) ctx.glDeleteFramebuffers(1, &fbo); ctx.endSection(); - if (!ctx.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) // GL_EXT_geometry_shader removes error + if (isES && !ctx.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) // GL_EXT_geometry_shader removes error { ctx.beginSection("GL_INVALID_OPERATION is generated if transform feedback is active and not paused."); const char* tfVarying= "gl_Position"; @@ -1022,14 +1098,16 @@ void draw_elements_instanced_incomplete_primitive (NegativeTestContext& ctx) void draw_elements_instanced_base_vertex (NegativeTestContext& ctx) { - TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a 3.2 context or higher context version."); + TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a 3.2 context or higher context version."); - const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); + const glu::RenderContext& rc = ctx.getRenderContext(); + const bool isES32 = glu::contextSupports(rc.getType(), glu::ApiType::es(3, 2)); GLuint fbo = 0; GLbyte indices[1] = {0}; map args; args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES); - glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args))); + glu::ShaderProgram program (rc, glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args))); + VAOHelper vao(ctx, glu::isContextTypeES(rc.getType())); ctx.glUseProgram(program.getProgram()); ctx.glVertexAttribDivisor(0, 1); @@ -1069,7 +1147,7 @@ void draw_elements_instanced_base_vertex (NegativeTestContext& ctx) void draw_elements_instanced_base_vertex_primitive_mode_mismatch (NegativeTestContext& ctx) { - TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a 3.2 context or higher context version."); + TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a 3.2 context or higher context version."); GLuint indices[1] = {0}; map args; @@ -1087,14 +1165,17 @@ void draw_elements_instanced_base_vertex_primitive_mode_mismatch (NegativeTestCo void draw_range_elements (NegativeTestContext& ctx) { - const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); + const glu::RenderContext& rc = ctx.getRenderContext(); + const bool isES = glu::isContextTypeES(rc.getType()); + const bool isES32 = glu::contextSupports(rc.getType(), glu::ApiType::es(3, 2)); GLuint fbo = 0; GLuint buf = 0; GLuint tfID = 0; GLbyte indices[1] = {0}; map args; args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES); - glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args))); + glu::ShaderProgram program (rc, glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args))); + VAOHelper vao(ctx, isES); ctx.glUseProgram(program.getProgram()); ctx.expectError(GL_NO_ERROR); @@ -1131,7 +1212,7 @@ void draw_range_elements (NegativeTestContext& ctx) ctx.glDeleteFramebuffers(1, &fbo); ctx.endSection(); - if (!ctx.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) // GL_EXT_geometry_shader removes error + if (isES && !ctx.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) // GL_EXT_geometry_shader removes error { ctx.beginSection("GL_INVALID_OPERATION is generated if transform feedback is active and not paused."); const char* tfVarying= "gl_Position"; @@ -1169,8 +1250,10 @@ void draw_range_elements (NegativeTestContext& ctx) void draw_range_elements_invalid_program (NegativeTestContext& ctx) { ctx.glUseProgram(0); + GLuint fbo = 0; GLbyte indices[1] = {0}; + VAOHelper vao(ctx, glu::isContextTypeES(ctx.getRenderContext().getType())); ctx.beginSection("GL_INVALID_ENUM is generated if mode is not an accepted value."); ctx.glDrawRangeElements(-1, 0, 1, 1, GL_UNSIGNED_BYTE, indices); @@ -1207,7 +1290,9 @@ void draw_range_elements_invalid_program (NegativeTestContext& ctx) void draw_range_elements_incomplete_primitive (NegativeTestContext& ctx) { - const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)); + const glu::RenderContext& rc = ctx.getRenderContext(); + const bool isES = glu::isContextTypeES(rc.getType()); + const bool isES32 = glu::contextSupports(rc.getType(), glu::ApiType::es(3, 2)); GLuint fbo = 0; GLuint buf = 0; GLuint tfID = 0; @@ -1215,6 +1300,7 @@ void draw_range_elements_incomplete_primitive (NegativeTestContext& ctx) map args; args["GLSL_VERSION_STRING"] = isES32 ? getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES) : getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES); glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args))); + VAOHelper vao(ctx, isES); ctx.glUseProgram(program.getProgram()); ctx.expectError(GL_NO_ERROR); @@ -1251,7 +1337,7 @@ void draw_range_elements_incomplete_primitive (NegativeTestContext& ctx) ctx.glDeleteFramebuffers(1, &fbo); ctx.endSection(); - if (!ctx.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) // GL_EXT_geometry_shader removes error + if (isES && !ctx.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) // GL_EXT_geometry_shader removes error { ctx.beginSection("GL_INVALID_OPERATION is generated if transform feedback is active and not paused."); const char* tfVarying = "gl_Position"; @@ -1288,13 +1374,15 @@ void draw_range_elements_incomplete_primitive (NegativeTestContext& ctx) void draw_range_elements_base_vertex (NegativeTestContext& ctx) { - TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a 3.2 context or higher context version."); + TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a 3.2 context or higher context version."); GLuint fbo = 0; GLbyte indices[1] = {0}; map args; args["GLSL_VERSION_STRING"] = getGLSLVersionDeclaration(glu::GLSL_VERSION_320_ES); - glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args))); + const glu::RenderContext& rc = ctx.getRenderContext(); + glu::ShaderProgram program (rc, glu::makeVtxFragSources(tcu::StringTemplate(vertexShaderSource).specialize(args), tcu::StringTemplate(fragmentShaderSource).specialize(args))); + VAOHelper vao(ctx, glu::isContextTypeES(rc.getType())); ctx.glUseProgram(program.getProgram()); ctx.expectError(GL_NO_ERROR); @@ -1336,7 +1424,7 @@ void draw_range_elements_base_vertex (NegativeTestContext& ctx) void draw_range_elements_base_vertex_primitive_mode_mismatch (NegativeTestContext& ctx) { - TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a 3.2 context or higher context version."); + TCU_CHECK_AND_THROW(NotSupportedError, checkSupport(ctx), "This test requires a 3.2 context or higher context version."); GLuint indices[1] = {0}; map args; -- 2.7.4