Rename timer tally type to time;

This commit is contained in:
bjorn 2022-07-17 13:17:33 -07:00
parent 83fa750a4d
commit 92201b87a1
5 changed files with 11 additions and 11 deletions

View File

@ -169,7 +169,7 @@ StringEntry lovrStencilAction[] = {
};
StringEntry lovrTallyType[] = {
[TALLY_TIMER] = ENTRY("timer"),
[TALLY_TIME] = ENTRY("time"),
[TALLY_SHADER] = ENTRY("shader"),
[TALLY_PIXEL] = ENTRY("pixel"),
{ 0 }

View File

@ -453,7 +453,7 @@ void gpu_pipeline_destroy(gpu_pipeline* pipeline);
// Tally
typedef enum {
GPU_TALLY_TIMER,
GPU_TALLY_TIME,
GPU_TALLY_SHADER,
GPU_TALLY_PIXEL
} gpu_tally_type;

View File

@ -1371,7 +1371,7 @@ void gpu_pipeline_destroy(gpu_pipeline* pipeline) {
bool gpu_tally_init(gpu_tally* tally, gpu_tally_info* info) {
VkQueryType queryTypes[] = {
[GPU_TALLY_TIMER] = VK_QUERY_TYPE_TIMESTAMP,
[GPU_TALLY_TIME] = VK_QUERY_TYPE_TIMESTAMP,
[GPU_TALLY_SHADER] = VK_QUERY_TYPE_PIPELINE_STATISTICS,
[GPU_TALLY_PIXEL] = VK_QUERY_TYPE_OCCLUSION
};

View File

@ -2841,14 +2841,14 @@ Tally* lovrTallyCreate(const TallyInfo* info) {
tally->info = *info;
tally->gpu = (gpu_tally*) (tally + 1);
uint32_t total = info->count * (info->type == TALLY_TIMER ? 2 * info->views : 1);
uint32_t total = info->count * (info->type == TALLY_TIME ? 2 * info->views : 1);
gpu_tally_init(tally->gpu, &(gpu_tally_info) {
.type = (gpu_tally_type) info->type,
.count = total
});
if (info->type == TALLY_TIMER) {
if (info->type == TALLY_TIME) {
tally->buffer = calloc(1, gpu_sizeof_buffer());
lovrAssert(tally->buffer, "Out of memory");
gpu_buffer_init(tally->buffer, &(gpu_buffer_info) {
@ -4881,7 +4881,7 @@ void lovrPassCopyTallyToBuffer(Pass* pass, Tally* tally, Buffer* buffer, uint32_
lovrCheck(dstOffset + count * 4 <= buffer->size, "Buffer copy range goes past the end of the destination Buffer");
lovrCheck(dstOffset % 4 == 0, "Buffer copy offset must be a multiple of 4");
if (tally->info.type == TALLY_TIMER) {
if (tally->info.type == TALLY_TIME) {
lovrTallyResolve(tally, srcIndex, count, buffer->gpu, dstOffset, pass->stream);
trackBuffer(pass, buffer, GPU_PHASE_SHADER_COMPUTE, GPU_CACHE_STORAGE_WRITE);
} else {
@ -5023,7 +5023,7 @@ Readback* lovrPassReadTally(Pass* pass, Tally* tally, uint32_t index, uint32_t c
.tally.count = count
});
if (tally->info.type == TALLY_TIMER) {
if (tally->info.type == TALLY_TIME) {
lovrTallyResolve(tally, index, count, readback->buffer, 0, pass->stream);
} else {
uint32_t stride = tally->info.type == TALLY_SHADER ? 16 : 4;
@ -5038,12 +5038,12 @@ void lovrPassTick(Pass* pass, Tally* tally, uint32_t index) {
lovrCheck(index < tally->info.count, "Trying to use tally slot #%d, but the tally only has %d slots", index + 1, tally->info.count);
if (tally->tick != state.tick) {
uint32_t multiplier = tally->info.type == TALLY_TIMER ? 2 * tally->info.count * tally->info.views : 1;
uint32_t multiplier = tally->info.type == TALLY_TIME ? 2 * tally->info.count * tally->info.views : 1;
gpu_clear_tally(state.stream, tally->gpu, 0, tally->info.count * multiplier);
tally->tick = state.tick;
}
if (tally->info.type == TALLY_TIMER) {
if (tally->info.type == TALLY_TIME) {
gpu_tally_mark(pass->stream, tally->gpu, index * 2 * tally->info.views);
} else {
gpu_tally_begin(pass->stream, tally->gpu, index);
@ -5054,7 +5054,7 @@ void lovrPassTock(Pass* pass, Tally* tally, uint32_t index) {
lovrCheck(tally->info.views == pass->cameraCount, "Tally view count does not match Pass view count");
lovrCheck(index < tally->info.count, "Trying to use tally slot #%d, but the tally only has %d slots", index + 1, tally->info.count);
if (tally->info.type == TALLY_TIMER) {
if (tally->info.type == TALLY_TIME) {
gpu_tally_mark(pass->stream, tally->gpu, index * 2 * tally->info.views + tally->info.views);
} else {
gpu_tally_end(pass->stream, tally->gpu, index);

View File

@ -469,7 +469,7 @@ struct Image* lovrReadbackGetImage(Readback* readback);
// Tally
typedef enum {
TALLY_TIMER,
TALLY_TIME,
TALLY_SHADER,
TALLY_PIXEL
} TallyType;