OMSetRenderTargets is very slow on my machine.

Started by
4 comments, last by Volgogradetzzz 9 years, 4 months ago

Greetings.

I have a very simple application - just a triangle. And I'm experiencing a performance problem I have a strange execution time for rendering. Sometimes it takes 33ms and sometimes 16ms. Looks like 30 and 60 fps. I narrowed problem a found that only OMSetRenderTargets method takes so much time.

This code causes problems:


chrono::high_resolution_clock::time_point t1 = chrono::high_resolution_clock::now();

// set targets and states
context->OMSetRenderTargets(1, ppRenderTargetViews, pDepthStencilView);

chrono::high_resolution_clock::time_point t2 = chrono::high_resolution_clock::now();
auto duration = chrono::duration_cast<chrono::milliseconds>(t2 - t1).count();
Advertisement

The information provided isnt enough,

Can you be more specific? How often (per frame) you call OMSetRenderTargets? How many render targets are needed to render one frame?

PS:

Have you tried to replace "chrono" with GetPerformace/FreqCounter or timeGetTime()? I had bad experience with chrono.

Sometimes it takes 33ms and sometimes 16ms. Looks like 30 and 60 fps.

Disable v-sync.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

Disable v-sync.

L. Spiro, how? As far as I know in windowed mode vsync is off by default and there's no way to enable it. And I have the same problems in windowed mode.

You control V-Sync with the first parameter of IDXGISwapChain::Present, no matter if windowed. Though the rate is dictated by the current graphics mode.

Oh. Thank you. Also I noticed that DXGI_SWAP_CHAIN_DESC::SwapEffect also have an effect on fps. But DXGI_SWAP_CHAIN_DESC::BufferDesc::RefreshRate have no effect at all. Can someone please explain how this works in simple words. I've read msdn but it so dry and it's hard to understand for not experienced guy like me.

This topic is closed to new replies.

Advertisement