Graphics Reference
In-Depth Information
individual paths of light through a scene. Many recent research papers have been dedicated
to these types of algorithms, such as seen in (Kaplanyan, 2010).
Creating 3D textures. As we have also seen in the 1D and 2D texture cases, the creation
of the 3D texture is performed by passing a texture description structure to one of the
device methods. The ID3DllDevice: :CreateTexture3D() method is used for 3D tex-
tures. It takes as input a pointer to a D3D11_TEXTURE3D_DESC structure, which is shown
Listing 2.42.
struct D3D11_TEXTURE3D_DESC {
UINT Width;
UINT Height;
UINT Depth;
UINT MipLevels;
DXGI_FORMAT Format;
D3D11_USAGE Usage;
UINT
BindFlags;
UINT
CPUAccessFlags;
UINT
MiscFlags;
}
Listing 2.42. The members of the D3D11_TEXTURE3D_DESC structure.
This structure is quite similar to the 1D and 2D versions. In a 3D texture, its di-
mensions are specified in the Width, Height, and Depth parameters. The number of mip-
map levels and the element format are declared in the same manner as before, with the
MipLevels and Format parameters. The Usage, BindFlags, and CPUAccessFlags param-
eters are used to determine the resource usage patterns, as described at the beginning of
this chapter. Finally, the MiscFlags parameter provides the following optional flags for 3D
textures:
• D3D11_RESOURCE_MISC_GENERATE MIPS
D3D11_RESOURCE_MISC_RESOURCE_CLAMP
We have seen both of these flags before. The first flag indicates the ability to auto-
generate mip-maps from a render target texture, and the second flag allows for capping the
highest resolution mip-map level, which allows the driver to manage the GPU memory
more flexibly.
Resource view requirements. The 3D texture is the only texture resource that is not avail-
able for use with all resource view types. Specifically, it can be used for shader resource
views, unordered access views, and render target views, but cannot be used in conjunction
with a depth stencil view. At first consideration, this would seem to violate the rule that a
Search WWH ::




Custom Search