Change GetTimestampFrequency to return float

This commit is contained in:
Evan Hemsley 2026-05-18 16:55:31 -07:00
parent e594c6d193
commit 100e3d8c5a
5 changed files with 20 additions and 2 deletions

View file

@ -4571,7 +4571,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUFence(
*
* \sa SDL_CreateGPUQueryPool
*/
extern SDL_DECLSPEC Uint64 SDLCALL SDL_GetGPUTimestampFrequency(SDL_GPUDevice *device);
extern SDL_DECLSPEC float SDLCALL SDL_GetGPUTimestampFrequency(SDL_GPUDevice *device);
/**
* Creates a query pool object to be used in queries.

View file

@ -1326,7 +1326,7 @@ SDL_DYNAPI_PROC(bool,SDL_HasSVE2,(void),(),return)
SDL_DYNAPI_PROC(bool,SDL_GamepadHasCapSense,(SDL_Gamepad *a,SDL_GamepadCapSenseType b),(a,b),return)
SDL_DYNAPI_PROC(bool,SDL_GetGamepadCapSense,(SDL_Gamepad *a,SDL_GamepadCapSenseType b),(a,b),return)
SDL_DYNAPI_PROC(void,SDL_CopyGPUQueryResultsToBuffer,(SDL_GPUCopyPass *a,SDL_GPUQueryPool *b,Uint32 c,Uint32 d,SDL_GPUBufferLocation *e),(a,b,c,d,e),)
SDL_DYNAPI_PROC(Uint64,SDL_GetGPUTimestampFrequency,(SDL_GPUDevice *a),(a),return)
SDL_DYNAPI_PROC(float,SDL_GetGPUTimestampFrequency,(SDL_GPUDevice *a),(a),return)
SDL_DYNAPI_PROC(SDL_GPUQueryPool*,SDL_CreateGPUQueryPool,(SDL_GPUDevice *a,SDL_GPUQueryPoolCreateInfo *b),(a,b),return)
SDL_DYNAPI_PROC(void,SDL_BeginGPUQuery,(SDL_GPUCommandBuffer *a,SDL_GPUQueryPool *b,Uint32 c),(a,b,c),)
SDL_DYNAPI_PROC(void,SDL_EndGPUQuery,(SDL_GPUCommandBuffer *a,SDL_GPUQueryPool *b,Uint32 c),(a,b,c),)

View file

@ -3541,6 +3541,13 @@ void SDL_ReleaseGPUFence(
fence);
}
float SDL_GetGPUTimestampFrequency(SDL_GPUDevice *device)
{
CHECK_DEVICE_MAGIC(device, 0);
return device->GetTimestampFrequency(device->driverData);
}
SDL_GPUQueryPool *SDL_CreateGPUQueryPool(
SDL_GPUDevice *device,
SDL_GPUQueryPoolCreateInfo *createinfo)

View file

@ -1104,6 +1104,10 @@ struct SDL_GPUDevice
SDL_GPURenderer *driverData,
SDL_GPUFence *fence);
float (*GetTimestampFrequency)(
SDL_GPURenderer *device
);
SDL_GPUQueryPool *(*CreateQueryPool)(
SDL_GPURenderer *driverData,
SDL_GPUQueryPoolCreateInfo *createinfo);
@ -1240,6 +1244,7 @@ struct SDL_GPUDevice
ASSIGN_DRIVER_FUNC(WaitForFences, name) \
ASSIGN_DRIVER_FUNC(QueryFence, name) \
ASSIGN_DRIVER_FUNC(ReleaseFence, name) \
ASSIGN_DRIVER_FUNC(GetTimestampFrequency, name) \
ASSIGN_DRIVER_FUNC(CreateQueryPool, name) \
ASSIGN_DRIVER_FUNC(BeginQuery, name) \
ASSIGN_DRIVER_FUNC(EndQuery, name) \

View file

@ -7123,6 +7123,12 @@ static SDL_GPUTransferBuffer *VULKAN_CreateTransferBuffer(
debugName);
}
static float VULKAN_GetTimestampFrequency(SDL_GPURenderer *driverData)
{
VulkanRenderer *renderer = (VulkanRenderer *)driverData;
return renderer->physicalDeviceProperties.properties.limits.timestampPeriod;
}
static SDL_GPUQueryPool *VULKAN_CreateQueryPool(
SDL_GPURenderer *driverData,
SDL_GPUQueryPoolCreateInfo *createinfo)