diff options
author | Tim Rowley <[email protected]> | 2017-05-31 11:24:08 -0500 |
---|---|---|
committer | Tim Rowley <[email protected]> | 2017-06-16 16:20:16 -0500 |
commit | 36ac8ba511bc1dd634194ac7a86dc4a527db7a2e (patch) | |
tree | 79ddffd622a14597acaccef19df04a2d13e9c1ee /src/gallium/drivers/swr/rasterizer | |
parent | 8716e0d8b45194f34b57ec963d95abbcf40b66c4 (diff) |
swr/rast: Remove explicit primitive id slot in the vertex layout
- Remove any special casing in the PS stage when primitive ID is input.
Treat as a normal attribute that must be set up properly in the FE linkage.
- Remove primitive id from the PS_CONTEXT and TRI_FLAGS
Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr/rasterizer')
5 files changed, 6 insertions, 43 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/core/backend.h b/src/gallium/drivers/swr/rasterizer/core/backend.h index dba5041140f..035948652bc 100644 --- a/src/gallium/drivers/swr/rasterizer/core/backend.h +++ b/src/gallium/drivers/swr/rasterizer/core/backend.h @@ -498,7 +498,6 @@ void SetupPixelShaderContext(SWR_PS_CONTEXT *psContext, const SWR_MULTISAMPLE_PO psContext->pAttribs = work.pAttribs; psContext->pPerspAttribs = work.pPerspAttribs; psContext->frontFace = work.triFlags.frontFacing; - psContext->primID = work.triFlags.primID; psContext->renderTargetArrayIndex = work.triFlags.renderTargetArrayIndex; // save Ia/Ib/Ic and Ja/Jb/Jc if we need to reevaluate i/j/k in the shader because of pull attribs diff --git a/src/gallium/drivers/swr/rasterizer/core/binner.cpp b/src/gallium/drivers/swr/rasterizer/core/binner.cpp index daadd5f3d33..06078cdcfa1 100644 --- a/src/gallium/drivers/swr/rasterizer/core/binner.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/binner.cpp @@ -809,7 +809,6 @@ endBinTriangles: TRIANGLE_WORK_DESC &desc = work.desc.tri; desc.triFlags.frontFacing = state.forceFront ? 1 : ((frontFaceMask >> triIndex) & 1); - desc.triFlags.primID = pPrimID[triIndex]; desc.triFlags.renderTargetArrayIndex = aRTAI[triIndex]; desc.triFlags.viewportIndex = pViewportIndex[triIndex]; @@ -1257,7 +1256,6 @@ endBinTriangles: TRIANGLE_WORK_DESC &desc = work.desc.tri; desc.triFlags.frontFacing = state.forceFront ? 1 : ((frontFaceMask >> triIndex) & 1); - desc.triFlags.primID = pPrimID[triIndex]; desc.triFlags.renderTargetArrayIndex = aRTAI[triIndex]; desc.triFlags.viewportIndex = pViewportIndex[triIndex]; @@ -1451,7 +1449,6 @@ void BinPostSetupPoints( // points are always front facing desc.triFlags.frontFacing = 1; - desc.triFlags.primID = pPrimID[primIndex]; desc.triFlags.renderTargetArrayIndex = aRTAI[primIndex]; desc.triFlags.viewportIndex = pViewportIndex[primIndex]; @@ -1601,7 +1598,6 @@ void BinPostSetupPoints( TRIANGLE_WORK_DESC &desc = work.desc.tri; desc.triFlags.frontFacing = 1; - desc.triFlags.primID = pPrimID[primIndex]; desc.triFlags.pointSize = aPointSize[primIndex]; desc.triFlags.renderTargetArrayIndex = aRTAI[primIndex]; desc.triFlags.viewportIndex = pViewportIndex[primIndex]; @@ -1823,7 +1819,6 @@ void BinPostSetupPoints_simd16( // points are always front facing desc.triFlags.frontFacing = 1; - desc.triFlags.primID = pPrimID[primIndex]; desc.triFlags.renderTargetArrayIndex = aRTAI[primIndex]; desc.triFlags.viewportIndex = pViewportIndex[primIndex]; @@ -1978,7 +1973,6 @@ void BinPostSetupPoints_simd16( TRIANGLE_WORK_DESC &desc = work.desc.tri; desc.triFlags.frontFacing = 1; - desc.triFlags.primID = pPrimID[primIndex]; desc.triFlags.pointSize = aPointSize[primIndex]; desc.triFlags.renderTargetArrayIndex = aRTAI[primIndex]; desc.triFlags.viewportIndex = pViewportIndex[primIndex]; @@ -2246,7 +2240,6 @@ void BinPostSetupLines( TRIANGLE_WORK_DESC &desc = work.desc.tri; desc.triFlags.frontFacing = 1; - desc.triFlags.primID = pPrimID[primIndex]; desc.triFlags.yMajor = (yMajorMask >> primIndex) & 1; desc.triFlags.renderTargetArrayIndex = aRTAI[primIndex]; desc.triFlags.viewportIndex = pViewportIndex[primIndex]; @@ -2464,7 +2457,6 @@ void BinPostSetupLines_simd16( TRIANGLE_WORK_DESC &desc = work.desc.tri; desc.triFlags.frontFacing = 1; - desc.triFlags.primID = pPrimID[primIndex]; desc.triFlags.yMajor = (yMajorMask >> primIndex) & 1; desc.triFlags.renderTargetArrayIndex = aRTAI[primIndex]; desc.triFlags.viewportIndex = pViewportIndex[primIndex]; diff --git a/src/gallium/drivers/swr/rasterizer/core/context.h b/src/gallium/drivers/swr/rasterizer/core/context.h index 62332db173b..fa308feade2 100644 --- a/src/gallium/drivers/swr/rasterizer/core/context.h +++ b/src/gallium/drivers/swr/rasterizer/core/context.h @@ -62,7 +62,6 @@ struct TRI_FLAGS uint32_t coverageMask : (SIMD_TILE_X_DIM * SIMD_TILE_Y_DIM); uint32_t reserved : 32 - 1 - 1 - (SIMD_TILE_X_DIM * SIMD_TILE_Y_DIM); float pointSize; - uint32_t primID; uint32_t renderTargetArrayIndex; uint32_t viewportIndex; }; diff --git a/src/gallium/drivers/swr/rasterizer/core/frontend.cpp b/src/gallium/drivers/swr/rasterizer/core/frontend.cpp index dfbbc580b63..e2660c1cc90 100644 --- a/src/gallium/drivers/swr/rasterizer/core/frontend.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/frontend.cpp @@ -948,18 +948,7 @@ static void GeometryShaderStage( if (HasRastT::value && state.soState.streamToRasterizer == stream) { #if USE_SIMD16_FRONTEND - simd16scalari vPrimId; - // pull primitiveID from the GS output if available - if (state.gsState.emitsPrimitiveID) - { - simd16vector primIdAttrib[3]; - gsPa.Assemble_simd16(VERTEX_PRIMID_SLOT, primIdAttrib); - vPrimId = _simd16_castps_si(primIdAttrib[state.frontendState.topologyProvokingVertex].x); - } - else - { - vPrimId = _simd16_set1_epi32(pPrimitiveId[inputPrim]); - } + simd16scalari vPrimId = _simd16_set1_epi32(pPrimitiveId[inputPrim]); // use viewport array index if GS declares it as an output attribute. Otherwise use index 0. simd16scalari vViewPortIdx; @@ -983,18 +972,7 @@ static void GeometryShaderStage( gsPa.useAlternateOffset = false; pfnClipFunc(pDC, gsPa, workerId, attrib_simd16, GenMask(gsPa.NumPrims()), vPrimId, vViewPortIdx); #else - simdscalari vPrimId; - // pull primitiveID from the GS output if available - if (state.gsState.emitsPrimitiveID) - { - simdvector primIdAttrib[3]; - gsPa.Assemble(VERTEX_PRIMID_SLOT, primIdAttrib); - vPrimId = _simd_castps_si(primIdAttrib[state.frontendState.topologyProvokingVertex].x); - } - else - { - vPrimId = _simd_set1_epi32(pPrimitiveId[inputPrim]); - } + simdscalari vPrimId = _simd_set1_epi32(pPrimitiveId[inputPrim]); // use viewport array index if GS declares it as an output attribute. Otherwise use index 0. simdscalari vViewPortIdx; diff --git a/src/gallium/drivers/swr/rasterizer/core/state.h b/src/gallium/drivers/swr/rasterizer/core/state.h index 3db637036cd..f7030511474 100644 --- a/src/gallium/drivers/swr/rasterizer/core/state.h +++ b/src/gallium/drivers/swr/rasterizer/core/state.h @@ -186,11 +186,10 @@ enum SWR_VTX_SLOTS VERTEX_ATTRIB_START_SLOT = ( 1 + VERTEX_POSITION_END_SLOT), VERTEX_ATTRIB_END_SLOT = (32 + VERTEX_POSITION_END_SLOT), VERTEX_RTAI_SLOT = (33 + VERTEX_POSITION_END_SLOT), // GS writes RenderTargetArrayIndex here - VERTEX_PRIMID_SLOT = (34 + VERTEX_POSITION_END_SLOT), // GS writes PrimId here - VERTEX_CLIPCULL_DIST_LO_SLOT = (35 + VERTEX_POSITION_END_SLOT), // VS writes lower 4 clip/cull dist - VERTEX_CLIPCULL_DIST_HI_SLOT = (36 + VERTEX_POSITION_END_SLOT), // VS writes upper 4 clip/cull dist - VERTEX_POINT_SIZE_SLOT = (37 + VERTEX_POSITION_END_SLOT), // VS writes point size here - VERTEX_VIEWPORT_ARRAY_INDEX_SLOT = (38 + VERTEX_POSITION_END_SLOT), + VERTEX_CLIPCULL_DIST_LO_SLOT = (34 + VERTEX_POSITION_END_SLOT), // VS writes lower 4 clip/cull dist + VERTEX_CLIPCULL_DIST_HI_SLOT = (35 + VERTEX_POSITION_END_SLOT), // VS writes upper 4 clip/cull dist + VERTEX_POINT_SIZE_SLOT = (36 + VERTEX_POSITION_END_SLOT), // VS writes point size here + VERTEX_VIEWPORT_ARRAY_INDEX_SLOT = (37 + VERTEX_POSITION_END_SLOT), SWR_VTX_NUM_SLOTS = VERTEX_VIEWPORT_ARRAY_INDEX_SLOT, }; @@ -343,7 +342,6 @@ struct SWR_PS_CONTEXT // OUT: result color per rendertarget uint32_t frontFace; // IN: front- 1, back- 0 - uint32_t primID; // IN: primitive ID uint32_t sampleIndex; // IN: sampleIndex uint32_t renderTargetArrayIndex; // IN: render target array index from GS uint32_t rasterizerSampleCount; // IN: sample count used by the rasterizer @@ -716,9 +714,6 @@ struct SWR_GS_STATE // geometry shader emits renderTargetArrayIndex bool emitsRenderTargetArrayIndex; - // geometry shader emits PrimitiveID - bool emitsPrimitiveID; - // geometry shader emits ViewportArrayIndex bool emitsViewportArrayIndex; |