From 244ae7af1ba4ea8c5160b9da8db5e652e19b1a01 Mon Sep 17 00:00:00 2001 From: Tim Rowley Date: Sun, 3 Apr 2016 23:20:58 -0600 Subject: [PATCH] swr: [rasterizer core] Use CS spill/fill size in core Reviewed-by: Bruce Cherniak --- 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 ca9cfdb629e..06cbf7fb93d 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 90c2f038c46..04cdb9e4e65 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 b2d3d9ef4f4..d8ffdaa3ab4 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 6464aa20af7..540c690556a 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; -- 2.30.2