Game Development Reference
In-Depth Information
make it possible for a multiprocessor to execute two thread groups simultaneously
[Fung 10]. Global memory accesses are, whenever possible, coalesced to avoid
multiple transactions.
2.2.2 Challenges
Source-image data is stored in Texture2D resource objects. To encode Texture2D
resource data, three technical problems may arise. Also challenges may occur, for
example, if the output-image dimensions differ from the source-image dimensions.
No shader resource. When creating a texture resource in Direct3D, different bind
flags are set. Bind flags tell how a resource is bound to the pipeline. After resource
creation, it is no longer possible to modify any bind flag settings. This means
that a nonshader resource texture has to be copied to a resource with the flag
set. Compatible resources can copy data to and from each other using the device
method CopyResource . Swap-chain buffers (back buffer) can be created with the
buffer data can then be sampled directly without copying to another resource. It
is not possible to sample textures that are currently bound to the output merger
stage, and therefore the back buffer has to be unbound before encoding starts.
Multisampling enabled. Texture resources with multisampling enabled have to be
processed before encoding starts. A multisampled resource, of same dimensions
and compatible format, is copied into a nonmultisampled resource by using the
device context method ResolveSubresource . The target resource may thereafter
be encoded.
Image dimensions not multiples of 8 or 16. Depending on the chroma subsampling
mode, image dimensions have to be multiples of either 8 or 16. One solution to the
problem is to repeat edge pixels until evenly divisible values are met. In this tech-
nique edge pixels are repeated by dispatching threads outside texture boundaries.
Threads sample source-texture color data using the D3D11_TEXTURE_ADDRESS_CLAMP
address mode. The sampling mode automatically repeats border-color values,
avoiding the need for conditional behavior in the shader. Texture coordinates are
calculated from SV_DispatchThreadID values; see Listing 2.1. Border-pixel data is
also entropy coded and actual image dimensions are specified in the JFIF header.
Padded image dimensions are now referred to as computation dimensions .
float2 GetTexCoord(uint3 DispatchThreadID)
return float2(DispatchThreadID.x / ImageWidth,
DispatchThreadID.y / ImageHeight);
Search Nedrilad ::

Custom Search