tcu::TestNode::IterateResult ShaderAtomicCounterOpsTestBase::iterate()
{
	if (!m_context.getContextInfo().isExtensionSupported("GL_ARB_shader_atomic_counters") ||
		!m_context.getContextInfo().isExtensionSupported("GL_ARB_shader_atomic_counter_ops"))
	{
		m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "Not supported");
		return STOP;
	}

	for (ShaderPipelineIter iter = m_shaderPipelines.begin(); iter != m_shaderPipelines.end(); ++iter)
	{
		fillAtomicCounterBuffer(iter->getAtomicOperation());
		bindBuffers();
		iter->test(m_context);

		bool		operationValueValid = checkAtomicCounterBuffer(iter->getAtomicOperation());
		std::string operationFailMsg	= "Result of atomic operation was different than expected (" +
									   iter->getAtomicOperation()->getFunction() + ").";
		TCU_CHECK_MSG(operationValueValid, operationFailMsg.c_str());

		bool		returnValueValid = validateScreenPixels(tcu::Vec4(1.0f), tcu::Vec4(0.5f));
		std::string returnFailMsg	= "Result of atomic operation return value was different than expected (" +
									iter->getAtomicOperation()->getFunction() + ").";
		TCU_CHECK_MSG(returnValueValid, returnFailMsg.c_str());
	}

	m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
	return STOP;
}
Пример #2
0
/** Executes test iteration.
*
*  @return Returns STOP when test has finished executing, CONTINUE if more iterations are needed.
*/
tcu::TestNode::IterateResult ShaderBallotFunctionBallotTestCase::iterate()
{
	if (!m_context.getContextInfo().isExtensionSupported("GL_ARB_shader_ballot") ||
		!m_context.getContextInfo().isExtensionSupported("GL_ARB_gpu_shader_int64"))
	{
		m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "Not supported");
		return STOP;
	}

	for (ShaderPipelineIter iter = m_shaderPipelines.begin(); iter != m_shaderPipelines.end(); ++iter)
	{
		createShaderPrograms(**iter);
	}

	const glw::Functions& gl = m_context.getRenderContext().getFunctions();

	for (ShaderPipelineIter pipelineIter = m_shaderPipelines.begin(); pipelineIter != m_shaderPipelines.end();
		 ++pipelineIter)
	{
		gl.clearColor(1.0f, 0.0f, 0.0f, 1.0f);
		gl.clear(GL_COLOR_BUFFER_BIT);

		(*pipelineIter)->test(m_context);

		gl.flush();

		bool validationResult = ShaderBallotBaseTestCase::validateScreenPixels(
			m_context, tcu::Vec4(1.0f, 1.0f, 1.0f, 1.0f), tcu::Vec4(1.0f, 0.0f, 0.0f, 1.0f));
		TCU_CHECK_MSG(validationResult, "Value returned from ballotARB function is not correct");
	}

	m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
	return STOP;
}
Пример #3
0
void parseTypePath (const char* nameWithPath, const VarType& type, TypeComponentVector& path)
{
	VarTokenizer tokenizer(nameWithPath);

	if (tokenizer.getToken() == VarTokenizer::TOKEN_IDENTIFIER)
		tokenizer.advance();

	path.clear();
	while (tokenizer.getToken() != VarTokenizer::TOKEN_END)
	{
		VarType curType = getVarType(type, path);

		if (tokenizer.getToken() == VarTokenizer::TOKEN_PERIOD)
		{
			tokenizer.advance();
			TCU_CHECK(tokenizer.getToken() == VarTokenizer::TOKEN_IDENTIFIER);
			TCU_CHECK_MSG(curType.isStructType(), "Invalid field selector");

			// Find member.
			std::string		memberName	= tokenizer.getIdentifier();
			int				ndx			= 0;
			for (; ndx < curType.getStructPtr()->getNumMembers(); ndx++)
			{
				if (memberName == curType.getStructPtr()->getMember(ndx).getName())
					break;
			}
			TCU_CHECK_MSG(ndx < curType.getStructPtr()->getNumMembers(), "Member not found in type");

			path.push_back(VarTypeComponent(VarTypeComponent::STRUCT_MEMBER, ndx));
			tokenizer.advance();
		}
		else if (tokenizer.getToken() == VarTokenizer::TOKEN_LEFT_BRACKET)
		{
			tokenizer.advance();
			TCU_CHECK(tokenizer.getToken() == VarTokenizer::TOKEN_NUMBER);

			int ndx = tokenizer.getNumber();

			if (curType.isArrayType())
			{
				TCU_CHECK(de::inBounds(ndx, 0, curType.getArraySize()));
				path.push_back(VarTypeComponent(VarTypeComponent::ARRAY_ELEMENT, ndx));
			}
			else if (curType.isBasicType() && isDataTypeMatrix(curType.getBasicType()))
			{
				TCU_CHECK(de::inBounds(ndx, 0, getDataTypeMatrixNumColumns(curType.getBasicType())));
				path.push_back(VarTypeComponent(VarTypeComponent::MATRIX_COLUMN, ndx));
			}
			else if (curType.isBasicType() && isDataTypeVector(curType.getBasicType()))
			{
				TCU_CHECK(de::inBounds(ndx, 0, getDataTypeScalarSize(curType.getBasicType())));
				path.push_back(VarTypeComponent(VarTypeComponent::VECTOR_COMPONENT, ndx));
			}
			else
				TCU_FAIL("Invalid subscript");

			tokenizer.advance();
			TCU_CHECK(tokenizer.getToken() == VarTokenizer::TOKEN_RIGHT_BRACKET);
			tokenizer.advance();
		}
		else
			TCU_FAIL("Unexpected token");
	}
}