Direct3D 11 Resource Introduction

Source: Internet
Author: User

Resources are the materials used to build scenarios. It contains most D3D data for parsing and rendering scenarios. A resource is a memory area, which can be accessed by the Direct3D pipeline.

You can create a strongly-typed or non-typed resource, control whether the resource has both read and write access, and enable the resource to be accessed only by the CPU or GPU, or you can access both of them. Up to 128 resources are available in each pipeline stage.

The lifecycle of Direct3D resources is:

# UseID3D11DeviceInterface.

# Use a contextID3D11DeviceContextTo bind a resource to a pipeline.

# Call The resource Release method to Release a resource.

Strong and weak types

There are two ways to specify the memory layout structure of a resource:

# Typed: specifies the type of the resource when the resource is created.

# Typeless-specifies the type of the resource when the resource is bound to a pipeline.

The format of the created type of resource is strictly the same as that of the resource, the advantage of this is that the access speed is optimized at runtime (especially when resources are created, the tag indicates that the resource itself cannot be mapped by the application ). You cannot use the view mechanism to reresolve resources of a type to resources of other meanings, unless the D3D10_DDI_BIND_PRESENT tag is specified during creation. If D3D10_DDI_BIND_PRESENT is set render-target or shader resource views can be created on these resources using any of the fully typed members of the appropriate family, even if the original resource was created as fully typed. (I don't know how to turn it over --!)

When creating a non-type resource, you do not know the data type. The application must select an available non-Type format (see DXGI_FORMAT ). You must specify the memory size to be allocated and whether to generate sub-material in the mipmap. In any case, the type of the resource is not known until the resource view is bound to the pipeline. Just as the material format remains flexible before the material is bound to the pipeline, resources can also be seen as a weak type of storage. The advantage of weak types of resources is that they can be reused and re-parsed.

An independent resource can be bound to multiple pipeline stages, but the view of each pipeline stage must be different from that of other stages to ensure uniqueness. For example, resources created using DXGI_FORMAT_R32G32B32A32_TYPELESS can be parsed using DXGI_FORMAT_R32G32B32A32_FLOAT and DXGI_FORMAT_R32G32B32A32_UINT in other parts of the pipeline.

Resource View

Resources can be stored in a memory format that is expensive to be shared by multiple pipeline stages. A pipeline stage uses a view to parse resources.

View can be used with untyped resources. You can create a resource during compilation and set its type when the resource is bound to the pipeline. The associated views of non-type resources always have the same bit. The view type determines how these bits are parsed. During data conversion, the actual type of the resource must correspond to the associated non-type declaration. For example, resources of the R8G8B8A8_TYPELESS type cannot be converted into resources of the R32_FLOAT type, even if they have the same size.

A view also provides some other capabilities, such as reading the backup depth/(Template) surface in the shader, and dynamically generating a cube graph in a separate pass, rendering multiple clips of a volume shadow at the same time.

Several resource Interfaces

#ID3D11DepthStencilViewAccess a texture resource in the deep template test.

#ID3D11RenderTargetViewAccess a texture resource used as a rendering target.

#ID3D11ShaderResourceViewAccess a resource of a shadow, such as constant buffer, Texture buffer, a texture or a samplerger.

#ID3D11UnorderedAccessViewYou can use the pixel or computing shader to access an unordered resource.

Over ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.