diff options
author | Bruce Cherniak <[email protected]> | 2016-05-24 15:00:17 -0500 |
---|---|---|
committer | Tim Rowley <[email protected]> | 2016-05-25 18:47:16 -0500 |
commit | c8835a592471a0238e296f6529b5dadb431cc622 (patch) | |
tree | 2e75f1fcde19886777c15f4a6ca471cdc0dc3604 /src/gallium/drivers/swr/rasterizer | |
parent | 978ab88858170b219cf6b66eaac11e89ae2f0ce9 (diff) |
swr: [rasterizer] Correctly select optimized primitive assembly.
Indexed primitives were always using cut-aware primitive assembly,
whether primitive_restart was enabled or not. Correctly pass down
primitive_restart and select optimized PA when possible.
Reviewed-by: Tim Rowley <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr/rasterizer')
5 files changed, 11 insertions, 5 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/core/api.cpp b/src/gallium/drivers/swr/rasterizer/core/api.cpp index 8e0c1e1d2d8..2e6f8b3a16d 100644 --- a/src/gallium/drivers/swr/rasterizer/core/api.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/api.cpp @@ -1069,6 +1069,7 @@ void DrawInstanced( pDC->FeWork.type = DRAW; pDC->FeWork.pfnWork = GetProcessDrawFunc( false, // IsIndexed + false, // bEnableCutIndex pState->tsState.tsEnable, pState->gsState.gsEnable, pState->soState.soEnable, @@ -1202,6 +1203,7 @@ void DrawIndexedInstance( pDC->FeWork.type = DRAW; pDC->FeWork.pfnWork = GetProcessDrawFunc( true, // IsIndexed + pState->frontendState.bEnableCutIndex, pState->tsState.tsEnable, pState->gsState.gsEnable, pState->soState.soEnable, diff --git a/src/gallium/drivers/swr/rasterizer/core/frontend.cpp b/src/gallium/drivers/swr/rasterizer/core/frontend.cpp index d6643c65ae0..ef90a24fe75 100644 --- a/src/gallium/drivers/swr/rasterizer/core/frontend.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/frontend.cpp @@ -1159,6 +1159,7 @@ static void TessellationStages( /// @param pUserData - Pointer to DRAW_WORK template < typename IsIndexedT, + typename IsCutIndexEnabledT, typename HasTessellationT, typename HasGeometryShaderT, typename HasStreamOutT, @@ -1283,7 +1284,7 @@ void ProcessDraw( } // choose primitive assembler - PA_FACTORY<IsIndexedT> paFactory(pDC, state.topology, work.numVerts); + PA_FACTORY<IsIndexedT, IsCutIndexEnabledT> paFactory(pDC, state.topology, work.numVerts); PA_STATE& pa = paFactory.GetPA(); /// @todo: temporarily move instance loop in the FE to ensure SO ordering @@ -1434,12 +1435,13 @@ struct FEDrawChooser // Selector for correct templated Draw front-end function PFN_FE_WORK_FUNC GetProcessDrawFunc( bool IsIndexed, + bool IsCutIndexEnabled, bool HasTessellation, bool HasGeometryShader, bool HasStreamOut, bool HasRasterization) { - return TemplateArgUnroller<FEDrawChooser>::GetFunc(IsIndexed, HasTessellation, HasGeometryShader, HasStreamOut, HasRasterization); + return TemplateArgUnroller<FEDrawChooser>::GetFunc(IsIndexed, IsCutIndexEnabled, HasTessellation, HasGeometryShader, HasStreamOut, HasRasterization); } diff --git a/src/gallium/drivers/swr/rasterizer/core/frontend.h b/src/gallium/drivers/swr/rasterizer/core/frontend.h index e1b040015a9..dfd3987bdfb 100644 --- a/src/gallium/drivers/swr/rasterizer/core/frontend.h +++ b/src/gallium/drivers/swr/rasterizer/core/frontend.h @@ -322,6 +322,7 @@ uint32_t NumVertsPerPrim(PRIMITIVE_TOPOLOGY topology, bool includeAdjVerts); // ProcessDraw front-end function. All combinations of parameter values are available PFN_FE_WORK_FUNC GetProcessDrawFunc( bool IsIndexed, + bool IsCutIndexEnabled, bool HasTessellation, bool HasGeometryShader, bool HasStreamOut, diff --git a/src/gallium/drivers/swr/rasterizer/core/pa.h b/src/gallium/drivers/swr/rasterizer/core/pa.h index c98ea14e244..6aa73c1ddf1 100644 --- a/src/gallium/drivers/swr/rasterizer/core/pa.h +++ b/src/gallium/drivers/swr/rasterizer/core/pa.h @@ -1149,14 +1149,14 @@ private: // Primitive Assembler factory class, responsible for creating and initializing the correct assembler // based on state. -template <typename IsIndexedT> +template <typename IsIndexedT, typename IsCutIndexEnabledT> struct PA_FACTORY { PA_FACTORY(DRAW_CONTEXT* pDC, PRIMITIVE_TOPOLOGY in_topo, uint32_t numVerts) : topo(in_topo) { #if KNOB_ENABLE_CUT_AWARE_PA == TRUE const API_STATE& state = GetApiState(pDC); - if ((IsIndexedT::value && ( + if ((IsIndexedT::value && IsCutIndexEnabledT::value && ( topo == TOP_TRIANGLE_STRIP || topo == TOP_POINT_LIST || topo == TOP_LINE_LIST || topo == TOP_LINE_STRIP || topo == TOP_TRIANGLE_LIST || topo == TOP_LINE_LIST_ADJ || diff --git a/src/gallium/drivers/swr/rasterizer/core/state.h b/src/gallium/drivers/swr/rasterizer/core/state.h index f4813e42395..5156c6b1322 100644 --- a/src/gallium/drivers/swr/rasterizer/core/state.h +++ b/src/gallium/drivers/swr/rasterizer/core/state.h @@ -799,6 +799,7 @@ struct SWR_FRONTEND_STATE // skip clip test, perspective divide, and viewport transform // intended for verts in screen space bool vpTransformDisable; + bool bEnableCutIndex; union { struct @@ -808,7 +809,7 @@ struct SWR_FRONTEND_STATE uint32_t triStripList : 2; }; uint32_t bits; - }provokingVertex; + } provokingVertex; uint32_t topologyProvokingVertex; // provoking vertex for the draw topology }; |