I'm not 100% sure how the DDS files should be generated. I'm using the texconv tool that comes with the SDK. Since my source image is a sRGB image created in photoshop, I think I should use both the -srgbi and -srgbo flags when encoding the texture.
Next I tried to load the texture like so:
D3DX11CreateShaderResourceViewFromFile(pDevice, "diffuse.dds", NULL, NULL, &pTextureRV1, NULL);
I have a DXGI_FORMAT_R8G8B8A8_UNORM_SRGB framebuffer format and the diffuse texture is not being displayed correctly (it's too dark). I can only guess that D3DX11CreateShaderResourceViewFromFile is not automatically detecting that the image is sRGB.
So next I tried this:
D3DX11_IMAGE_LOAD_INFO loadInfo; loadInfo.Width = D3DX11_DEFAULT; loadInfo.Height = D3DX11_DEFAULT; loadInfo.Depth = D3DX11_DEFAULT; loadInfo.FirstMipLevel = D3DX11_DEFAULT; loadInfo.MipLevels = D3DX11_DEFAULT; loadInfo.Usage = D3D11_USAGE_IMMUTABLE; loadInfo.BindFlags = D3D11_BIND_SHADER_RESOURCE; loadInfo.CpuAccessFlags = 0; loadInfo.MiscFlags = 0; loadInfo.Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB; loadInfo.Filter = D3DX11_FILTER_SRGB_IN | D3DX11_FILTER_SRGB_OUT | D3DX11_FILTER_NONE; loadInfo.MipFilter = D3DX11_DEFAULT; loadInfo.pSrcInfo = NULL; D3DX11CreateShaderResourceViewFromFile(pDevice, "diffuse.dds", &loadInfo, NULL, &pTextureRV1, NULL);
This seems to work, but I notice that is take a much longer to load the texture. Before it loaded almost instantly, but now it takes a second or two to load.