swr/rast: add memory api to SwrGetInterface()
authorTim Rowley <timothy.o.rowley@intel.com>
Sat, 22 Apr 2017 03:14:16 +0000 (22:14 -0500)
committerTim Rowley <timothy.o.rowley@intel.com>
Sat, 29 Apr 2017 00:57:09 +0000 (19:57 -0500)
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
src/gallium/drivers/swr/rasterizer/core/api.cpp
src/gallium/drivers/swr/rasterizer/core/api.h
src/gallium/drivers/swr/rasterizer/memory/ClearTile.cpp
src/gallium/drivers/swr/rasterizer/memory/LoadTile.cpp
src/gallium/drivers/swr/rasterizer/memory/StoreTile.cpp
src/gallium/drivers/swr/swr_memory.h

index a3870be6c7bbabdc5b6d5cd7b0743ef3eb321ff5..1d581ac21e36bc75fac1a47491ce919982e6d14f 100644 (file)
@@ -1705,4 +1705,7 @@ void SwrGetInterface(SWR_INTERFACE &out_funcs)
     out_funcs.pfnSwrEnableStatsBE = SwrEnableStatsBE;
     out_funcs.pfnSwrEndFrame = SwrEndFrame;
     out_funcs.pfnSwrInit = SwrInit;
+    out_funcs.pfnSwrLoadHotTile = SwrLoadHotTile;
+    out_funcs.pfnSwrStoreHotTileToSurface = SwrStoreHotTileToSurface;
+    out_funcs.pfnSwrStoreHotTileClear = SwrStoreHotTileClear;
 }
