mirror of https://github.com/bjornbytes/lovr.git
Compare commits
2 Commits
f9cfc4e76e
...
4719dbdd10
Author | SHA1 | Date |
---|---|---|
bjorn | 4719dbdd10 | |
bjorn | 9068c8daee |
|
@ -1721,10 +1721,12 @@ void lovrGraphicsSubmit(Pass** passes, uint32_t count) {
|
|||
gpu_stream* stream = streams[streamCount++] = gpu_stream_begin(NULL);
|
||||
|
||||
// Timestamp Readback
|
||||
BufferView view = getBuffer(GPU_BUFFER_DOWNLOAD, 2 * count * sizeof(uint32_t), 4);
|
||||
gpu_copy_tally_buffer(stream, state.timestamps, view.buffer, 0, view.offset, 2 * count);
|
||||
Readback* readback = lovrReadbackCreateTimestamp(times, count, view);
|
||||
lovrRelease(readback, lovrReadbackDestroy); // It gets freed when it completes
|
||||
if (state.timingEnabled) {
|
||||
BufferView view = getBuffer(GPU_BUFFER_DOWNLOAD, 2 * count * sizeof(uint32_t), 4);
|
||||
gpu_copy_tally_buffer(stream, state.timestamps, view.buffer, 0, view.offset, 2 * count);
|
||||
Readback* readback = lovrReadbackCreateTimestamp(times, count, view);
|
||||
lovrRelease(readback, lovrReadbackDestroy); // It gets freed when it completes
|
||||
}
|
||||
|
||||
// OpenXR Swapchain Layout Transitions
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
|
|
26
src/util.c
26
src/util.c
|
@ -129,32 +129,6 @@ void map_set(map_t* map, uint64_t hash, uint64_t value) {
|
|||
map->values[h] = value;
|
||||
}
|
||||
|
||||
void map_remove(map_t* map, uint64_t hash) {
|
||||
uint64_t h = map_find(map, hash);
|
||||
|
||||
if (map->hashes[h] == MAP_NIL) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint64_t mask = map->size - 1;
|
||||
uint64_t i = h;
|
||||
|
||||
do {
|
||||
i = (i + 1) & mask;
|
||||
uint64_t x = map->hashes[i] & mask;
|
||||
// Removing a key from an open-addressed hash table is complicated
|
||||
if ((i > h && (x <= h || x > i)) || (i < h && (x <= h && x > i))) {
|
||||
map->hashes[h] = map->hashes[i];
|
||||
map->values[h] = map->values[i];
|
||||
h = i;
|
||||
}
|
||||
} while (map->hashes[i] != MAP_NIL);
|
||||
|
||||
map->hashes[i] = MAP_NIL;
|
||||
map->values[i] = MAP_NIL;
|
||||
map->used--;
|
||||
}
|
||||
|
||||
// UTF-8
|
||||
// https://github.com/starwing/luautf8
|
||||
size_t utf8_decode(const char *s, const char *e, unsigned *pch) {
|
||||
|
|
|
@ -89,7 +89,7 @@ static inline void _arr_reserve(void** data, size_t n, size_t* capacity, size_t
|
|||
lovrAssert(*data, "Out of memory");
|
||||
}
|
||||
|
||||
// Hashmap
|
||||
// Hashmap (does not support removal)
|
||||
typedef struct {
|
||||
uint64_t* hashes;
|
||||
uint64_t* values;
|
||||
|
@ -103,7 +103,6 @@ void map_init(map_t* map, uint32_t n);
|
|||
void map_free(map_t* map);
|
||||
uint64_t map_get(map_t* map, uint64_t hash);
|
||||
void map_set(map_t* map, uint64_t hash, uint64_t value);
|
||||
void map_remove(map_t* map, uint64_t hash);
|
||||
|
||||
// UTF-8
|
||||
size_t utf8_decode(const char *s, const char *e, unsigned *pch);
|
||||
|
|
Loading…
Reference in New Issue