Advertisement

Attempting to create a ShaderResourceView of the SwapChain's buffer throws an exception?

Started by December 19, 2019 09:21 PM
1 comment, last by trojanfoe 5 years, 1 month ago

I have added a constructor to my Texture class that accepts a ID3D11Texture2D, and it creates a ShaderResourceView of the texture passed in, as a matter of course. My RenderTarget class inherits from the Texture class and when it passes in the SwapChain's backbuffer the ID3DDevice->CreateShaderResourceView() throws an exception, which I did not expect. I understand that it doesn't make any sense to create a shader resource view of the backbuffer texture, but I reckon the CreateShaderResourceView() should check that and return an appropriate HRESULT. Can anyone tell me how I tell if making a shader resource view will work before calling CreateShaderResourceView()?

Here's the exception, if that matters:

Unhandled exception at 0x00007FFE909CA839 (KernelBase.dll) in Tests.exe: 0x0000087A (parameters: 0x0000000000000001, 0x000000F7C3D0AD10, 0x000000F7C3D0CB00). occurred

Indie Game Dev

OK, reading the documentation might have helped. I just need to check the bind flags of the texture has D3D11BINDSHADER_RESOURCE. :-|

Indie Game Dev

This topic is closed to new replies.

Advertisement