Table of contents
GDI
TOC
Collapse the table of content
Expand the table of content

Creating and Destroying a Context

Last Updated: 2/14/2017

A driver must create and initialize a device-specific context that encapsulates the state information that it requires to perform rendering. State is not shared between contexts; so the driver must maintain full state information for each context that it creates.

To create a context, the driver should do the following:

  • Allocate the device-specific context and zero-initialize it.

  • See D3dContextCreate for additional steps to be done within that callback. The D3dContextCreate callback is called when an application creates a Direct3D HAL device. The driver must implement this callback.

The driver must be able to reference all texture handles created by D3dCreateSurfaceEx within a created context. This enables the driver to clean up all driver-specific data related to textures created within this context when a call to the D3dContextDestroy function is made.

Direct3D calls D3dContextDestroy when an application requests that a Direct3D HAL device be destroyed. The driver should free all resources that it allocated to the specified context. These resources include, for example, texture resources, vertex and pixel shaders, declarations and code for vertex shaders, and resources for asynchronous queries.

Send comments about this topic to Microsoft

© 2017 Microsoft