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)
// 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.
// 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
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];
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
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");