In Direct3D 9, the "Luminance" formats would automatically be read in the shader as RGB values (replicated) because they were greyscale formats. In Direct3D 10+, there are no "Luminance" format. There are one and two channel formats, and there's no "special behavior" with them.
Therefore, in a shader a DXGI_FORMAT_R8G8_UNORM
texture will have the first channel in the 'r' channel and the second channel in the 'g' channel. The DXGI_FORMAT_R8G8_UNORM
has the same memory foot-print as D3DFMT_A8L8
, i.e. two 8-bit channels of unsigned normal integer data, but if you want the behavior in a modern shader that matches the old one you have to do it explicitly with shader swizzles:
Texture2D<float4> Texture : register(t0);
sampler Sampler : register(s0);
float4 color = Texture.Sample(Sampler, pin.TexCoord);
// Special-case for DXGI_FORMAT_R8G8_UNORM treated as D3DFMT_A8L8
color = color.rrrg;
This has nothing at all to do with input layouts. It's just the way a texture sampler works.