d3dcoder / d3d12book

Sample code for the book "Introduction to 3D Game Programming with DirectX 12"
1.54k stars 591 forks source link

Box example (Chapter 6) Flickering. #19

Open BrennyBear opened 5 years ago

BrennyBear commented 5 years ago

When I run the Box example, the Box flickers. It does not seem to be an issue with other examples but I cannot figure out why it is happening.

HuazyYang commented 5 years ago

I think this is normal since the run time refresh rate is much higher than the adapter's refresh rate, which on my laptop the adapter's refresh rate is 60FPS, you may put the render thread to sleep a while to stalling to submit commands to GPU, which may alleviate the flicking issues. By the way, other samples still suffer the flicking when FPS is two high.

FlexShashlik commented 4 years ago

@TaylorSevens, thanks :D I was wondering for a long time why I had this problem and thought that I have problem with my GPU drivers.

FlexShashlik commented 4 years ago

@BrennyBear, try to run in release mode. That worked for me.

ethanleau commented 4 years ago

@TaylorSevens, I am curious about the reason for screen flickering when the run time refresh rate is much higher than the adapter's refresh rate. Could you give me some explanations or links to related articles?

HuazyYang commented 3 years ago

@TaylorSevens, I am curious about the reason for screen flickering when the run time refresh rate is much higher than the adapter's refresh rate. Could you give me some explanations or links to related articles? Actually, there is no problem because flickering is a window adapter behavior, which conerned to swap chain. you can turn on vsync to limit swap chain sychronzing frequency to below 60fps, refer to MSDN swap chain creation flags: https://docs.microsoft.com/en-us/windows/win32/api/dxgi/ne-dxgi-dxgi_swap_chain_flag