swr/rast: add SwrInit() to init backend/memory tables
authorTim Rowley <timothy.o.rowley@intel.com>
Fri, 21 Apr 2017 15:21:19 +0000 (10:21 -0500)
committerTim Rowley <timothy.o.rowley@intel.com>
Sat, 29 Apr 2017 00:56:50 +0000 (19:56 -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/core/backend.h
src/gallium/drivers/swr/swr_context.cpp
src/gallium/drivers/swr/swr_memory.h

index 4554aaa3ec721ae137a0dc6cd67ed2752c26e18e..a3870be6c7bbabdc5b6d5cd7b0743ef3eb321ff5 100644 (file)
@@ -143,9 +143,6 @@ HANDLE SwrCreateContext(
     // initialize hot tile manager
     pContext->pHotTileMgr = new HotTileMgr();
 
-    // initialize function pointer tables
-    InitClearTilesTable();
-
     // initialize callback functions
     pContext->pfnLoadTile = pCreateInfo->pfnLoadTile;
     pContext->pfnStoreTile = pCreateInfo->pfnStoreTile;
@@ -1641,6 +1638,25 @@ void SWR_API SwrEndFrame(
     pContext->frameCount++;
 }
 
+void InitSimLoadTilesTable();
+void InitSimStoreTilesTable();
+void InitSimClearTilesTable();
+
+void InitClearTilesTable();
+void InitBackendFuncTables();
+
+//////////////////////////////////////////////////////////////////////////
+/// @brief Initialize swr backend and memory internal tables
+void SwrInit()
+{
+    InitSimLoadTilesTable();
+    InitSimStoreTilesTable();
+    InitSimClearTilesTable();
+
+    InitClearTilesTable();
+    InitBackendFuncTables();
+}
+
 
 void SwrGetInterface(SWR_INTERFACE &out_funcs)
 {
@@ -1688,4 +1704,5 @@ void SwrGetInterface(SWR_INTERFACE &out_funcs)
     out_funcs.pfnSwrEnableStatsFE = SwrEnableStatsFE;
     out_funcs.pfnSwrEnableStatsBE = SwrEnableStatsBE;
     out_funcs.pfnSwrEndFrame = SwrEndFrame;
+    out_funcs.pfnSwrInit = SwrInit;
 }
index eacf0a84171e5b0a6fb32fa1ef25a7e70b16d737..0b07608efb24dd5b163e6a52757d593b7dc806a7 100644 (file)
@@ -655,6 +655,10 @@ SWR_FUNC(void, SwrEnableStatsBE,
 SWR_FUNC(void, SwrEndFrame,
     HANDLE hContext);
 
+//////////////////////////////////////////////////////////////////////////
+/// @brief Initialize swr backend and memory internal tables
+SWR_FUNC(void, SwrInit);
+
 
 struct SWR_INTERFACE
 {
@@ -702,6 +706,7 @@ struct SWR_INTERFACE
     PFNSwrEnableStatsFE pfnSwrEnableStatsFE;
     PFNSwrEnableStatsBE pfnSwrEnableStatsBE;
     PFNSwrEndFrame pfnSwrEndFrame;
+    PFNSwrInit pfnSwrInit;
 };
 
 extern "C" {
index 7787332281ca70146b3e466fee02da6abba00a72..7bb1f5585fbd62bd79086a8f8efade449c1dfa89 100644 (file)
@@ -41,10 +41,7 @@ void ProcessStoreTilesBE(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t macroTil
 void ProcessDiscardInvalidateTilesBE(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t macroTile, void *pData);
 void ProcessShutdownBE(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t macroTile, void *pUserData);
 void BackendNullPS(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t x, uint32_t y, SWR_TRIANGLE_DESC &work, RenderOutputBuffers &renderBuffers);
-void InitClearTilesTable();
 simdmask ComputeUserClipMask(uint8_t clipMask, float* pUserClipBuffer, simdscalar vI, simdscalar vJ);
-void InitBackendFuncTables();
-void InitCPSFuncTables();
 void CalcSampleBarycentrics(const BarycentricCoeffs& coeffs, SWR_PS_CONTEXT &psContext);
 
 extern PFN_BACKEND_FUNC gBackendPixelRateTable[SWR_MULTISAMPLE_TYPE_COUNT]
index aa5cca8e653e2c36df95f4ccde28d513661df9ab..e8e465196db3886cf0b5b6e14a607c5d5e7a193b 100644 (file)
@@ -553,10 +553,7 @@ swr_create_context(struct pipe_screen *p_screen, void *priv, unsigned flags)
    createInfo.pfnUpdateStatsFE = swr_UpdateStatsFE;
    ctx->swrContext = SwrCreateContext(&createInfo);
 
-   /* Init Load/Store/ClearTiles Tables */
-   swr_InitMemoryModule();
-
-   InitBackendFuncTables();
+   SwrInit();
 
    if (ctx->swrContext == NULL)
       goto fail;
index b8ce27f4d9671676c4015827b0b9c1bd54726f8d..49b208ff35a7977df4e70ff56b6e2ccc18e0de54 100644 (file)
@@ -87,15 +87,3 @@ swr_StoreHotTileClear(HANDLE hPrivateContext,
 
    StoreHotTileClear(pDstSurface, renderTargetIndex, x, y, renderTargetArrayIndex, pClearColor);
 }
-
-void InitSimLoadTilesTable();
-void InitSimStoreTilesTable();
-void InitSimClearTilesTable();
-
-/* Init Load/Store/ClearTiles Tables */
-INLINE void swr_InitMemoryModule()
-{
-   InitSimLoadTilesTable();
-   InitSimStoreTilesTable();
-   InitSimClearTilesTable();
-}