swr/rasterizer: Fix GS attributes processing

Input to GS is just a set of attributes, so remove explicit setup of
'position' which is meaningless for GS input processing.

Reviewed-by: Alok Hota <alok.hota@intel.com>
This commit is contained in:
Jan Zielinski 2019-08-02 11:59:03 +02:00
parent 6b96c94b5a
commit 2263e6a895
3 changed files with 10 additions and 24 deletions

View file

@ -851,29 +851,21 @@ static void GeometryShaderStage(DRAW_CONTEXT* pDC,
gsContext.inputVertStride = pState->inputVertStride;
for (uint32_t slot = 0; slot < pState->numInputAttribs; ++slot)
{
uint32_t srcAttribSlot = pState->srcVertexAttribOffset + slot;
uint32_t attribSlot = pState->vertexAttribOffset + slot;
pa.Assemble(srcAttribSlot, attrib);
uint32_t attribOffset = slot + pState->vertexAttribOffset;
pa.Assemble(attribOffset, attrib);
for (uint32_t i = 0; i < numVertsPerPrim; ++i)
{
gsContext.pVerts[attribSlot + pState->inputVertStride * i] = attrib[i];
gsContext.pVerts[attribOffset + pState->inputVertStride * i] = attrib[i];
}
}
// assemble position
pa.Assemble(VERTEX_POSITION_SLOT, attrib);
for (uint32_t i = 0; i < numVertsPerPrim; ++i)
{
gsContext.pVerts[VERTEX_POSITION_SLOT + pState->inputVertStride * i] = attrib[i];
}
// record valid prims from the frontend to avoid over binning the newly generated
// prims from the GS
#if USE_SIMD16_FRONTEND
uint32_t numInputPrims = numPrims_simd8;
#else
uint32_t numInputPrims = pa.NumPrims();
uint32_t numInputPrims = pa.NumPrims();
#endif
for (uint32_t instance = 0; instance < pState->instanceCount; ++instance)

View file

@ -747,13 +747,11 @@ struct SWR_GS_STATE
// Total amount of memory to allocate for one instance of the shader output in bytes
uint32_t allocationSize;
// Offset to the start of the attributes of the input vertices, in simdvector units, as read by
// the GS
// Offset to start reading data per input vertex in simdvector units. This can be used to
// skip over any vertex data output from the previous stage that is unused in the GS, removing
// unnecessary vertex processing.
uint32_t vertexAttribOffset;
// Offset to the attributes as stored by the preceding shader stage.
uint32_t srcVertexAttribOffset;
// Size of the control data section which contains cut or streamID data, in simdscalar units.
// Should be sized to handle the maximum number of verts output by the GS. Can be 0 if there are
// no cuts or streamID bits.
@ -772,10 +770,7 @@ struct SWR_GS_STATE
// shader is expected to store the final vertex count in the first dword of the gs output
// stream.
uint32_t staticVertexCount;
uint32_t pad;
};
static_assert(sizeof(SWR_GS_STATE) == 64, "Adjust padding to keep size (or remove this assert)");
//////////////////////////////////////////////////////////////////////////
/// SWR_TS_OUTPUT_TOPOLOGY - Defines data output by the tessellator / DS

View file

@ -555,7 +555,7 @@ BuilderSWR::CompileGS(struct swr_context *ctx, swr_jit_gs_key &key)
pGS->gsEnable = true;
pGS->numInputAttribs = info->num_inputs;
pGS->numInputAttribs = (VERTEX_ATTRIB_START_SLOT - VERTEX_POSITION_SLOT) + info->num_inputs;
pGS->outputTopology =
swr_convert_prim_topology(info->properties[TGSI_PROPERTY_GS_OUTPUT_PRIM]);
pGS->maxNumVerts = info->properties[TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES];
@ -565,8 +565,7 @@ BuilderSWR::CompileGS(struct swr_context *ctx, swr_jit_gs_key &key)
pGS->isSingleStream = true;
pGS->singleStreamID = 0;
pGS->vertexAttribOffset = VERTEX_ATTRIB_START_SLOT; // TODO: optimize
pGS->srcVertexAttribOffset = VERTEX_ATTRIB_START_SLOT; // TODO: optimize
pGS->vertexAttribOffset = VERTEX_POSITION_SLOT;
pGS->inputVertStride = pGS->numInputAttribs + pGS->vertexAttribOffset;
pGS->outputVertexSize = SWR_VTX_NUM_SLOTS;
pGS->controlDataSize = 8; // GS ouputs max of 8 32B units
@ -793,7 +792,7 @@ BuilderSWR::CompileVS(struct swr_context *ctx, swr_jit_vs_key &key)
pWorkerData->setName("pWorkerData");
Value *pVsCtx = &*argitr++;
pVsCtx->setName("vsCtx");
Value *consts_ptr = GEP(hPrivateData, {C(0), C(swr_draw_context_constantVS)});
consts_ptr->setName("vs_constants");