index 0b07608efb24dd5b163e6a52757d593b7dc806a7..f9f3573561b90e8ec6d1d6564c7c8d8096d131c8 100644 (file)
@@ -660,6 +660,48 @@ SWR_FUNC(void, SwrEndFrame,
 SWR_FUNC(void, SwrInit);
 
 
+//////////////////////////////////////////////////////////////////////////
+/// @brief Loads a full hottile from a render surface
+/// @param hPrivateContext - Handle to private DC
+/// @param dstFormat - Format for hot tile.
+/// @param renderTargetIndex - Index to src render target
+/// @param x, y - Coordinates to raster tile.
+/// @param pDstHotTile - Pointer to Hot Tile
+SWR_FUNC(void, SwrLoadHotTile,
+    const SWR_SURFACE_STATE *pSrcSurface,
+    SWR_FORMAT dstFormat,
+    SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
+    uint32_t x, uint32_t y, uint32_t renderTargetArrayIndex,
+    uint8_t *pDstHotTile);
+
+//////////////////////////////////////////////////////////////////////////
+/// @brief Deswizzles and stores a full hottile to a render surface
+/// @param hPrivateContext - Handle to private DC
+/// @param srcFormat - Format for hot tile.
+/// @param renderTargetIndex - Index to destination render target
+/// @param x, y - Coordinates to raster tile.
+/// @param pSrcHotTile - Pointer to Hot Tile
+SWR_FUNC(void, SwrStoreHotTileToSurface,
+    SWR_SURFACE_STATE *pDstSurface,
+    SWR_FORMAT srcFormat,
+    SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
+    uint32_t x, uint32_t y, uint32_t renderTargetArrayIndex,
+    uint8_t *pSrcHotTile);
+
+//////////////////////////////////////////////////////////////////////////
+/// @brief Writes clear color to every pixel of a render surface
+/// @param hPrivateContext - Handle to private DC
+/// @param renderTargetIndex - Index to destination render target
+/// @param x, y - Coordinates to raster tile.
+/// @param pClearColor - Pointer to clear color
+SWR_FUNC(void, SwrStoreHotTileClear,
+         SWR_SURFACE_STATE *pDstSurface,
+         SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
+         UINT x,
+         UINT y,
+         uint32_t renderTargetArrayIndex,
+         const float* pClearColor);
+
 struct SWR_INTERFACE
 {
     PFNSwrCreateContext pfnSwrCreateContext;
@@ -707,6 +749,9 @@ struct SWR_INTERFACE
     PFNSwrEnableStatsBE pfnSwrEnableStatsBE;
     PFNSwrEndFrame pfnSwrEndFrame;
     PFNSwrInit pfnSwrInit;
+    PFNSwrLoadHotTile pfnSwrLoadHotTile;
+    PFNSwrStoreHotTileToSurface pfnSwrStoreHotTileToSurface;
+    PFNSwrStoreHotTileClear pfnSwrStoreHotTileClear;
 };
 
 extern "C" {
index ee13f55b5a43b190b75048e94865c6c21d5157c5..8a306cdce5a20eed0311759f60f5bd69a5240397 100644 (file)
@@ -152,7 +152,7 @@ struct StoreMacroTileClear
 /// @param renderTargetIndex - Index to destination render target
 /// @param x, y - Coordinates to raster tile.
 /// @param pClearColor - Pointer to clear color
-void StoreHotTileClear(
+void SwrStoreHotTileClear(
     SWR_SURFACE_STATE *pDstSurface,
     SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
     UINT x,
index 7d8b32a82bf68bc3789365d1a086c1bf170b7b3d..9dbc16ad9ae526beff34237dfacff66856b5417b 100644 (file)
@@ -53,7 +53,7 @@ static std::mutex sBucketMutex;
 /// @param renderTargetIndex - Index to src render target
 /// @param x, y - Coordinates to raster tile.
 /// @param pDstHotTile - Pointer to Hot Tile
-void LoadHotTile(
+void SwrLoadHotTile(
     const SWR_SURFACE_STATE *pSrcSurface,
     SWR_FORMAT dstFormat,
     SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
index 446bca4e8d5455a5767ff255c100bdbadcf8b76d..9c20669f77ba0e6d8bb8a272dea1820a0ed31df4 100644 (file)
@@ -58,7 +58,7 @@ static std::vector<int32_t> sBuckets(NUM_SWR_FORMATS, -1);
 /// @param renderTargetIndex - Index to destination render target
 /// @param x, y - Coordinates to raster tile.
 /// @param pSrcHotTile - Pointer to Hot Tile
-void StoreHotTileToSurface(
+void SwrStoreHotTileToSurface(
     SWR_SURFACE_STATE *pDstSurface,
     SWR_FORMAT srcFormat,
     SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
index 49b208ff35a7977df4e70ff56b6e2ccc18e0de54..ec68df311a4834197c37e7fb210b7b829fb3dc01 100644 (file)
 
 #pragma once
 
-void LoadHotTile(
-    const SWR_SURFACE_STATE *pSrcSurface,
-    SWR_FORMAT dstFormat,
-    SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
-    UINT x, UINT y, uint32_t renderTargetArrayIndex,
-    uint8_t *pDstHotTile);
-
-void StoreHotTileToSurface(
-    SWR_SURFACE_STATE *pDstSurface,
-    SWR_FORMAT srcFormat,
-    SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
-    UINT x, UINT y, uint32_t renderTargetArrayIndex,
-    uint8_t *pSrcHotTile);
-
-void StoreHotTileClear(
-    SWR_SURFACE_STATE *pDstSurface,
-    SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
-    UINT x,
-    UINT y,
-    uint32_t renderTargetArrayIndex,
-    const float* pClearColor);
-
 INLINE void
 swr_LoadHotTile(HANDLE hPrivateContext,
                 SWR_FORMAT dstFormat,
@@ -56,7 +34,7 @@ swr_LoadHotTile(HANDLE hPrivateContext,
    swr_draw_context *pDC = (swr_draw_context*)hPrivateContext;
    SWR_SURFACE_STATE *pSrcSurface = &pDC->renderTargets[renderTargetIndex];
 
-   LoadHotTile(pSrcSurface, dstFormat, renderTargetIndex, x, y, renderTargetArrayIndex, pDstHotTile);
+   SwrLoadHotTile(pSrcSurface, dstFormat, renderTargetIndex, x, y, renderTargetArrayIndex, pDstHotTile);
 }
 
 INLINE void
@@ -70,7 +48,7 @@ swr_StoreHotTile(HANDLE hPrivateContext,
    swr_draw_context *pDC = (swr_draw_context*)hPrivateContext;
    SWR_SURFACE_STATE *pDstSurface = &pDC->renderTargets[renderTargetIndex];
 
-   StoreHotTileToSurface(pDstSurface, srcFormat, renderTargetIndex, x, y, renderTargetArrayIndex, pSrcHotTile);
+   SwrStoreHotTileToSurface(pDstSurface, srcFormat, renderTargetIndex, x, y, renderTargetArrayIndex, pSrcHotTile);
 }
 
 INLINE void
@@ -85,5 +63,5 @@ swr_StoreHotTileClear(HANDLE hPrivateContext,
    swr_draw_context *pDC = (swr_draw_context*)hPrivateContext;
    SWR_SURFACE_STATE *pDstSurface = &pDC->renderTargets[renderTargetIndex];
 
-   StoreHotTileClear(pDstSurface, renderTargetIndex, x, y, renderTargetArrayIndex, pClearColor);
+   SwrStoreHotTileClear(pDstSurface, renderTargetIndex, x, y, renderTargetArrayIndex, pClearColor);
 }