rprCreateContext

Creates rendering context.

Rendering context is a root object encapsulating the render states and responsible for execution control. All the entities in AMD Radeon ProRender are created for a particular rendering context. Entities created for some context can’t be used with other contexts.

rpr_status rprCreateContext(

rpr_uint api_version,

rpr_int const * pluginIDs,

size_t pluginCount,

rpr_creation_flags creation_flags,

rpr_context_properties const * props,

rpr_char const * cache_path,

rpr_context * out_context);

Parameters

Parameter

Description

api_version

Determines the compute API to be used.

pluginIDs

Array of pluginIDs to use.

pluginCount

Number of pluginIDs.

context_type

Determines compute API to use, OPENCL only is supported for now.

creation_flags

Determines the Multi-GPU or CPU-GPU set up using bitmarks.

props

Context creation properties. Specifies a list of context property names and their corresponding values. Each property name is immediately followed by the corresponding desired value. The list is terminated with 0.

cache_path

Full path to the kernel cache created by Radeon ProRender. NULL indicates current folder. For UNICODE, supports UTF-8 encoding.

cpu_thread_limit

Limit for the number of threads used for CPU rendering.

out_context

A pointer to the created context object.

Notes

A rendering context may operate in a single- or multi-GPU environment, with this option being set through bitmarks of the form ENABLE_GPU0 | ENABLE_GPU1 ....

The GPUs must be locally installed. A network-enabled version is planned for a future release.

If rprCreateContext is unable to find the directory specified by cache_path, or the directory is empty, it will load the requisite kernel code from embedded sources.

Plug-ins should be registered before context creation.

Output

A pointer to a context object.

Return

Returns RPR_SUCCESS in case of success, or RPR_ERROR code if a problem was encountered.

To learn how to handle errors in AMD Radeon ProRender SDK, see Error Handling.

Errors

Possible error codes:

  • RPR_ERROR_COMPUTE_API_NOT_SUPPORTED

  • RPR_ERROR_OUT_OF_SYSTEM_MEMORY

  • RPR_ERROR_OUT_OF_VIDEO_MEMORY

  • RPR_ERROR_INVALID_API_VERSION

  • RPR_ERROR_INVALID_PARAMETER