Create R32_UINT view from R8G8B8A8_UNORM resource

1.8k Views Asked by At

I need to do in place image editing using DirectCompute - ala: http://msdn.microsoft.com/en-us/library/ff728749%28v=vs.85%29.aspx

My backbuffer is R8G8B8A8_UNORM and I need to create a UAV of format R32_UINT in order for me to read and write simultaneously within the Compute Shader.

Quote from my debug output when I do this:

"CreateUnorderedAccessView: The Format (0x2a, R32_UINT) is invalid, when creating a View; the Resource was already created with a fully qualified Format, which is not castable (0x1c, R8G8B8A8_UNORM)"

Quote from the documentation in the link above:

"Most 32 bit per element formats support casting to DXGI_FORMAT_R32_UINT"

Am I missing something?

1

There are 1 best solutions below

1
On

Try creating resource with format DXGI_FORMAT_R8G8B8A8_TYPELESS.

OOPS - you've got back buffer with that format - not sure that you'll be able to use DXGI_FORMAT_R8G8B8A8_TYPELESS for back buffer.