Move all the code for computing ctx->_TriangleCaps into state.c.