From: Alexander Galazin Date: Wed, 31 Mar 2021 07:49:08 +0000 (+0300) Subject: Support GL 4.5 in the Program State Query tests X-Git-Tag: upstream/1.3.5~827 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9fe26710d09681f6f841b17f7149efc9401ae2b3;p=platform%2Fupstream%2FVK-GL-CTS.git Support GL 4.5 in the Program State Query tests Components: AOSP Affects: dEQP-GLES31.functional.state_query.* dEQP-GL45.functional.state_query.* Change-Id: Id23e3852ab16c5e622dd73d097a553ede5caad4d --- diff --git a/framework/opengl/gluStateReset.cpp b/framework/opengl/gluStateReset.cpp index c094beec9..fc70f3e32 100644 --- a/framework/opengl/gluStateReset.cpp +++ b/framework/opengl/gluStateReset.cpp @@ -838,6 +838,28 @@ void resetStateGLCore (const RenderContext& renderCtx, const ContextInfo& ctxInf gl.texParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_SWIZZLE_A, GL_ALPHA); } + // Reset cube array texture. + gl.bindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, 0); + gl.texParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR); + gl.texParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + gl.texParameterfv(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_BORDER_COLOR, &borderColor[0]); + gl.texParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_WRAP_S, GL_REPEAT); + gl.texParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_WRAP_T, GL_REPEAT); + gl.texParameterf(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_MIN_LOD, -1000.0f); + gl.texParameterf(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_MAX_LOD, 1000.0f); + gl.texParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_BASE_LEVEL, 0); + gl.texParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_MAX_LEVEL, 1000); + gl.texParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_COMPARE_MODE, GL_NONE); + gl.texParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL); + + if (contextSupports(type, ApiType::core(3,3))) + { + gl.texParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_SWIZZLE_R, GL_RED); + gl.texParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_SWIZZLE_G, GL_GREEN); + gl.texParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_SWIZZLE_B, GL_BLUE); + gl.texParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_SWIZZLE_A, GL_ALPHA); + } + // Reset 1D array texture. gl.bindTexture (GL_TEXTURE_1D_ARRAY, 0); gl.texImage2D (GL_TEXTURE_1D_ARRAY, 0, GL_RGBA, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, DE_NULL); @@ -944,10 +966,22 @@ void resetStateGLCore (const RenderContext& renderCtx, const ContextInfo& ctxInf { // Reset 2D multisample texture. gl.bindTexture (GL_TEXTURE_2D_MULTISAMPLE, 0); + gl.texParameteri (GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_SWIZZLE_R, GL_RED); + gl.texParameteri (GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_SWIZZLE_G, GL_GREEN); + gl.texParameteri (GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_SWIZZLE_B, GL_BLUE); + gl.texParameteri (GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_SWIZZLE_A, GL_ALPHA); + gl.texParameteri (GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_BASE_LEVEL, 0); + gl.texParameteri (GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MAX_LEVEL, 1000); gl.texImage2DMultisample (GL_TEXTURE_2D_MULTISAMPLE, 1, GL_RGBA8, 0, 0, GL_TRUE); // Reset 2D multisample array texture. gl.bindTexture (GL_TEXTURE_2D_MULTISAMPLE_ARRAY, 0); + gl.texParameteri (GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_SWIZZLE_R, GL_RED); + gl.texParameteri (GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_SWIZZLE_G, GL_GREEN); + gl.texParameteri (GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_SWIZZLE_B, GL_BLUE); + gl.texParameteri (GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_SWIZZLE_A, GL_ALPHA); + gl.texParameteri (GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_BASE_LEVEL, 0); + gl.texParameteri (GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_MAX_LEVEL, 1000); gl.texImage3DMultisample (GL_TEXTURE_2D_MULTISAMPLE_ARRAY, 1, GL_RGBA8, 0, 0, 0, GL_TRUE); } } diff --git a/modules/gles31/functional/es31fProgramStateQueryTests.cpp b/modules/gles31/functional/es31fProgramStateQueryTests.cpp index d1e861bf3..5127fc233 100644 --- a/modules/gles31/functional/es31fProgramStateQueryTests.cpp +++ b/modules/gles31/functional/es31fProgramStateQueryTests.cpp @@ -62,23 +62,27 @@ static const char* getVerifierSuffix (QueryType type) } } -static std::string specializeShader(Context& context, const char* code) +static bool checkSupport(Context& ctx) { - const glu::GLSLVersion glslVersion = glu::getContextTypeGLSLVersion(context.getRenderContext().getType()); - std::map specializationMap; + auto ctxType = ctx.getRenderContext().getType(); + return contextSupports(ctxType, glu::ApiType::es(3, 2)) || + contextSupports(ctxType, glu::ApiType::core(4, 5)); +} - specializationMap["GLSL_VERSION_DECL"] = glu::getGLSLVersionDeclaration(glslVersion); +static std::string specializeShader(Context& context, const char* code) +{ + auto ctxType = context.getRenderContext().getType(); + const glu::GLSLVersion glslVersion = glu::getContextTypeGLSLVersion(ctxType); + const bool isES32orGL45 = checkSupport(context); + const bool isES = isContextTypeES(ctxType); - if (glu::contextSupports(context.getRenderContext().getType(), glu::ApiType::es(3, 2))) - { - specializationMap["GEOMETRY_SHADER_REQUIRE"] = ""; - specializationMap["TESSELLATION_SHADER_REQUIRE"] = ""; - } - else + std::map specializationMap = { - specializationMap["GEOMETRY_SHADER_REQUIRE"] = "#extension GL_EXT_geometry_shader : require"; - specializationMap["TESSELLATION_SHADER_REQUIRE"] = "#extension GL_EXT_tessellation_shader : require"; - } + { "GLSL_VERSION_DECL", glu::getGLSLVersionDeclaration(glslVersion) }, + { "GEOMETRY_SHADER_REQUIRE", (isES32orGL45 ? "" : "#extension GL_EXT_geometry_shader : require") }, + { "TESSELLATION_SHADER_REQUIRE", (isES32orGL45 ? "" : "#extension GL_EXT_tessellation_shader : require") }, + { "GL_POSITION_REDECL", (isES ? "" : "out gl_PerVertex { vec4 gl_Position;};")} + }; return tcu::StringTemplate(code).specialize(specializationMap); } @@ -102,9 +106,9 @@ GeometryShaderCase::GeometryShaderCase (Context& context, QueryType verifier, co GeometryShaderCase::IterateResult GeometryShaderCase::iterate (void) { - const bool supportsES32 = glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)); + const bool isES32orGL45 = checkSupport(m_context); - if (!supportsES32 && !m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) + if (!isES32orGL45 && !m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) TCU_THROW(NotSupportedError, "Geometry shader tests require GL_EXT_geometry_shader extension or an OpenGL ES 3.2 or higher context."); @@ -216,9 +220,9 @@ TessellationShaderCase::TessellationShaderCase (Context& context, QueryType veri TessellationShaderCase::IterateResult TessellationShaderCase::iterate (void) { - const bool supportsES32 = glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)); + const bool isES32orGL45 = checkSupport(m_context); - if (!supportsES32 && !m_context.getContextInfo().isExtensionSupported("GL_EXT_tessellation_shader")) + if (!isES32orGL45 && !m_context.getContextInfo().isExtensionSupported("GL_EXT_tessellation_shader")) TCU_THROW(NotSupportedError, "Tessellation shader tests require GL_EXT_tessellation_shader extension or an OpenGL ES 3.2 or higher context."); @@ -348,6 +352,9 @@ ProgramSeparableCase::IterateResult ProgramSeparableCase::iterate (void) { const string vtxTemplate = "${GLSL_VERSION_DECL}\n" "out highp vec4 v_color;\n" + // NOTE that core profile requires the gl_PerVertex block to be redeclared + // in case a separable program is enabled. + "${GL_POSITION_REDECL}\n" "void main()\n" "{\n" " gl_Position = vec4(float(gl_VertexID) * 0.5, float(gl_VertexID+1) * 0.5, 0.0, 1.0);\n" @@ -412,6 +419,9 @@ ProgramSeparableCase::IterateResult ProgramSeparableCase::iterate (void) gl.glGetProgramiv(program.getProgram(), GL_LINK_STATUS, &linkStatus); GLU_EXPECT_NO_ERROR(gl.glGetError(), "query link status"); + gl.glDetachShader(program.getProgram(), vtxShader.getShader()); + gl.glDetachShader(program.getProgram(), frgShader.getShader()); + TCU_CHECK_MSG(linkStatus == GL_TRUE, "failed to link program"); verifyStateProgramInteger(result, gl, program.getProgram(), GL_PROGRAM_SEPARABLE, 0, m_verifier); @@ -431,6 +441,9 @@ ProgramSeparableCase::IterateResult ProgramSeparableCase::iterate (void) gl.glGetProgramiv(program.getProgram(), GL_LINK_STATUS, &linkStatus); GLU_EXPECT_NO_ERROR(gl.glGetError(), "query link status"); + gl.glDetachShader(program.getProgram(), vtxShader.getShader()); + gl.glDetachShader(program.getProgram(), frgShader.getShader()); + TCU_CHECK_MSG(linkStatus == GL_TRUE, "failed to link program"); verifyStateProgramInteger(result, gl, program.getProgram(), GL_PROGRAM_SEPARABLE, GL_TRUE, m_verifier); @@ -643,7 +656,7 @@ ProgramLogCase::ProgramLogCase (Context& ctx, const char* name, const char* desc void ProgramLogCase::init (void) { - const bool supportsES32 = glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)); + const bool supportsES32orGL45 = checkSupport(m_context); switch (m_buildErrorType) { @@ -652,12 +665,12 @@ void ProgramLogCase::init (void) break; case BUILDERROR_GEOMETRY: - if (!supportsES32 && !m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) + if (!supportsES32orGL45 && !m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader")) TCU_THROW(NotSupportedError, "Test requires GL_EXT_geometry_shader extension"); break; case BUILDERROR_TESSELLATION: - if (!supportsES32 && !m_context.getContextInfo().isExtensionSupported("GL_EXT_tessellation_shader")) + if (!supportsES32orGL45 && !m_context.getContextInfo().isExtensionSupported("GL_EXT_tessellation_shader")) TCU_THROW(NotSupportedError, "Test requires GL_EXT_tessellation_shader extension"); break; diff --git a/modules/glshared/glsStateQueryUtil.cpp b/modules/glshared/glsStateQueryUtil.cpp index 5edbc1ab4..1e8d16fb1 100644 --- a/modules/glshared/glsStateQueryUtil.cpp +++ b/modules/glshared/glsStateQueryUtil.cpp @@ -1105,7 +1105,7 @@ void verifyInteger (tcu::ResultCollector& result, QueriedState& state, int expec { std::ostringstream buf; buf << "Expected " << reference << "(" << de::toString(tcu::Format::Hex<8>(reference)) << "), got " - << state.getInt64Access() << "(" << de::toString(tcu::Format::Hex<8>(state.getInt64Access())) << ")"; + << state.getUintAccess() << "(" << de::toString(tcu::Format::Hex<8>(state.getUintAccess())) << ")"; result.fail(buf.str()); } break;