Radeon ProRender

Context Creation

This tutorial covers creating a basic RPR context.

The rpr_context object is a base object for all rendering operations. Creating a context normally takes the three steps:

  1. Register the plugin backends to be used for rendering. For now, this is mainly the Tahoe.dll path tracing plugin.
  2. Create an rpr_context object with rprCreateContext(). When creating a context, you can specify the devices to be used for rendering, as well as other context constant parameters.
  3. Set the active plugin for rendering on the context.
// Register Tahoe ray tracing plugin.  This should be done before context creation.

	rpr_int tahoePluginID = rprRegisterPlugin("Tahoe64.dll"); 
	assert(tahoePluginID != -1);
	rpr_int plugins[] = { tahoePluginID };
	size_t pluginCount = sizeof(plugins) / sizeof(plugins[0]);

	// Create context using a single GPU. 
	// Note that multiple GPUs can be enabled for example with RPR_CREATION_FLAGS_ENABLE_GPU0 | RPR_CREATION_FLAGS_ENABLE_GPU1.
	CHECK( rprCreateContext(RPR_API_VERSION, plugins, pluginCount, RPR_CREATION_FLAGS_ENABLE_GPU0, NULL, NULL, &context) );

	// Set active plugin.
	CHECK( rprContextSetActivePlugin(context, plugins[0]) );

Note

Every RPR call should be checked for a return value as this tutorial code does by wrapping each RPR call with the CHECK() function.