Graphics Reference
In-Depth Information
RWTexture2D
RWTexture2DArray
As you can see, only the standard 2D texture resource and its array based counterpart
can be used with unordered access views. This leaves out both multisampled resources and
cube map textures, although the resources of the latter can still be manipulated, as with an
RWTexture2DArray. An example HLSL declaration for each of these resource objects is
shown in Listing 2.41.
Texture2D<float> tex01;
Texture2DArray<int3> tex02;
Texture2DMS<float4, 4> tex03;
Texture2DMS<float2, 16> tex04;
TextureCube<float3> tex05;
TextureCubeArray<float> tex06;
RWTexture2D<uint3> tex07;
RWTexture2DArray<float3> tex08;
Listing 2.41 . Example resource object declarations in HLSL for the various types of 2D texture resources.
As can be seen in these declarations, the multisampled texture resource objects spec-
ify their format and can also optionally specify the number of subsamples that are used in
the resource. This sample count used to be required in Direct3D 10, but since Direct3D
10.1, the count specification has become optional. Now it is possible to query the number
of samples through the HLSL GetDimensions() method, making the direct specification
unnecessary. This ensures that any methods that access the subsamples only try to use the
appropriate number of samples. The semantics surrounding the usage of each of these re-
source objects will be covered in more detail in Chapter 6.
Texture 3D
The third texture type continues the trend and implements the expected increase in dimen-
sion to provide a 3D texture type. This texture type is organized similarly to the previous
two textures, except that a third axis is added to the texture. It is essentially a 3D grid of
texture elements, with each element consisting of one of the DXGI_FORMAT enumeration
types. The various types of 3D texture resources are depicted in Figure 2.41.
As you can see from Figure 2.41, the 3D textures allow for single textures and mip-
mapped textures. Texture arrays are not supported in 3D textures. In addition, multi-sam-
pling cannot be used with a 3D texture.
Using 3D textures. The use cases for 3D textures are typically somewhat more specialized
than those for the previous two texture types. Due to the nature of a 3D representation, this
Search WWH ::




Custom Search