static std::string specializeShader (const std::string& shaderSource, const glu::ContextType& contextType)
{
- const bool supportsES32 = glu::contextSupports(contextType, glu::ApiType::es(3, 2));
+ const bool supportsES32orGL45 = glu::contextSupports(contextType, glu::ApiType::es(3, 2)) ||
+ glu::contextSupports(contextType, glu::ApiType::core(4, 5));
std::map<std::string, std::string> args;
args["GLSL_VERSION_DECL"] = glu::getGLSLVersionDeclaration(glu::getContextTypeGLSLVersion(contextType));
- args["GLSL_EXT_GEOMETRY_SHADER"] = supportsES32 ? "" : "#extension GL_EXT_geometry_shader : require\n";
- args["GLSL_OES_TEXTURE_STORAGE_MULTISAMPLE"]= supportsES32 ? "" : "#extension GL_OES_texture_storage_multisample_2d_array : require\n";
+ args["GLSL_EXT_GEOMETRY_SHADER"] = supportsES32orGL45 ? "" : "#extension GL_EXT_geometry_shader : require\n";
+ args["GLSL_OES_TEXTURE_STORAGE_MULTISAMPLE"]= supportsES32orGL45 ? "" : "#extension GL_OES_texture_storage_multisample_2d_array : require\n";
return tcu::StringTemplate(shaderSource).specialize(args);
}
+static bool checkSupport(Context& ctx)
+{
+ auto contextType = ctx.getRenderContext().getType();
+ return contextSupports(contextType, glu::ApiType::es(3, 2)) ||
+ contextSupports(contextType, glu::ApiType::core(4, 5)) ||
+ ctx.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader");
+}
+
std::string inputTypeToGLString (rr::GeometryShaderInputType inputType)
{
switch (inputType)
void GeometryShaderRenderTest::init (void)
{
// requirements
- if (!glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader"))
+ if (!checkSupport(m_context))
TCU_THROW(NotSupportedError, "Tests require GL_EXT_geometry_shader extension or higher context version.");
// gen resources
void NegativeDrawCase::init (void)
{
- if (!glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader"))
+ if (!checkSupport(m_context))
TCU_THROW(NotSupportedError, "Tests require GL_EXT_geometry_shader extension or higher context version.");
m_ctx = new sglr::GLContext(m_context.getRenderContext(), m_testCtx.getLog(), sglr::GLCONTEXT_LOG_CALLS | sglr::GLCONTEXT_LOG_PROGRAMS, tcu::IVec4(0, 0, 1, 1));
glw::GLint maxComponents = 0;
// check the extension before querying anything
- if (!glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader"))
+ if (!checkSupport(m_context))
TCU_THROW(NotSupportedError, "Tests require GL_EXT_geometry_shader extension or higher context version.");
m_context.getRenderContext().getFunctions().getIntegerv(GL_MAX_GEOMETRY_OUTPUT_VERTICES, &maxVertices);
// Requirements
if (m_test == BuiltinVariableShader::TEST_POINT_SIZE)
{
+ const glw::Functions& gl = m_context.getRenderContext().getFunctions();
+
const float requiredPointSize = 5.0f;
tcu::Vec2 range = tcu::Vec2(1.0f, 1.0f);
if (!glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::core(4, 4)) && !m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_point_size"))
TCU_THROW(NotSupportedError, "Tests require GL_EXT_geometry_point_size extension.");
- m_context.getRenderContext().getFunctions().getFloatv(GL_ALIASED_POINT_SIZE_RANGE, range.getPtr());
+ gl.getFloatv(GL_ALIASED_POINT_SIZE_RANGE, range.getPtr());
if (range.y() < requiredPointSize)
throw tcu::NotSupportedError("Test case requires point size " + de::toString(requiredPointSize));
+
+ if (glu::isContextTypeGLCore(m_context.getRenderContext().getType()))
+ gl.enable(GL_PROGRAM_POINT_SIZE);
}
m_program = new BuiltinVariableShader(m_context.getRenderContext().getType(), m_test);
void BuiltinVariableRenderTest::deinit(void)
{
+ if (BuiltinVariableShader::TEST_POINT_SIZE == m_test && glu::isContextTypeGLCore(m_context.getRenderContext().getType()))
+ {
+ m_context.getRenderContext().getFunctions().disable(GL_PROGRAM_POINT_SIZE);
+ }
+
if (m_program)
{
delete m_program;
{
// Requirements
- if (!glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader"))
+ const bool supportES32 = glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2));
+ const bool supportGL45 = glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::core(4, 5));
+
+ if (!checkSupport(m_context))
TCU_THROW(NotSupportedError, "Tests require GL_EXT_geometry_shader extension or higher context version.");
- if (m_target == TARGET_2D_MS_ARRAY && !glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !m_context.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array"))
+ if (m_target == TARGET_2D_MS_ARRAY &&
+ !(supportGL45 || (supportES32 && m_context.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array"))))
TCU_THROW(NotSupportedError, "Test requires OES_texture_storage_multisample_2d_array extension or higher context version.");
if (m_context.getRenderTarget().getWidth() < m_resolveDimensions.x() || m_context.getRenderTarget().getHeight() < m_resolveDimensions.y())
gls::StateQueryUtil::StateQueryMemoryWriteGuard<glw::GLint> state;
- m_context.getRenderContext().getFunctions().getIntegerv(GL_LAYER_PROVOKING_VERTEX, &state);
- GLU_EXPECT_NO_ERROR(m_context.getRenderContext().getFunctions().getError(), "getInteger(GL_LAYER_PROVOKING_VERTEX)");
+ const glw::Functions& gl = m_context.getRenderContext().getFunctions();
+
+ gl.getIntegerv(GL_LAYER_PROVOKING_VERTEX, &state);
+ GLU_EXPECT_NO_ERROR(gl.getError(), "getInteger(GL_LAYER_PROVOKING_VERTEX)");
if (!state.verifyValidity(m_testCtx))
return STOP;
m_testCtx.getLog() << tcu::TestLog::Message << "GL_LAYER_PROVOKING_VERTEX = " << glu::getProvokingVertexStr(state) << tcu::TestLog::EndMessage;
- if (state != GL_FIRST_VERTEX_CONVENTION &&
- state != GL_LAST_VERTEX_CONVENTION &&
- state != GL_UNDEFINED_VERTEX)
+ bool ok = false;
+ if (contextSupports(m_context.getRenderContext().getType(), glu::ApiType::core(3,2)))
+ {
+ ok = state == GL_PROVOKING_VERTEX;
+ gl.getIntegerv(GL_PROVOKING_VERTEX, reinterpret_cast<glw::GLint*>(&m_provokingVertex));
+ GLU_EXPECT_NO_ERROR(gl.getError(), "getInteger(GL_PROVOKING_VERTEX)");
+ }
+ else
+ {
+ ok = state == GL_FIRST_VERTEX_CONVENTION ||
+ state == GL_LAST_VERTEX_CONVENTION ||
+ state == GL_UNDEFINED_VERTEX;
+ m_provokingVertex = (glw::GLenum)state;
+ }
+ if (!ok)
{
m_testCtx.getLog() << tcu::TestLog::Message << "getInteger(GL_LAYER_PROVOKING_VERTEX) returned illegal value. Got " << state << tcu::TestLog::EndMessage;
m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "got unexpected provoking vertex value");
return STOP;
}
-
- m_provokingVertex = (glw::GLenum)state;
}
// render to texture
{
// Check requirements
- if (!glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader"))
+ if (!checkSupport(m_context))
TCU_THROW(NotSupportedError, "Tests require GL_EXT_geometry_shader extension or higher context version.");
if (m_test == VaryingOutputCountShader::READ_TEXTURE)
void GeometryProgramQueryCase::init (void)
{
- if (!(m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader") || glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2))))
+ if (!checkSupport(m_context))
TCU_THROW(NotSupportedError, "Tests require GL_EXT_geometry_shader extension or higher context version.");
}
void ImplementationLimitCase::init (void)
{
- if (!glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader"))
+ if (!checkSupport(m_context))
TCU_THROW(NotSupportedError, "Tests require GL_EXT_geometry_shader extension or higher context version.");
}
void LayerProvokingVertexQueryCase::init (void)
{
- if (!glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader"))
+ if (!checkSupport(m_context))
TCU_THROW(NotSupportedError, "Tests require GL_EXT_geometry_shader extension or higher context version.");
}
{
m_testCtx.getLog() << tcu::TestLog::Message << "LAYER_PROVOKING_VERTEX = " << glu::getProvokingVertexStr(state.getIntAccess()) << tcu::TestLog::EndMessage;
- if (state.getIntAccess() != GL_FIRST_VERTEX_CONVENTION &&
- state.getIntAccess() != GL_LAST_VERTEX_CONVENTION &&
- state.getIntAccess() != GL_UNDEFINED_VERTEX)
+ bool ok = true;
+ std::string expectedValue;
+
+ if (contextSupports(m_context.getRenderContext().getType(), glu::ApiType::core(3,2)))
+ {
+ ok = state.getIntAccess() == GL_PROVOKING_VERTEX;
+ expectedValue = "GL_PROVOKING_VERTEX";
+ }
+ else if (
+ state.getIntAccess() != GL_FIRST_VERTEX_CONVENTION &&
+ state.getIntAccess() != GL_LAST_VERTEX_CONVENTION &&
+ state.getIntAccess() != GL_UNDEFINED_VERTEX
+ )
+ {
+ ok = false;
+ expectedValue = "any of {FIRST_VERTEX_CONVENTION, LAST_VERTEX_CONVENTION, UNDEFINED_VERTEX}";
+ }
+
+ if (!ok)
{
m_testCtx.getLog()
<< tcu::TestLog::Message
<< "getInteger(GL_LAYER_PROVOKING_VERTEX) returned illegal value. Got "
<< state.getIntAccess() << "\n"
- << "Expected any of {FIRST_VERTEX_CONVENTION, LAST_VERTEX_CONVENTION, UNDEFINED_VERTEX}."
+ << "Expected " << expectedValue << "."
<< tcu::TestLog::EndMessage;
result.fail("got unexpected provoking vertex value");
// requirements
- if (!glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader"))
+ if (!checkSupport(m_context))
TCU_THROW(NotSupportedError, "Tests require GL_EXT_geometry_shader extension or higher context version.");
gl.getIntegerv(GL_MAX_GEOMETRY_SHADER_INVOCATIONS, &maxGeometryShaderInvocations);
void GeometryProgramLimitCase::init (void)
{
- if (!glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader"))
+ if (!checkSupport(m_context))
TCU_THROW(NotSupportedError, "Tests require GL_EXT_geometry_shader extension or higher context version.");
}
{
// requirements
- if (!glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader"))
+ if (!checkSupport(m_context))
TCU_THROW(NotSupportedError, "Tests require GL_EXT_geometry_shader extension or higher context version.");
// log what test tries to do
void PrimitivesGeneratedQueryObjectQueryCase::init (void)
{
- if (!glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader"))
+ if (!checkSupport(m_context))
TCU_THROW(NotSupportedError, "Tests require GL_EXT_geometry_shader extension or higher context version.");
}
void GeometryShaderFeartureTestCase::init (void)
{
- if (!glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader"))
+ if (!checkSupport(m_context))
TCU_THROW(NotSupportedError, "Tests require GL_EXT_geometry_shader extension or higher context version.");
}
}
else if (textureTypes[ndx].type == TEXTURE_2D_MS_ARRAY)
{
+ const bool supportES32 = glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2));
+ const bool supportGL45 = glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::core(4, 5));
+
// check extension
- if (!glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !m_context.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array"))
+ if (!(supportGL45 || (supportES32 && m_context.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array"))))
{
m_testCtx.getLog() << tcu::TestLog::Message << "Context is not equal or greather than 3.2 and GL_OES_texture_storage_multisample_2d_array not supported, skipping." << tcu::TestLog::EndMessage;
continue;
{
// requirements
- if (!glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader"))
+ if (!checkSupport(m_context))
TCU_THROW(NotSupportedError, "Tests require GL_EXT_geometry_shader extension or higher context version.");
// log what test tries to do
{
// requirements
- if (!glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader"))
+ if (!checkSupport(m_context))
TCU_THROW(NotSupportedError, "Tests require GL_EXT_geometry_shader extension or higher context version.");
// log what test tries to do
} // anonymous
-GeometryShaderTests::GeometryShaderTests (Context& context)
+GeometryShaderTests::GeometryShaderTests (Context& context, bool isGL45)
: TestCaseGroup(context, "geometry_shading", "Geometry shader tests")
+ , m_isGL45(isGL45)
{
}
queryGroup->addChild(new GeometryProgramLimitCase(m_context, "max_geometry_atomic_counter_buffers", "", GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS, "MaxGeometryAtomicCounterBuffers", 0));
// program queries
- queryGroup->addChild(new GeometryShaderVerticesQueryCase (m_context, "geometry_linked_vertices_out", "GL_GEOMETRY_LINKED_VERTICES_OUT"));
- queryGroup->addChild(new GeometryShaderInputQueryCase (m_context, "geometry_linked_input_type", "GL_GEOMETRY_LINKED_INPUT_TYPE"));
- queryGroup->addChild(new GeometryShaderOutputQueryCase (m_context, "geometry_linked_output_type", "GL_GEOMETRY_LINKED_OUTPUT_TYPE"));
- queryGroup->addChild(new GeometryShaderInvocationsQueryCase (m_context, "geometry_shader_invocations", "GL_GEOMETRY_SHADER_INVOCATIONS"));
+ // ES only
+ if (!m_isGL45)
+ {
+ queryGroup->addChild(new GeometryShaderVerticesQueryCase (m_context, "geometry_linked_vertices_out", "GL_GEOMETRY_LINKED_VERTICES_OUT"));
+ queryGroup->addChild(new GeometryShaderInputQueryCase (m_context, "geometry_linked_input_type", "GL_GEOMETRY_LINKED_INPUT_TYPE"));
+ queryGroup->addChild(new GeometryShaderOutputQueryCase (m_context, "geometry_linked_output_type", "GL_GEOMETRY_LINKED_OUTPUT_TYPE"));
+ queryGroup->addChild(new GeometryShaderInvocationsQueryCase (m_context, "geometry_shader_invocations", "GL_GEOMETRY_SHADER_INVOCATIONS"));
+ }
// limits
queryGroup->addChild(new ImplementationLimitCase(m_context, "max_geometry_shader_invocations", "", GL_MAX_GEOMETRY_SHADER_INVOCATIONS, 32));