1 | #include <vector> |
1 | #include <vector> |
|
|
2 | |
|
|
3 | #include "salloc.h" |
2 | |
4 | |
3 | struct rc_key_t |
5 | struct rc_key_t |
4 | { |
6 | { |
5 | GLenum mode; |
7 | GLenum mode; |
6 | GLenum format; // 0, GL_T2F_V3F, GL_V2F |
8 | GLenum format; // 0, GL_T2F_V3F, GL_V2F |
… | |
… | |
37 | uint8_t u, v, w, h; |
39 | uint8_t u, v, w, h; |
38 | uint16_t x, y; |
40 | uint16_t x, y; |
39 | }; |
41 | }; |
40 | |
42 | |
41 | struct array_t |
43 | struct array_t |
42 | : std::vector<uint8_t> |
44 | : std::vector<uint8_t, slice_allocator<uint8_t>> |
43 | { |
45 | { |
44 | using std::vector<uint8_t>::vector; |
46 | using std::vector<uint8_t, slice_allocator<uint8_t>>::vector; |
45 | |
47 | |
46 | template<typename T> |
48 | template<typename T> |
47 | T &append () |
49 | T &append () |
48 | { |
50 | { |
49 | auto ofs = size (); |
51 | auto ofs = size (); |
… | |
… | |
83 | } |
85 | } |
84 | } |
86 | } |
85 | }; |
87 | }; |
86 | |
88 | |
87 | int drawcount = 0; |
89 | int drawcount = 0; |
88 | ska::flat_hash_map<rc_key_t, array_t> h; |
90 | ska::flat_hash_map<rc_key_t, array_t, std::hash<rc_key_t>, std::equal_to<rc_key_t>, slice_allocator<rc_key_t>> h; |
89 | |
91 | |
90 | void clear () |
92 | void clear () |
91 | { |
93 | { |
92 | drawcount = 0; |
94 | drawcount = 0; |
93 | h.clear (); |
95 | h.clear (); |