amerkoleci / Vortice.Windows

.NET bindings for Direct3D12, Direct3D11, WIC, Direct2D1, XInput, XAudio, X3DAudio, DXC, Direct3D9 and DirectInput.
MIT License
1.01k stars 73 forks source link

CreateDepthStencilView accepts null as description - but that's invalid call? #343

Closed Gavin-Williams closed 2 years ago

Gavin-Williams commented 2 years ago

This method accepts a single argument - the resource - and provides a default value for the description.

CreateDepthStencilView(Vortice.Direct3D11.ID3D11Resource resource, Vortice.Direct3D11.DepthStencilViewDescription? desc = null)

But if I do that, Dx throws an exception

D3D11 ERROR: ID3D11Device::CreateDepthStencilView: A View cannot be created using a NULL Desc, when the Resource was created with a typeless Format. Default Desc parameters cannot be used, as a fully qualified Format must be supplied. [ STATE_CREATION ERROR #143: CREATEDEPTHSTENCILVIEW_INVALIDDESC]

Has something been missed here? Perhaps the description can be extracted from the resource? Or should the method signature be changed?

paulbartrum commented 2 years ago

What pixel format did you specify when creating the ID3D11Resource? The error message seems to be saying that you can't pass null as the description if the resource was created with a typeless pixel format.

Gavin-Williams commented 2 years ago

@paulbartrum thank you. It makes sense now, after a break, and reading it again in context of what you've said. I see that the type is important. Just my misunderstanding the error message.