[Mesa-dev] [PATCH v2 01/11] swr: [rasterizer core] Use CS spill/fill size in core

Tim Rowley timothy.o.rowley at intel.com
Fri Apr 22 00:37:39 UTC 2016


---
 src/gallium/drivers/swr/rasterizer/core/api.cpp     | 4 +++-
 src/gallium/drivers/swr/rasterizer/core/api.h       | 6 ++++--
 src/gallium/drivers/swr/rasterizer/core/backend.cpp | 3 +--
 src/gallium/drivers/swr/rasterizer/core/context.h   | 1 +
 4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/core/api.cpp b/src/gallium/drivers/swr/rasterizer/core/api.cpp
index ca9cfdb..06cbf7f 100644
--- a/src/gallium/drivers/swr/rasterizer/core/api.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/api.cpp
@@ -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(
diff --git a/src/gallium/drivers/swr/rasterizer/core/api.h b/src/gallium/drivers/swr/rasterizer/core/api.h
index 90c2f03..04cdb9e 100644
--- a/src/gallium/drivers/swr/rasterizer/core/api.h
+++ b/src/gallium/drivers/swr/rasterizer/core/api.h
@@ -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.
diff --git a/src/gallium/drivers/swr/rasterizer/core/backend.cpp b/src/gallium/drivers/swr/rasterizer/core/backend.cpp
index b2d3d9e..d8ffdaa 100644
--- a/src/gallium/drivers/swr/rasterizer/core/backend.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/backend.cpp
@@ -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);
diff --git a/src/gallium/drivers/swr/rasterizer/core/context.h b/src/gallium/drivers/swr/rasterizer/core/context.h
index 6464aa2..540c690 100644
--- a/src/gallium/drivers/swr/rasterizer/core/context.h
+++ b/src/gallium/drivers/swr/rasterizer/core/context.h
@@ -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;
-- 
1.9.1



More information about the mesa-dev mailing list