Calling rtuCreateClusteredMesh fails in Optix 4.0.1

Hi,

see sample code below. Calling rtuCreateClusteredMesh fails with this error message:

Unknown error (Details: Function “RTresult _rtProgramCreateFromPTXString(RTcontext, const char*, const char*, RTprogram_api**)” caught exception: Compile Error: Call to rtReportIntersection is not directly controlled by a call to rtPotentialIntersection)

The same for rtuCreateClusteredMeshExt

Ubuntu 16.04, Driver 370.28, Optix 4.0.1

Sample code:

optix::Geometry
makeMesh(optix::Context& context)
{
	constexpr unsigned int usePTX32InHost64 = 0;
	const std::vector<optix::float3> vertexes(1);
	const std::vector<optix::uint3> faces(1);

	RTgeometry geometry;

	const RTresult result = rtuCreateClusteredMesh
	(
		context->get(), usePTX32InHost64, &geometry,
		vertexes.size(), (const float*) vertexes.data(),
		faces.size(), (const unsigned int*) faces.data(),
		nullptr
	);

	if (result != RT_SUCCESS)
		throw std::runtime_error(context->getErrorString(result));

	return optix::Geometry::take(geometry);
}

int
main()
{
	try
	{
		optix::Context context = optix::ContextObj::create();
		optix::Geometry geometry = makeMesh(context);
	}
	catch (const std::exception& exception)
	{
		std::cerr << "error: " << exception.what() << std::endl;
	}
	return 0;
}

Yes, the underlying intersection program fails a code validation test added to OptiX 4.0.x. I filed a bug about it.

Note that nothing in the optixu library is strictly necessary in own applications.
I would recommend to use OptiX directly and if you’re looking at the old rtuTraversal functions for simple intersection tests, those are completely superseded by the OptiX Prime API.