The silent failure of the ID3D11DeviceContext::GenerateMips was a problem in DX11 because it left the mipchain uninitialized which rendered garbage. The DX11 DDSTextureLoader/WICTextureLoader explicitly checks the format for support via CheckFormatSupport and the D3D11_FORMAT_SUPPORT_MIP_AUTOGEN bit. If it is not supported it creates the texture without any mipchain so you get poor filtering, but at least not garbage.
While I think having ResourceUploadBatch::GenerateMips throw on unsupported formats is a better design decision, I could add logic to the DX12 DDSTextureLoader/WICTextureLoader to silently disable the DDS_/WIC_LOADER_MIP_AUTOGEN flag if it was going to result in an exception in ResoruceUploadBatch due to being an unsupported format so you get the old behavior. I’d probably add a ResourceUploadBatch::IsSupportedForAutoGen method which would be exposed as well.
The silent failure of the
ID3D11DeviceContext::GenerateMips
was a problem in DX11 because it left the mipchain uninitialized which rendered garbage. The DX11 DDSTextureLoader/WICTextureLoader explicitly checks the format for support viaCheckFormatSupport
and the D3D11_FORMAT_SUPPORT_MIP_AUTOGEN bit. If it is not supported it creates the texture without any mipchain so you get poor filtering, but at least not garbage.While I think having
ResourceUploadBatch::GenerateMips
throw on unsupported formats is a better design decision, I could add logic to the DX12 DDSTextureLoader/WICTextureLoader to silently disable the DDS_/WIC_LOADER_MIP_AUTOGEN flag if it was going to result in an exception in ResoruceUploadBatch due to being an unsupported format so you get the old behavior. I’d probably add aResourceUploadBatch::IsSupportedForAutoGen
method which would be exposed as well.