Replace std::llround() with (int64_t) cast in optic_gpu for linux compatibility (no C++23)

This commit is contained in:
Stephen Saunders 2023-05-13 10:07:47 -04:00
parent be6088eee4
commit cf7883f688
2 changed files with 2 additions and 2 deletions

View file

@ -62,7 +62,7 @@ namespace Optick
int64_t GetCPUTimestamp(int64_t gpuTimestamp)
{
// SRS - Improve accuracy of GPU to CPU timestamp conversion by using floating point doubles
return timestampCPU + std::llround(double(gpuTimestamp - timestampGPU) * (double)frequencyCPU / (double)frequencyGPU);
return timestampCPU + (int64_t)(double(gpuTimestamp - timestampGPU) * (double)frequencyCPU / (double)frequencyGPU);
}
ClockSynchronization() : frequencyCPU(0), frequencyGPU(0), timestampCPU(0), timestampGPU(0) {}

View file

@ -452,7 +452,7 @@ namespace Optick
clock.frequencyCPU = GetHighPrecisionFrequency();
VkPhysicalDeviceProperties Properties;
(*vulkanFunctions.vkGetPhysicalDeviceProperties)(nodePayloads[nodeIndex]->physicalDevice, &Properties);
clock.frequencyGPU = std::llround(1000000000.0 / (double)Properties.limits.timestampPeriod);
clock.frequencyGPU = (int64_t)(1000000000.0 / (double)Properties.limits.timestampPeriod);
// SRS - Reset entire query pool to clear clock sync query + any leftover queries from previous run
(*vulkanFunctions.vkBeginCommandBuffer)(CB, &commandBufferBeginInfo);