From: Tim Rowley Date: Sat, 22 Apr 2017 03:14:16 +0000 (-0500) Subject: swr/rast: add memory api to SwrGetInterface() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=18d5c452d04ff426158051b6bfea41af41c0059d;p=mesa.git swr/rast: add memory api to SwrGetInterface() Reviewed-by: Bruce Cherniak --- diff --git a/src/gallium/drivers/swr/rasterizer/core/api.cpp b/src/gallium/drivers/swr/rasterizer/core/api.cpp index a3870be6c7b..1d581ac21e3 100644 --- a/src/gallium/drivers/swr/rasterizer/core/api.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/api.cpp @@ -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; } diff --git a/src/gallium/drivers/swr/rasterizer/core/api.h b/src/gallium/drivers/swr/rasterizer/core/api.h index 0b07608efb2..f9f3573561b 100644 --- a/src/gallium/drivers/swr/rasterizer/core/api.h +++ b/src/gallium/drivers/swr/rasterizer/core/api.h @@ -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" { diff --git a/src/gallium/drivers/swr/rasterizer/memory/ClearTile.cpp b/src/gallium/drivers/swr/rasterizer/memory/ClearTile.cpp index ee13f55b5a4..8a306cdce5a 100644 --- a/src/gallium/drivers/swr/rasterizer/memory/ClearTile.cpp +++ b/src/gallium/drivers/swr/rasterizer/memory/ClearTile.cpp @@ -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, diff --git a/src/gallium/drivers/swr/rasterizer/memory/LoadTile.cpp b/src/gallium/drivers/swr/rasterizer/memory/LoadTile.cpp index 7d8b32a82bf..9dbc16ad9ae 100644 --- a/src/gallium/drivers/swr/rasterizer/memory/LoadTile.cpp +++ b/src/gallium/drivers/swr/rasterizer/memory/LoadTile.cpp @@ -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, diff --git a/src/gallium/drivers/swr/rasterizer/memory/StoreTile.cpp b/src/gallium/drivers/swr/rasterizer/memory/StoreTile.cpp index 446bca4e8d5..9c20669f77b 100644 --- a/src/gallium/drivers/swr/rasterizer/memory/StoreTile.cpp +++ b/src/gallium/drivers/swr/rasterizer/memory/StoreTile.cpp @@ -58,7 +58,7 @@ static std::vector 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, diff --git a/src/gallium/drivers/swr/swr_memory.h b/src/gallium/drivers/swr/swr_memory.h index 49b208ff35a..ec68df311a4 100644 --- a/src/gallium/drivers/swr/swr_memory.h +++ b/src/gallium/drivers/swr/swr_memory.h @@ -23,28 +23,6 @@ #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); }