swr: [rasterizer core] Use CS spill/fill size in core
authorTim Rowley <timothy.o.rowley@intel.com>
Mon, 4 Apr 2016 05:20:58 +0000 (23:20 -0600)
committerTim Rowley <timothy.o.rowley@intel.com>
Fri, 22 Apr 2016 23:47:02 +0000 (18:47 -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.cpp
src/gallium/drivers/swr/rasterizer/core/context.h

index ca9cfdb629eb2271d42efa75a46c95f62b7ec53d..06cbf7fb93d7ee691c21fc0e56ce2248d9abc96a 100644 (file)
@@ -527,11 +527,13 @@ void SwrSetGsFunc(
 void SwrSetCsFunc(
     HANDLE hContext,
     PFN_CS_FUNC pfnCsFunc,
-    uint32_t totalThreadsInGroup)
+    uint32_t totalThreadsInGroup,
+    uint32_t totalSpillFillSize)
 {
     API_STATE* pState = GetDrawState(GetContext(hContext));
     pState->pfnCsFunc = pfnCsFunc;
     pState->totalThreadsInGroup = totalThreadsInGroup;
+    pState->totalSpillFillSize = totalSpillFillSize;
 }
 
 void SwrSetTsState(
index 90c2f038c46bdf7f4cf520cfb34c80b4b20d1fba..04cdb9e4e65348ff64801381e43db44feae55294 100644 (file)
@@ -254,12 +254,14 @@ void SWR_API SwrSetGsFunc(
 //////////////////////////////////////////////////////////////////////////
 /// @brief Set compute shader
 /// @param hContext - Handle passed back from SwrCreateContext
-/// @param pState - Pointer to compute shader function
+/// @param pfnCsFunc - Pointer to compute shader function
 /// @param totalThreadsInGroup - product of thread group dimensions.
+/// @param totalSpillFillSize - size in bytes needed for spill/fill.
 void SWR_API SwrSetCsFunc(
     HANDLE hContext,
     PFN_CS_FUNC pfnCsFunc,
-    uint32_t totalThreadsInGroup);
+    uint32_t totalThreadsInGroup,
+    uint32_t totalSpillFillSize);
 
 //////////////////////////////////////////////////////////////////////////
 /// @brief Set tessellation state.
index b2d3d9ef4f4d9e1fe4ea216c0f6039d7138861cb..d8ffdaa3ab4291af93d20f7d034ea7a0f75633c6 100644 (file)
@@ -82,8 +82,7 @@ void ProcessComputeBE(DRAW_CONTEXT* pDC, uint32_t workerId, uint32_t threadGroup
     // Ensure spill fill memory has been allocated.
     if (pSpillFillBuffer == nullptr)
     {
-        ///@todo Add state which indicates the spill fill size.
-        pSpillFillBuffer = pDC->pArena->AllocAlignedSync(4 * sizeof(MEGABYTE), sizeof(float) * 8);
+        pSpillFillBuffer = pDC->pArena->AllocAlignedSync(pDC->pState->state.totalSpillFillSize, sizeof(float) * 8);
     }
 
     const API_STATE& state = GetApiState(pDC);
index 6464aa20af7cef4b8e7b708ec650d902357fede0..540c690556abd6387109a098410992513aee1f82 100644 (file)
@@ -245,6 +245,7 @@ OSALIGNLINE(struct) API_STATE
     // CS - Compute Shader
     PFN_CS_FUNC             pfnCsFunc;
     uint32_t                totalThreadsInGroup;
+    uint32_t                totalSpillFillSize;
 
     // FE - Frontend State
     SWR_FRONTEND_STATE      frontendState;