swr: set dynamic vertex size
authorTim Rowley <timothy.o.rowley@intel.com>
Wed, 28 Jun 2017 14:54:32 +0000 (09:54 -0500)
committerTim Rowley <timothy.o.rowley@intel.com>
Thu, 29 Jun 2017 18:23:33 +0000 (13:23 -0500)
Reduces the memory footprint of the frontend processing by packing
vertices.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
src/gallium/drivers/swr/swr_draw.cpp

index f85076b74cc31042caceefd3f1b361b90bbc3201..f26b8e873c1f5637e6110a8191923a7be1241cad 100644 (file)
@@ -129,8 +129,10 @@ swr_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
     * XXX setup provokingVertex & topologyProvokingVertex */
    SWR_FRONTEND_STATE feState = {0};
 
-   /* XXX this value should be minimized based on the shader set */
-   feState.vsVertexSize = SWR_VTX_NUM_SLOTS;
+   feState.vsVertexSize =
+      VERTEX_ATTRIB_START_SLOT +
+      + ctx->vs->info.base.num_outputs
+      - (ctx->vs->info.base.writes_position ? 1 : 0);
 
    if (ctx->rasterizer->flatshade_first) {
       feState.provokingVertex = {1, 0, 0};