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);
{
// 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);
}
}
}
}
-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<std::string, std::string> 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<std::string, std::string> 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);
}
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.");
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.");
{
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"
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);
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);
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)
{
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;