Jump to content

  • Log In with Google      Sign In   
  • Create Account

DirectX11 Swap Chain Format


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 d3stnd   Members   -  Reputation: 128

Like
0Likes
Like

Posted 12 November 2013 - 05:45 AM

I was wondering if anyone could elaborate any further on something thats been bugging me.
 
In DirectX9 the main supported back buffer formats were
D3DFMT_X8R8B8G8 and D3DFMT_A8R8G8B8 (Both being BGRA in layout).
 
 
With the initial version of DirectX10 their was no support for BGRA and all the textbooks (On both DirectX10 and 11) and online tutorials recommend
 
DXGI_FORMAT_R8G8B8A8_UNORM (being RGBA in layout).
 
Now with DirectX11 BGRA is supported again and it seems as if microsoft recommends using a BGRA format as the back buffer format.
 
 
Is their any suggestions or are their performance implications of using one or the other.
 
(I assume not as obviously by specifying the format of the underlying resource the runtime will handle what bits your passing through and than infer how to utilise them based on the format).
 
Any feedback is appreciated.
 

 



Sponsor:

#2 N.I.B.   Members   -  Reputation: 1213

Like
1Likes
Like

Posted 12 November 2013 - 06:10 AM

It has to do with the way your back-buffer gets to the screen. There's at least one copy involved(back-buffer=>screen), so if your back-buffer format matches the screen-format(BGRA8), then theoretically this copy operations should run faster. 

 

Read this for a better explanation on how present works, and differences between the Win8 flip-model to the Win7 blit-model.



#3 d3stnd   Members   -  Reputation: 128

Like
0Likes
Like

Posted 12 November 2013 - 06:29 AM

Thanks for the reply.

Ive read this article before And i noticed that it mentions you can still use the rgba format with flip and DWM will still compose the screen without a copy. So what about vista or windows 7 with directx 10/11 where flip sequential might not be available or using say discard as the presentation model?

#4 N.I.B.   Members   -  Reputation: 1213

Like
1Likes
Like

Posted 12 November 2013 - 07:02 AM


So what about vista or windows 7 with directx 10/11 where flip sequential might not be available or using say discard as the presentation model?

It will use an additional BitBlit() to copy the DX surface to an intermediate DWM surface, which is slower. But same principal holds - if the swap-chain format matches the screen-format, this operation will be faster. When using the BitBlit mode, you also have more options for swap-chain formats.



#5 BornToCode   Members   -  Reputation: 950

Like
1Likes
Like

Posted 13 November 2013 - 12:10 AM

 


So what about vista or windows 7 with directx 10/11 where flip sequential might not be available or using say discard as the presentation model?

It will use an additional BitBlit() to copy the DX surface to an intermediate DWM surface, which is slower. But same principal holds - if the swap-chain format matches the screen-format, this operation will be faster. When using the BitBlit mode, you also have more options for swap-chain formats.

 

This is not completely true for windows 7. As long your backbuffer matches your front buffer and you have your swap chain set to full screen. It will not bitblt, but swap the backbuffer with the front. The only time it bitblt is when the swapchain is in window mode or when the swap chain back buffer does not match the front buffer width/heigh and format.



#6 d3stnd   Members   -  Reputation: 128

Like
1Likes
Like

Posted 13 November 2013 - 01:17 AM

Hi Guys,

 

After doing my research (of which I already knew half cheers for the information about the flip presentation info btw).

Heres my findings:

 

Now when using the discard presentation in a Win32 app it passes the render target to DWM which then blits the target to the screen and when in full screen mode (provided you have resized your back buffer and refresh rate correctly) it will disable DWM and perform flips to render the scene.

Now with metro apps there's no such thing as full screen exclusive (as they are essentially borderless window). So they would blit all the time (the discard presentation model is actually not allowed for metro apps).

So you have to set the presentation model to flip in Win32 apps and metro apps(with this being your only option for metro :]). It will than pass your render target to DWM (I assume maybe it allows you access to its underlying target to draw into and uses dirty rectangles), and instead of blitting it will straight up flip/merge your target into the screen space it currently resides in and you get flip performance and in full screen it does the flip (assuming you resized buffers and refresh rate).

Now for some reason the windows default back buffer for the OS is BGR and if you use this as your back buffer format the flip is slightly faster as it doesn't have to swizzle or do whatever it does to merge/flip. But you can use either RGBA or BGRA.

Heres the msdn explaining the new presentation model: http://msdn.microsoft.com/en-us/library/windows/desktop/hh706346%28v=vs.85%29.aspx

And heres another msdn confirming the slightly faster flip with bgra:http://social.msdn.microsoft.com/Forums/windowsapps/en-US/f56e4449-f3e1-491e-9f64-e65e989a518a/best-swap-buffer-format-rgba-or-bgra-






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS