Graphics Reference
In-Depth Information
Texture 1D depth stencil view. In both the array and non-array TexturelD resources, the
depth stencil view uses the same subresource regions as indicated for the render target
views. This makes sense, since the render target size and dimension are always required to
match that of the depth stencil target. The two structures used to select these subresource
regions are shown in Listing 2.26.
struct D3D11_TEX1D_DSV {
UINT MipSlice;
}
Struct D3D11_TEX1D_ARRAY_DSV {
UINT MipSlice;
UINT FirstArraySlice;
UINT ArraySize;
}
Listing 2.26. The members of the D3D11_TEX1D_DSV and D3D11_TEX1D_ARRAY_DSV structures.
HLSL objects. One-dimensional texture resources may be accessed from within the HLSL
programs that are executed in the programmable shader stages. However, they interact
with the resources through resource objects that must be declared in the HLSL source file.
These objects essentially form the connection between the shader program and the data
that is exposed through the resource view used to bind a resource to the pipeline. There
are two possibilities for binding resources to a pipeline stage so that they can be accessed
from HLSL, either using a shader resource view or an unordered access view. The shader
resource view provides read-only access to resources. If a resource is bound with a shader
resource view, its resource object in HLSL will be declared as either a TexturelD or a
TexturelDArray, depending on whether the resource is array based or not. The unordered
access view allows read and write access to the resource data that it exposes. To indicate
this difference in usage, its resource objects in HLSL are declared with the same names, but
prepended with an RW to indicate their read/write nature. Listing 2.27 demonstrates several
example declarations in HLSL using these various resource objects.
TexturelD<float> tex01;
TexturelDArray<uint3> tex02;
RWTexturelD<float4> tex03;
RWTexturelDArray<int2> tex04;
Listing 2.27. Several resource object declarations for use with ID texture resources.
When the texture is declared in HLSL, it specifies a template-style parameter to indicate
what format the resource must be compatible with. This is used to ensure that when a resource
Search WWH ::




Custom Search