fake swapchain frame latency wait
This commit is contained in:
parent
c61e30d3a4
commit
11aec42474
@ -96,4 +96,4 @@
|
|||||||
|
|
||||||
#define VSYNC !RtcIsEnabled
|
#define VSYNC !RtcIsEnabled
|
||||||
#define AUDIO_ENABLED 0
|
#define AUDIO_ENABLED 0
|
||||||
#define FPS_LIMIT 0
|
#define FPS_LIMIT 300
|
||||||
|
|||||||
@ -2112,9 +2112,14 @@ void GPU_ReleaseSwapchain(GPU_Swapchain *swapchain)
|
|||||||
/* TODO */
|
/* TODO */
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPU_YieldOnSwapchain(GPU_Swapchain *swapchain)
|
void GPU_YieldOnSwapchain(GPU_Swapchain *gpu_swapchain)
|
||||||
{
|
{
|
||||||
/* TODO */
|
/* TODO: Actually yield, don't block */
|
||||||
|
GPU_D12_Swapchain *swapchain = (GPU_D12_Swapchain *)gpu_swapchain;
|
||||||
|
if (swapchain->waitable)
|
||||||
|
{
|
||||||
|
WaitForSingleObjectEx(swapchain->waitable, 1000, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i64 GPU_PresentSwapchain(GPU_Swapchain *gpu_swapchain, GPU_Resource *gpu_texture, Vec2I32 backbuffer_size, Vec2I32 dst, i32 vsync)
|
i64 GPU_PresentSwapchain(GPU_Swapchain *gpu_swapchain, GPU_Resource *gpu_texture, Vec2I32 backbuffer_size, Vec2I32 dst, i32 vsync)
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
//~ Tweakable defines
|
//~ Tweakable defines
|
||||||
|
|
||||||
#define GPU_D12_TearingIsAllowed 1
|
#define GPU_D12_TearingIsAllowed 1
|
||||||
#define GPU_D12_FrameLatency 0 /* TODO: Set this to 1 */
|
#define GPU_D12_FrameLatency 1
|
||||||
#define GPU_D12_SwapchainBufferCount 4
|
#define GPU_D12_SwapchainBufferCount 4
|
||||||
#define GPU_D12_SwapchainFlags (((GPU_D12_TearingIsAllowed != 0) * DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING) \
|
#define GPU_D12_SwapchainFlags (((GPU_D12_TearingIsAllowed != 0) * DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING) \
|
||||||
| ((GPU_D12_FrameLatency != 0) * DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT))
|
| ((GPU_D12_FrameLatency != 0) * DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT))
|
||||||
|
|||||||
@ -922,6 +922,7 @@ JobDef(Build, _, __)
|
|||||||
PushStringToList(arena, &cp.warnings_msvc, Lit("-wd4101")); /* unreferenced local variable */
|
PushStringToList(arena, &cp.warnings_msvc, Lit("-wd4101")); /* unreferenced local variable */
|
||||||
PushStringToList(arena, &cp.warnings_msvc, Lit("-wd4189")); /* local variable is initialized but not referenced */
|
PushStringToList(arena, &cp.warnings_msvc, Lit("-wd4189")); /* local variable is initialized but not referenced */
|
||||||
PushStringToList(arena, &cp.warnings_msvc, Lit("-wd4200")); /* nonstandard extension used: zero-sized array in struct/union */
|
PushStringToList(arena, &cp.warnings_msvc, Lit("-wd4200")); /* nonstandard extension used: zero-sized array in struct/union */
|
||||||
|
PushStringToList(arena, &cp.warnings_msvc, Lit("-wd4702")); /* unreachable code */
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Clang
|
//- Clang
|
||||||
|
|||||||
@ -2560,10 +2560,6 @@ JobDef(UpdateUserOrSleep, UNUSED sig, UNUSED id)
|
|||||||
P_Window *window = g->window;
|
P_Window *window = g->window;
|
||||||
{
|
{
|
||||||
__profn("User sleep");
|
__profn("User sleep");
|
||||||
{
|
|
||||||
__profn("Swapchain wait");
|
|
||||||
GPU_YieldOnSwapchain(g->swapchain);
|
|
||||||
}
|
|
||||||
#if FPS_LIMIT > 0
|
#if FPS_LIMIT > 0
|
||||||
{
|
{
|
||||||
__profn("Frame limiter wait");
|
__profn("Frame limiter wait");
|
||||||
@ -2571,6 +2567,10 @@ JobDef(UpdateUserOrSleep, UNUSED sig, UNUSED id)
|
|||||||
time_ns = TimeNs();
|
time_ns = TimeNs();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
__profn("Swapchain wait");
|
||||||
|
GPU_YieldOnSwapchain(g->swapchain);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
UpdateUser(window);
|
UpdateUser(window);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user