1c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley/****************************************************************************
2c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley* Copyright (C) 2014-2015 Intel Corporation.   All Rights Reserved.
3c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley*
4c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley* Permission is hereby granted, free of charge, to any person obtaining a
5c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley* copy of this software and associated documentation files (the "Software"),
6c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley* to deal in the Software without restriction, including without limitation
7c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley* and/or sell copies of the Software, and to permit persons to whom the
9c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley* Software is furnished to do so, subject to the following conditions:
10c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley*
11c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley* The above copyright notice and this permission notice (including the next
12c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley* paragraph) shall be included in all copies or substantial portions of the
13c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley* Software.
14c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley*
15c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley* IN THE SOFTWARE.
22c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley*
23c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley* @file ClearTile.cpp
24c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley*
25c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley* @brief Functionality for ClearTile. StoreHotTileClear clears a single macro
26c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley*        tile in the destination.
27c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley*
28c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley******************************************************************************/
29c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley#include "common/os.h"
30c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley#include "core/context.h"
31c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley#include "common/formats.h"
32c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley#include "memory/TilingFunctions.h"
33c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley#include "memory/tilingtraits.h"
34c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley#include "memory/Convert.h"
35c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley
361a80ec0cd1f3f66a33fc708e0112c88f4fba122dIlia Mirkintypedef void(*PFN_STORE_TILES_CLEAR)(const float*, SWR_SURFACE_STATE*, UINT, UINT, uint32_t);
37c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley
38c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley//////////////////////////////////////////////////////////////////////////
39c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley/// Clear Raster Tile Function Tables.
40c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley//////////////////////////////////////////////////////////////////////////
41c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowleystatic PFN_STORE_TILES_CLEAR sStoreTilesClearColorTable[NUM_SWR_FORMATS];
42c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley
43c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowleystatic PFN_STORE_TILES_CLEAR sStoreTilesClearDepthTable[NUM_SWR_FORMATS];
44c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley
45c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley//////////////////////////////////////////////////////////////////////////
46c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley/// StoreRasterTileClear
47c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley//////////////////////////////////////////////////////////////////////////
48c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowleytemplate<SWR_FORMAT SrcFormat, SWR_FORMAT DstFormat>
49c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowleystruct StoreRasterTileClear
50c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley{
51c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    //////////////////////////////////////////////////////////////////////////
52c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    /// @brief Stores an 8x8 raster tile to the destination surface.
53c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    /// @param pColor - Pointer to clear color.
54c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    /// @param pDstSurface - Destination surface state
55c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    /// @param x, y - Coordinates to raster tile.
56c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    INLINE static void StoreClear(
57542d7dec7b8748b164150bd0818e880ed31918e3Tim Rowley        const uint8_t* dstFormattedColor,
58c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        UINT dstBytesPerPixel,
59c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        SWR_SURFACE_STATE* pDstSurface,
601a80ec0cd1f3f66a33fc708e0112c88f4fba122dIlia Mirkin        UINT x, UINT y, // (x, y) pixel coordinate to start of raster tile.
611a80ec0cd1f3f66a33fc708e0112c88f4fba122dIlia Mirkin        uint32_t renderTargetArrayIndex)
62c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    {
63e0fc18a43590e120ae716670804fe26b0dd73878Ilia Mirkin        // If we're outside of the surface, stop.
64e0fc18a43590e120ae716670804fe26b0dd73878Ilia Mirkin        uint32_t lodWidth = std::max<uint32_t>(pDstSurface->width >> pDstSurface->lod, 1U);
65e0fc18a43590e120ae716670804fe26b0dd73878Ilia Mirkin        uint32_t lodHeight = std::max<uint32_t>(pDstSurface->height >> pDstSurface->lod, 1U);
66e0fc18a43590e120ae716670804fe26b0dd73878Ilia Mirkin        if (x >= lodWidth || y >= lodHeight)
67e0fc18a43590e120ae716670804fe26b0dd73878Ilia Mirkin            return;
68e0fc18a43590e120ae716670804fe26b0dd73878Ilia Mirkin
69c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        // Compute destination address for raster tile.
701a80ec0cd1f3f66a33fc708e0112c88f4fba122dIlia Mirkin        uint8_t* pDstTile = (uint8_t*)ComputeSurfaceAddress<false, false>(
711a80ec0cd1f3f66a33fc708e0112c88f4fba122dIlia Mirkin                x, y, pDstSurface->arrayIndex + renderTargetArrayIndex,
721a80ec0cd1f3f66a33fc708e0112c88f4fba122dIlia Mirkin                pDstSurface->arrayIndex + renderTargetArrayIndex,
731a80ec0cd1f3f66a33fc708e0112c88f4fba122dIlia Mirkin                0, // sampleNum
741a80ec0cd1f3f66a33fc708e0112c88f4fba122dIlia Mirkin                pDstSurface->lod,
751a80ec0cd1f3f66a33fc708e0112c88f4fba122dIlia Mirkin                pDstSurface);
76c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley
77c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        // start of first row
78542d7dec7b8748b164150bd0818e880ed31918e3Tim Rowley        uint8_t* pDst = pDstTile;
79c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        UINT dstBytesPerRow = 0;
80c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley
81c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        // For each raster tile pixel in row 0 (rx, 0)
82e0fc18a43590e120ae716670804fe26b0dd73878Ilia Mirkin        for (UINT rx = 0; (rx < KNOB_TILE_X_DIM) && ((x + rx) < lodWidth); ++rx)
83c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        {
84c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley            memcpy(pDst, dstFormattedColor, dstBytesPerPixel);
85c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley
86c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley            // Increment pointer to next pixel in row.
87c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley            pDst += dstBytesPerPixel;
88c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley            dstBytesPerRow += dstBytesPerPixel;
89c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        }
90c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley
91c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        // start of second row
92c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        pDst = pDstTile + pDstSurface->pitch;
93c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley
94c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        // For each remaining row in the rest of the raster tile
95e0fc18a43590e120ae716670804fe26b0dd73878Ilia Mirkin        for (UINT ry = 1; (ry < KNOB_TILE_Y_DIM) && ((y + ry) < lodHeight); ++ry)
96c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        {
97c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley            // copy row
98c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley            memcpy(pDst, pDstTile, dstBytesPerRow);
99c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley
100c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley            // Increment pointer to first pixel in next row.
101c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley            pDst += pDstSurface->pitch;
102c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        }
103c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    }
104c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley};
105c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley
106c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley//////////////////////////////////////////////////////////////////////////
107c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley/// StoreMacroTileClear - Stores a macro tile clear to its raster tiles.
108c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley//////////////////////////////////////////////////////////////////////////
109c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowleytemplate<SWR_FORMAT SrcFormat, SWR_FORMAT DstFormat>
110c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowleystruct StoreMacroTileClear
111c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley{
112c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    //////////////////////////////////////////////////////////////////////////
113c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    /// @brief Stores a macrotile to the destination surface.
114c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    /// @param pColor - Pointer to color to write to pixels.
115c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    /// @param pDstSurface - Destination surface state
116c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    /// @param x, y - Coordinates to macro tile
117c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    static void StoreClear(
118643857f596529f4887eaa13e5d336efd6da371adTim Rowley        const float *pColor,
119c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        SWR_SURFACE_STATE* pDstSurface,
1201a80ec0cd1f3f66a33fc708e0112c88f4fba122dIlia Mirkin        UINT x, UINT y, uint32_t renderTargetArrayIndex)
121c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    {
122c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        UINT dstBytesPerPixel = (FormatTraits<DstFormat>::bpp / 8);
123c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley
124542d7dec7b8748b164150bd0818e880ed31918e3Tim Rowley        uint8_t dstFormattedColor[16]; // max bpp is 128, so 16 is all we need here for one pixel
125c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley
126643857f596529f4887eaa13e5d336efd6da371adTim Rowley        float srcColor[4];
127c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley
128c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        for (UINT comp = 0; comp < FormatTraits<DstFormat>::numComps; ++comp)
129c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        {
130c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley            srcColor[comp] = pColor[FormatTraits<DstFormat>::swizzle(comp)];
131c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        }
132c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley
133c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        // using this helper function, but the Tiling Traits is unused inside it so just using a dummy value
134c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        ConvertPixelFromFloat<DstFormat>(dstFormattedColor, srcColor);
135c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley
136c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        // Store each raster tile from the hot tile to the destination surface.
137c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        // TODO:  Put in check for partial coverage on x/y -- SWR_ASSERT if it happens.
138c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        //        Intent is for this function to only handle full tiles.
139c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        for (UINT row = 0; row < KNOB_MACROTILE_Y_DIM; row += KNOB_TILE_Y_DIM)
140c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        {
141c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley            for (UINT col = 0; col < KNOB_MACROTILE_X_DIM; col += KNOB_TILE_X_DIM)
142c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley            {
1431a80ec0cd1f3f66a33fc708e0112c88f4fba122dIlia Mirkin                StoreRasterTileClear<SrcFormat, DstFormat>::StoreClear(dstFormattedColor, dstBytesPerPixel, pDstSurface, (x + col), (y + row), renderTargetArrayIndex);
144c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley            }
145c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        }
146c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    }
147c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley};
148c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley
149c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley//////////////////////////////////////////////////////////////////////////
150c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley/// @brief Writes clear color to every pixel of a render surface
151c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley/// @param hPrivateContext - Handle to private DC
152c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley/// @param renderTargetIndex - Index to destination render target
153c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley/// @param x, y - Coordinates to raster tile.
154c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley/// @param pClearColor - Pointer to clear color
155c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowleyvoid StoreHotTileClear(
156c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    SWR_SURFACE_STATE *pDstSurface,
157c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
158c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    UINT x,
159c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    UINT y,
1601a80ec0cd1f3f66a33fc708e0112c88f4fba122dIlia Mirkin    uint32_t renderTargetArrayIndex,
161c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    const float* pClearColor)
162c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley{
163c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    PFN_STORE_TILES_CLEAR pfnStoreTilesClear = NULL;
164c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley
1652fca08e550ae0c4b036ee8fc34dcf98d45d6bf20Ilia Mirkin    if (renderTargetIndex == SWR_ATTACHMENT_STENCIL)
166c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    {
1672fca08e550ae0c4b036ee8fc34dcf98d45d6bf20Ilia Mirkin        SWR_ASSERT(pDstSurface->format == R8_UINT);
1682fca08e550ae0c4b036ee8fc34dcf98d45d6bf20Ilia Mirkin        pfnStoreTilesClear = StoreMacroTileClear<R8_UINT, R8_UINT>::StoreClear;
169c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    }
1702fca08e550ae0c4b036ee8fc34dcf98d45d6bf20Ilia Mirkin    else if (renderTargetIndex == SWR_ATTACHMENT_DEPTH)
171c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    {
172c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley        pfnStoreTilesClear = sStoreTilesClearDepthTable[pDstSurface->format];
173c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    }
1742fca08e550ae0c4b036ee8fc34dcf98d45d6bf20Ilia Mirkin    else
1752fca08e550ae0c4b036ee8fc34dcf98d45d6bf20Ilia Mirkin    {
1762fca08e550ae0c4b036ee8fc34dcf98d45d6bf20Ilia Mirkin        pfnStoreTilesClear = sStoreTilesClearColorTable[pDstSurface->format];
1772fca08e550ae0c4b036ee8fc34dcf98d45d6bf20Ilia Mirkin    }
178c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley
179c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    SWR_ASSERT(pfnStoreTilesClear != NULL);
180c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley
181c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    // Store a macro tile.
182c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    /// @todo Once all formats are supported then if check can go away. This is to help us near term to make progress.
183c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    if (pfnStoreTilesClear != NULL)
184c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    {
1851a80ec0cd1f3f66a33fc708e0112c88f4fba122dIlia Mirkin        pfnStoreTilesClear(pClearColor, pDstSurface, x, y, renderTargetArrayIndex);
186c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    }
187c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley}
188c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley
189c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley//////////////////////////////////////////////////////////////////////////
190c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley/// INIT_STORE_TILES_TABLE - Helper macro for setting up the tables.
191c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley#define INIT_STORE_TILES_CLEAR_COLOR_TABLE() \
192c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    memset(sStoreTilesClearColorTable, 0, sizeof(sStoreTilesClearColorTable)); \
193c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    \
194c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R32G32B32A32_FLOAT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R32G32B32A32_FLOAT>::StoreClear; \
195c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R32G32B32A32_SINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R32G32B32A32_SINT>::StoreClear; \
196c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R32G32B32A32_UINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R32G32B32A32_UINT>::StoreClear; \
197c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R32G32B32X32_FLOAT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R32G32B32X32_FLOAT>::StoreClear; \
198c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R32G32B32_FLOAT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R32G32B32_FLOAT>::StoreClear; \
199c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R32G32B32_SINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R32G32B32_SINT>::StoreClear; \
200c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R32G32B32_UINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R32G32B32_UINT>::StoreClear; \
201c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R16G16B16A16_UNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R16G16B16A16_UNORM>::StoreClear; \
202c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R16G16B16A16_SNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R16G16B16A16_SNORM>::StoreClear; \
203c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R16G16B16A16_SINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R16G16B16A16_SINT>::StoreClear; \
204c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R16G16B16A16_UINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R16G16B16A16_UINT>::StoreClear; \
205c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R16G16B16A16_FLOAT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R16G16B16A16_FLOAT>::StoreClear; \
206c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R32G32_FLOAT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R32G32_FLOAT>::StoreClear; \
207c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R32G32_SINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R32G32_SINT>::StoreClear; \
208c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R32G32_UINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R32G32_UINT>::StoreClear; \
209c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R16G16B16X16_UNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R16G16B16X16_UNORM>::StoreClear; \
210c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R16G16B16X16_FLOAT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R16G16B16X16_FLOAT>::StoreClear; \
211c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[B8G8R8A8_UNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, B8G8R8A8_UNORM>::StoreClear; \
212c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[B8G8R8A8_UNORM_SRGB]      = StoreMacroTileClear<R32G32B32A32_FLOAT, B8G8R8A8_UNORM_SRGB>::StoreClear; \
213c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R10G10B10A2_UNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R10G10B10A2_UNORM>::StoreClear; \
214c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R10G10B10A2_UNORM_SRGB]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R10G10B10A2_UNORM_SRGB>::StoreClear; \
215c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R10G10B10A2_UINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R10G10B10A2_UINT>::StoreClear; \
216c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R8G8B8A8_UNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R8G8B8A8_UNORM>::StoreClear; \
217c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R8G8B8A8_UNORM_SRGB]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R8G8B8A8_UNORM_SRGB>::StoreClear; \
218c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R8G8B8A8_SNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R8G8B8A8_SNORM>::StoreClear; \
219c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R8G8B8A8_SINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R8G8B8A8_SINT>::StoreClear; \
220c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R8G8B8A8_UINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R8G8B8A8_UINT>::StoreClear; \
221c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R16G16_UNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R16G16_UNORM>::StoreClear; \
222c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R16G16_SNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R16G16_SNORM>::StoreClear; \
223c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R16G16_SINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R16G16_SINT>::StoreClear; \
224c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R16G16_UINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R16G16_UINT>::StoreClear; \
225c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R16G16_FLOAT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R16G16_FLOAT>::StoreClear; \
226c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[B10G10R10A2_UNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, B10G10R10A2_UNORM>::StoreClear; \
227c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[B10G10R10A2_UNORM_SRGB]      = StoreMacroTileClear<R32G32B32A32_FLOAT, B10G10R10A2_UNORM_SRGB>::StoreClear; \
228c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R11G11B10_FLOAT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R11G11B10_FLOAT>::StoreClear; \
229c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R32_SINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R32_SINT>::StoreClear; \
230c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R32_UINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R32_UINT>::StoreClear; \
231c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R32_FLOAT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R32_FLOAT>::StoreClear; \
232c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[A32_FLOAT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, A32_FLOAT>::StoreClear; \
233c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[B8G8R8X8_UNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, B8G8R8X8_UNORM>::StoreClear; \
234c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[B8G8R8X8_UNORM_SRGB]      = StoreMacroTileClear<R32G32B32A32_FLOAT, B8G8R8X8_UNORM_SRGB>::StoreClear; \
235c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R8G8B8X8_UNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R8G8B8X8_UNORM>::StoreClear; \
236c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R8G8B8X8_UNORM_SRGB]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R8G8B8X8_UNORM_SRGB>::StoreClear; \
237c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[B10G10R10X2_UNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, B10G10R10X2_UNORM>::StoreClear; \
238c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[B5G6R5_UNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, B5G6R5_UNORM>::StoreClear; \
239c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[B5G6R5_UNORM_SRGB]      = StoreMacroTileClear<R32G32B32A32_FLOAT, B5G6R5_UNORM_SRGB>::StoreClear; \
240c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[B5G5R5A1_UNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, B5G5R5A1_UNORM>::StoreClear; \
241c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[B5G5R5A1_UNORM_SRGB]      = StoreMacroTileClear<R32G32B32A32_FLOAT, B5G5R5A1_UNORM_SRGB>::StoreClear; \
242c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[B4G4R4A4_UNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, B4G4R4A4_UNORM>::StoreClear; \
243c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[B4G4R4A4_UNORM_SRGB]      = StoreMacroTileClear<R32G32B32A32_FLOAT, B4G4R4A4_UNORM_SRGB>::StoreClear; \
244c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R8G8_UNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R8G8_UNORM>::StoreClear; \
245c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R8G8_SNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R8G8_SNORM>::StoreClear; \
246c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R8G8_SINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R8G8_SINT>::StoreClear; \
247c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R8G8_UINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R8G8_UINT>::StoreClear; \
248c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R16_UNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R16_UNORM>::StoreClear; \
249c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R16_SNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R16_SNORM>::StoreClear; \
250c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R16_SINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R16_SINT>::StoreClear; \
251c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R16_UINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R16_UINT>::StoreClear; \
252c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R16_FLOAT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R16_FLOAT>::StoreClear; \
253c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[A16_UNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, A16_UNORM>::StoreClear; \
254c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[A16_FLOAT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, A16_FLOAT>::StoreClear; \
255c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[B5G5R5X1_UNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, B5G5R5X1_UNORM>::StoreClear; \
256c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[B5G5R5X1_UNORM_SRGB]      = StoreMacroTileClear<R32G32B32A32_FLOAT, B5G5R5X1_UNORM_SRGB>::StoreClear; \
257c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R8_UNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R8_UNORM>::StoreClear; \
258c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R8_SNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R8_SNORM>::StoreClear; \
259c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R8_SINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R8_SINT>::StoreClear; \
260c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R8_UINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R8_UINT>::StoreClear; \
261c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[A8_UNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, A8_UNORM>::StoreClear; \
262c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[BC1_UNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, BC1_UNORM>::StoreClear; \
263c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[BC2_UNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, BC2_UNORM>::StoreClear; \
264c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[BC3_UNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, BC3_UNORM>::StoreClear; \
265c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[BC4_UNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, BC4_UNORM>::StoreClear; \
266c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[BC5_UNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, BC5_UNORM>::StoreClear; \
267c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[BC1_UNORM_SRGB]      = StoreMacroTileClear<R32G32B32A32_FLOAT, BC1_UNORM_SRGB>::StoreClear; \
268c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[BC2_UNORM_SRGB]      = StoreMacroTileClear<R32G32B32A32_FLOAT, BC2_UNORM_SRGB>::StoreClear; \
269c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[BC3_UNORM_SRGB]      = StoreMacroTileClear<R32G32B32A32_FLOAT, BC3_UNORM_SRGB>::StoreClear; \
270c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R8G8B8_UNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R8G8B8_UNORM>::StoreClear; \
271c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R8G8B8_SNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R8G8B8_SNORM>::StoreClear; \
272c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[BC4_SNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, BC4_SNORM>::StoreClear; \
273c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[BC5_SNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, BC5_SNORM>::StoreClear; \
274c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R16G16B16_FLOAT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R16G16B16_FLOAT>::StoreClear; \
275c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R16G16B16_UNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R16G16B16_UNORM>::StoreClear; \
276c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R16G16B16_SNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R16G16B16_SNORM>::StoreClear; \
277c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R8G8B8_UNORM_SRGB]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R8G8B8_UNORM_SRGB>::StoreClear; \
278c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R16G16B16_UINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R16G16B16_UINT>::StoreClear; \
279c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R16G16B16_SINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R16G16B16_SINT>::StoreClear; \
280c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R10G10B10A2_SNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R10G10B10A2_SNORM>::StoreClear; \
281c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R10G10B10A2_SINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R10G10B10A2_SINT>::StoreClear; \
282c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[B10G10R10A2_SNORM]      = StoreMacroTileClear<R32G32B32A32_FLOAT, B10G10R10A2_SNORM>::StoreClear; \
283c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[B10G10R10A2_UINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, B10G10R10A2_UINT>::StoreClear; \
284c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[B10G10R10A2_SINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, B10G10R10A2_SINT>::StoreClear; \
285c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R8G8B8_UINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R8G8B8_UINT>::StoreClear; \
286c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearColorTable[R8G8B8_SINT]      = StoreMacroTileClear<R32G32B32A32_FLOAT, R8G8B8_SINT>::StoreClear; \
287c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley
288c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley//////////////////////////////////////////////////////////////////////////
289c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley/// INIT_STORE_TILES_TABLE - Helper macro for setting up the tables.
290c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley#define INIT_STORE_TILES_CLEAR_DEPTH_TABLE() \
291c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    memset(sStoreTilesClearDepthTable, 0, sizeof(sStoreTilesClearDepthTable)); \
292c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    \
293c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearDepthTable[R32_FLOAT] = StoreMacroTileClear<R32_FLOAT, R32_FLOAT>::StoreClear; \
2945582610ea190e52e49c60aa8fe18bebfe2466cdeIlia Mirkin    sStoreTilesClearDepthTable[R32_FLOAT_X8X24_TYPELESS] = StoreMacroTileClear<R32_FLOAT, R32_FLOAT_X8X24_TYPELESS>::StoreClear; \
295c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    sStoreTilesClearDepthTable[R24_UNORM_X8_TYPELESS] = StoreMacroTileClear<R32_FLOAT, R24_UNORM_X8_TYPELESS>::StoreClear; \
2965582610ea190e52e49c60aa8fe18bebfe2466cdeIlia Mirkin    sStoreTilesClearDepthTable[R16_UNORM] = StoreMacroTileClear<R32_FLOAT, R16_UNORM>::StoreClear; \
297c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley
298c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley//////////////////////////////////////////////////////////////////////////
299c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley/// @brief Sets up tables for ClearTile
300c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowleyvoid InitSimClearTilesTable()
301c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley{
302c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    INIT_STORE_TILES_CLEAR_COLOR_TABLE();
303c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley    INIT_STORE_TILES_CLEAR_DEPTH_TABLE();
304c6e67f5a9373e916a8d2333585cb5787aa5f7bb7Tim Rowley}
305