The Renderer

The API interface to the render framework is exposed in the API class MRenderer.

The class itself, for the most part, is an interface which allows access to rendering resources as well as the interface for registering render loop overrides. The various resource managers available from here include:

NOTE:The state manager is not accessible from MRenderer as state only accessible from within the draw phase of the pipeline (when a draw context is available)

The actual GPU device as well as information about the GPU draw API (DirectX11 or OpenGL) are also accessible from this class. The GPU device is the DX device for DirectX11, while for OpenGL, this is the main OpenGL context used by the rendering framework. For OpenGL, this context differs depending on whether Maya is running in interactive or batch modes. There is no guarantee that the context is the same as the one used to draw into the interactive viewports.

For any given instance of Maya, only one device for a given draw API is active. As such, though it is possible for a plug-in to use both DirectX and OpenGL at the same time, the rendering framework only provides support for one or the other.

Figure 37: At the core is a GPU device initiated to run a specific draw API. Various GPU handles, specific to that draw API, can be accessed via the constructs exposed by the API managers or renderer. The renderer, along with the texture, shader, fragment and target managers are accessible anytime in the pipeline. Overrides are active only during certain times in the pipeline. Within this time, a draw context can be accessed. The acquire and release methods of the state manager are accessible anytime in the pipeline, but state blocks may only be activated to the device when an MDrawContext is available.

All interfaces have a common namespace MHWRender and currently the interfaces only have C++ language bindings.