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
Create shader resource view from backbuffer texture
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
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!
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!
A swapchain's back buffer can't be typeless because there's no way for you to tell the hardware what the format is when you call present.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement