Sign in to follow this  
IrYoKu1

Create shader resource view from backbuffer texture

Recommended Posts

IrYoKu1    174
Hey guys,

I would like to use the backbuffer as a shader resource (I don't want to create additional intermediate rendertargets).

Is there any way of using CreateShaderResourceView to obtain a shader resource view from the backbuffer? I just debugged a little and it seems that the swapchain Texture2D is created using only D3D10_BIND_RENDER_TARGET. For being able to create a shader resource view it should be created using D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE. Is there any way to control this, or maybe other workaround for using the backbuffer as shader resource input in a shader?

Cheers!
Jorge

Share this post


Link to post
Share on other sites
DieterVW    724
Yes, when the call to CreateDeviceAndSwapChain(), or the call to just CreateSwapChain() is made you have the opportunity to indicate usage flags for the back buffer using DXGI_SWAP_CHAIN_DESC::BufferUsage. The flags would be: DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_SHADER_INPUT

Share this post


Link to post
Share on other sites
IrYoKu1    174
Thanks! It did the trick.

We are facing other problem now: we want to create both a RGB and a SRGB shader resource views. AFAIK, for this, the format of the underlaying Texture2D format must be typeless (DXGI_FORMAT_R8G8B8A8_TYPELESS). However it seems DX doesn't allow to create a device with a DXGI_FORMAT_R8G8B8A8_TYPELESS format as backbuffer (we are using DXGI_MODE_DESC in the DXUTSetCallbackDeviceChanging callback to set the backbuffer format). Do you know of any workaround for this problem?

Thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this