int RunVertices(int vtx_attr_group, int primitive, int count, DataReader src, bool skip_drawing, bool is_preprocess) { if (!count) return 0; VertexLoaderBase* loader = RefreshLoader(vtx_attr_group, is_preprocess); int size = count * loader->m_VertexSize; if ((int)src.size() < size) return -1; if (skip_drawing || is_preprocess) return size; // If the native vertex format changed, force a flush. if (loader->m_native_vertex_format != s_current_vtx_fmt || loader->m_native_components != g_current_components) { VertexManagerBase::Flush(); } s_current_vtx_fmt = loader->m_native_vertex_format; g_current_components = loader->m_native_components; // if cull mode is CULL_ALL, tell VertexManager to skip triangles and quads. // They still need to go through vertex loading, because we need to calculate a zfreeze refrence // slope. bool cullall = (bpmem.genMode.cullmode == GenMode::CULL_ALL && primitive < 5); DataReader dst = VertexManagerBase::PrepareForAdditionalData( primitive, count, loader->m_native_vtx_decl.stride, cullall); count = loader->RunVertices(src, dst, count); IndexGenerator::AddIndices(primitive, count); VertexManagerBase::FlushData(count, loader->m_native_vtx_decl.stride); ADDSTAT(stats.thisFrame.numPrims, count); INCSTAT(stats.thisFrame.numPrimitiveJoins); return size; }