[Notes] D3D12 learning 4.1.6 Resources and Descriptors

In the rendering process, the GPU write resources (Resources) (e.g., the buffer, the depth / stencil buffer), read resources (e.g., description of the appearance of the surface texture, scene store buffer 3D geometric position of the body). Before we issue drawing commands, we need to bind the resources (or links) (bind (or link)) to be referenced in the draw call rendering pipeline. Some resources may change when each draw will be called, so we need to update the bind each draw call (draw call), if necessary. However, GPU resources are not directly bound. In contrast, by the resource descriptor object (descriptor object) referenced, it may be seen as describing the GPU resources lightweight structure. Essentially, it is an indirect layer (a level of indirection); given resource descriptor, the GPU can get the actual resource data and information necessary to know about it. We will refer to the descriptor specified in the draw call in resources is bound to render pipeline.


Why use descriptors such additional level of indirection? The reason is that the memory block is generic in nature resources GPU. Universal resource remains, therefore they can be used at different stages of rendering pipeline; A common example is the use of texture as a render target (i.e., Direct3D rendering the texture), and then is used as a shader (Shader) resources (i.e., texture the input data is sampled and used as a shader). Resource itself does not indicate whether it is used as a render target, depth / stencil buffer or shader resources. In addition, maybe we just want to bind the data to the sub-region resources rendering pipeline - how do we do that in a given case the entire resources? In addition, you can create a resource-free type format, so do not even know the format of GPU resources.


This is the origin of the descriptor. In addition to identifying resource data, resource descriptors also describes the GPU: they tell Direct3D how resources will be used (that is, you bind it to what stage of the pipeline), you can specify that we want the descriptors where applicable sub-regional resource binding, if the resource format is specified as no type at the time of creation, we must now create a descriptor when declaring type.

 

Ruby: view (view) is synonymous descriptor (descriptor) of. The term "view" used in earlier versions of Direct3D, it is still used in some parts of Direct3D 12 API. We used interchangeably in this book; e.g., constants, and the constant buffer buffer descriptor view is the same thing.

 

Descriptor has a type, suggesting that the use of resources. Descriptor type we use in this book are:
1.CBV / SRV / UAV descriptor describes the constant buffer (constant buffers), shader resources (shader resources) and unordered access view resources (unordered access view resources) .
2. Sampling Descriptor (Sampler descriptors) describes a sampler resources (for texturing (texturing)).
3.RTV descriptor describes render target resources.
3.DSV descriptor describes a depth / stencil (depth / stencil) resources.


Heap descriptors (a descriptor heap) is a descriptor array (Array); it is a specific type of application used by all descriptors memory support. For each type of descriptor, you will need a separate descriptor heap. You can also create the same type of multiple heap descriptor.


We can have multiple descriptors refer to the same resources. For example, we can have a plurality of different sub-regions descriptors referenced resources. Moreover, as mentioned above, resources can be bound to different stages of the rendering pipeline. For each phase, we need a separate descriptor. For example render target texture and shader resources, we need to create two descriptors: RTV type descriptor and SRV type descriptor. Similarly, if you create a resource using no type format, you can be regarded as the floating point texture element or integer values, for example; this will require two descriptors, a descriptor specified floating-point format, another descriptor specified integer format.


Descriptors should be created at initialization time. This is because there have been some type checking and verification (This is because there is some type checking and validation that occurs), best to do this in the initialization time instead of runtime.

 

Sidenote: August 2009 SDK documentation, said:. "Create a complete type of resource (fully-typed resource) resource limitations format will create for it . This makes it possible to optimize the run-time access [...]" So If you do need the flexibility they offer (can be used in a variety of ways to re-interpret multiple views of data), you should not only create the type of resources; otherwise, create a complete resource type.

 

Guess you like

Origin www.cnblogs.com/heben/p/11324834.html