Home -> IGraphicsDevice -> CreateRenderer
Description
The CreateRenderer method constructs an IRenderer object, allowing the calling application to perform rendering tasks against this graphics device.
Important
It is perfectly acceptable to construct more than one IRenderer object from the same graphics device and use them independently. It is also possible to construct and use separate IRenderer objects from different graphics devices and use them at the same time, even possibly under different renderer plugins. All constructed IRenderer objects are independent, and there is no shared state in the implementation which would cause them to interfere with each other.
Important
If the application doesn't require any of the information provided on the IGraphicsDevice or IGraphicsDeviceEnumerator objects after the renderer is constructed, it doesn't need to keep these objects around. The renderer doesn't rely on the IGraphicsDevice object in any way after creation.
Warning
Any optional device features not listed in the enabledFeatures set passed into this method are not legal to use under the constructed IRenderer object. Implementations may not always raise warnings on attempts to use an optional feature which has not been activated, however in this case correct operation is not guaranteed. It is the responsibility of the application to ensure it knows what optional features it requires, and to request them here when the IRenderer object is created. The application can check which features are supported by the graphics device by calling the IsFeatureSupported or GetAllSupportedFeatures methods.
Usage
IRenderer::unique_ptr CreateRenderer(const std::set<Feature>& enabledFeatures, const std::set<IRenderer::Options>& enabledOptions);
Argument list
- enabledFeatures [std::set<Feature>]
- The set of optional device features to enable when constructing renderer
- enabledOptions [std::set<IRenderer::Options>]
- The set of renderer options to enable when constructing the renderer
Return value
- [IRenderer::unique_ptr]
- The constructed IRenderer object, wrapped in a unique_ptr.