+ if (ctx->vs->info.base.num_outputs) {
+ // gs does not adjust for position in SGV slot at input from vs
+ if (!ctx->gs && !ctx->tcs && !ctx->tes)
+ feState.vsVertexSize--;
+ }
+
+ // other (non-SGV) slots start at VERTEX_ATTRIB_START_SLOT
+ feState.vsVertexSize += VERTEX_ATTRIB_START_SLOT;
+
+ // The PA in the clipper does not handle BE vertex sizes
+ // different from FE. Increase vertexsize only for the cases that needed it
+
+ // primid needs a slot
+ if (ctx->fs->info.base.uses_primid)
+ feState.vsVertexSize++;
+ // sprite coord enable
+ if (ctx->rasterizer->sprite_coord_enable)
+ feState.vsVertexSize++;
+
+ if (ctx->rasterizer->flatshade_first) {
+ feState.provokingVertex = {1, 0, 0};
+ } else {
+ feState.provokingVertex = {2, 1, 2};
+ }
+
+ enum pipe_prim_type topology;
+ if (ctx->gs)
+ topology = (pipe_prim_type)ctx->gs->info.base.properties[TGSI_PROPERTY_GS_OUTPUT_PRIM];
+ else
+ topology = info->mode;
+
+ switch (topology) {
+ case PIPE_PRIM_TRIANGLE_FAN:
+ feState.topologyProvokingVertex = feState.provokingVertex.triFan;
+ break;
+ case PIPE_PRIM_TRIANGLE_STRIP:
+ case PIPE_PRIM_TRIANGLES:
+ feState.topologyProvokingVertex = feState.provokingVertex.triStripList;
+ break;
+ case PIPE_PRIM_QUAD_STRIP:
+ case PIPE_PRIM_QUADS:
+ if (ctx->rasterizer->flatshade_first)
+ feState.topologyProvokingVertex = 0;
+ else
+ feState.topologyProvokingVertex = 3;
+ break;
+ case PIPE_PRIM_LINES:
+ case PIPE_PRIM_LINE_LOOP:
+ case PIPE_PRIM_LINE_STRIP:
+ feState.topologyProvokingVertex = feState.provokingVertex.lineStripList;
+ break;
+ default:
+ feState.topologyProvokingVertex = 0;
+ }
+
+ feState.bEnableCutIndex = info->primitive_restart;
+ ctx->api.pfnSwrSetFrontendState(ctx->swrContext, &feState);
+
+ if (info->index_size)
+ ctx->api.pfnSwrDrawIndexedInstanced(ctx->swrContext,
+ swr_convert_prim_topology(info->mode, info->vertices_per_patch),
+ info->count,
+ info->instance_count,
+ info->start,
+ info->index_bias,
+ info->start_instance);