现在的位置: 首页 > 综合 > 正文

dx texture

2018年05月27日 ⁄ 综合 ⁄ 共 1678字 ⁄ 字号 评论关闭

Texture Resource Views A texture can be bound to different stages of the rendering pipeline; a common example is to use a texture as a render target (i.e., Direct3D draws into the texture) and as a shader resource (i.e., the texture will be sampled in a
shader). A texture resource created for these two purposes would be given the bind flags: D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE

indicating the two pipeline stages the texture will be bound to. Actually, resources are not directly bound to a pipeline stage; instead their associated resource views are bound to different pipeline stages. For each way we are going to use a texture, Direct3D
requires that we create a resource view of that texture at initialization time. This is mostly for efficiency, as the SDK documentation points out: “This allows validation and mapping in the runtime and driver to occur at view creation, minimizing type checking
at bind-time.” So for the example of using a texture as a render target and shader resource, we would need to create two views: a render target view (ID3D11RenderTargetView) and a shader resource view (ID3D11ShaderResourceView).Resource views essentially
do two things: they tell Direct3D how the resource will be used (i.e., what stage of the pipeline you will bind it to), and if the resource format was specified as typeless at creation time, then we must now state the type when creating a view. Thus, with
typeless formats, it is possible for the elements of a texture to be viewed as floating-point values in one pipeline stage and as integers in another.


typless resource

The August 2009 SDK documentation says: “Creating a fully-typed resource restricts the resource to the format it was created with. This enables the runtime to optimize access […].”
Therefore, you should only create a typeless resource if you really need the flexibility they provide (the ability to reinterpret the data in multiple ways with multiple views); otherwise, create a fully typed resource.

【上篇】
【下篇】

抱歉!评论已关闭.