In Vulkan the index type goes in the pipeline state object.
void Batch::set_index_type(DataType t)
{
+ if(t==index_type)
+ return;
if(t!=UNSIGNED_SHORT && t!=UNSIGNED_INT)
throw invalid_argument("Batch::set_data_type");
if(t==UNSIGNED_SHORT && max_index>0xFFFE)
batches.back().use_buffer(ibuf, prev);
}
+ DataType existing_type = batches.front().get_index_type();
+ DataType added_type = batches.back().get_index_type();
+ if(existing_type!=added_type)
+ {
+ if(get_type_size(existing_type)>get_type_size(added_type))
+ batches.back().set_index_type(existing_type);
+ else
+ {
+ for(vector<Batch>::iterator i=batches.begin(); i!=batches.end(); ++i)
+ i->set_index_type(added_type);
+ }
+ }
+
check_buffers(INDEX_BUFFER);
}