Graphics Reference
In-Depth Information
Releasing Resources
Throughout this chapter, we will explore the various types of memory resources that are
available to the developer. All of these resource types implement COM interfaces, and they
ultimately have the IUnkown interface in their inheritance chain. This means that they are
reference counted, and that they must be released after the application is finished using
them. The application must be careful to track the resource references that it retains and
release them properly, or else it will result in a memory leak.
2.1.2 Resource Views
Resources also share a common technique for binding them to the pipeline. As we saw
above, eight different bind flags are available which identify the locations that a resource is
allowed to be bound at. Of these eight binding locations, half of them allow resources to be
bound directly to the pipeline. These include the vertex and index buffers, constant buffers,
and stream output buffers (the meaning of these buffer types will be further explained in
the "Buffer Resources"section of this chapter). However, the other four binding locations
all require a type of adapter called a resource view to be used when binding a resource to
the pipeline. A resource view is an adapter object used to connect a resource to various
points in the pipeline. It conceptually provides a particular "view" of a resource. Like the
configuration of resources, resource views also provide some configurability. By allow-
ing a resource view to provide some interpretations of the resource, it is possible to use
multiple resource views on a single resource for use at different locations on the pipeline.
In fact, as we will see later in this section, resource views can also be used to represent
subsets of a resource.
Resource View Types
There are four different types of resource views, which each correspond to a particular
location that a resource can be bound to on pipeline. These views determine what opera-
tions can and can't be done with the resources that they are bound to. These four types of
resource views are listed below:
Render target views (ID3D11RenderTargetView)
Depth stencil views (ID3D11DepthStencilView)
Shader resource views (ID3D11ShaderResourceView)
Unordered access view (ID3 D11UnorderedAccessView)
Search WWH ::




Custom Search