Hi, I’m trying to calculate delta time with timestamp queries but when I multiply my camera movement code with delta time it causes jittering. Also I’m not sure which flags should i use.
std::array<uint64_t, 2> timestamps{};
vkGetQueryPoolResults(device->device, queryPool->queryPool, currentFrame * 2, 2, sizeof(uint64_t) * 2, timestamps.data(), sizeof(uint64_t), VK_QUERY_RESULT_WAIT_BIT | VK_QUERY_RESULT_64_BIT);
double deltaTimeInNanoseconds = (timestamps[1] - timestamps[0]) * device->timestampPeriod;
float deltaTime = deltaTimeInNanoseconds / 1000000000.0f;
Also I tried VK_QUERY_RESULT_WITH_AVAILABILITY_BIT but i got deltatime 0
std::array<uint64_t, 4> timestamps{};
vkGetQueryPoolResults(device->device, queryPool->queryPool, currentFrame * 2, 2, sizeof(uint64_t) * 4, timestamps.data(), sizeof(uint64_t) * 2, VK_QUERY_RESULT_WITH_AVAILABILITY_BIT | VK_QUERY_RESULT_64_BIT);
double deltaTimeInNanoseconds = (timestamps[2] - timestamps[0]) * device->timestampPeriod;
float deltaTime = deltaTimeInNanoseconds / 1000000000.0f;