@@ -1223,30 +1223,52 @@ bool ArrayValueToVertexAttribute(
12231223 }
12241224
12251225 if (auto pv = value.as <UnderlyingTy>()) {
1226- if (variability == VertexVariability::Constant) {
1226+ switch (variability) {
1227+ case VertexVariability::Constant: {
12271228 if (value_counts != elementSize) {
12281229 PUSH_ERROR_AND_RETURN (fmt::format (
1229- " # of items {} expected, but got {}. Variability = Constant" ,
1230- elementSize, value_counts));
1230+ " {} # of items {} expected, but got {}. Variability = Constant" ,
1231+ name, elementSize, value_counts));
12311232 }
1232- } else if (variability == VertexVariability::Uniform) {
1233+ break ;
1234+ }
1235+ case VertexVariability::Uniform: {
12331236 if (value_counts != (elementSize * num_face_counts)) {
12341237 PUSH_ERROR_AND_RETURN (fmt::format (
1235- " # of items {} expected, but got {}. Variability = Uniform" ,
1236- elementSize * num_face_counts, value_counts));
1238+ " {} # of items {} expected, but got {}. Variability = Uniform" ,
1239+ name, elementSize * num_face_counts, value_counts));
12371240 }
1238- } else if (variability == VertexVariability::Vertex) {
1241+ break ;
1242+ }
1243+ case VertexVariability::Vertex: {
1244+ if (value_counts != (elementSize * num_vertices)) {
1245+ PUSH_ERROR_AND_RETURN (fmt::format (
1246+ " {} # of items {} expected, but got {}. Variability = Vertex" ,
1247+ name, elementSize * num_vertices, value_counts));
1248+ }
1249+ break ;
1250+ case VertexVariability::Varying: {
12391251 if (value_counts != (elementSize * num_vertices)) {
12401252 PUSH_ERROR_AND_RETURN (fmt::format (
1241- " # of items {} expected, but got {}. Variability = Vertex " ,
1242- elementSize * num_vertices, value_counts));
1253+ " {} # of items {} expected, but got {}. Variability = Varying " ,
1254+ name, elementSize * num_vertices, value_counts));
12431255 }
1244- } else { // facevarying
1256+ break ;
1257+ }
1258+ case VertexVariability::FaceVarying: {
12451259 if (value_counts != (elementSize * num_face_vertex_indices)) {
12461260 PUSH_ERROR_AND_RETURN (fmt::format (
12471261 " # of items {} expected, but got {}. Variability = FaceVarying" ,
12481262 elementSize * num_face_vertex_indices, value_counts));
12491263 }
1264+ break ;
1265+ }
1266+ case VertexVariability::Indexed: {
1267+ PUSH_ERROR_AND_RETURN (fmt::format (
1268+ " {} Internal error. 'Indexed' variability is not supported." ));
1269+ }
1270+ break ;
1271+ }
12501272 }
12511273
12521274 dst.data .resize (value_counts * baseTySize);
0 commit comments