[Feat] (MG_State/Program): retrieve/generate layout location from/for program, and retrieve generated ubo size and all the offsets of members

This commit is contained in:
2025-08-13 23:14:22 +08:00
parent b7d5de7ce0
commit df444655e3
8 changed files with 102 additions and 3 deletions
+4 -1
View File
@@ -5,10 +5,13 @@ namespace MobileGL {
template <typename IndexType>
class IndexGenerator {
public:
explicit IndexGenerator(SizeT initial_capacity = 1024, IndexType first_index = 0) : next_index_(first_index) {
explicit IndexGenerator(SizeT initial_capacity = 1024, IndexType first_index = 1) {
const SizeT words_needed = (initial_capacity + 63) / 64;
is_valid_.resize(words_needed, ~0ull);
freed_indices_.reserve(initial_capacity);
std::vector<IndexType> valuesBeforeFirst(first_index);
std::iota(valuesBeforeFirst.begin(), valuesBeforeFirst.end(), 0);
Generate(valuesBeforeFirst.size(), valuesBeforeFirst.data());
}
void Generate(SizeT n, IndexType* indices) {