I'm a newbie in DX12 and trying to visualize Stencil buffer onto screen. I've been copied stencil plane slice into a DXGI_FORMAT_R8_UINT texture, but when HLSL samples this texture it just returns 0, and finally my render result is a black screen.
Here is the texture info from PIX:
and the shader code is simple:
Texture2D gDiffuseMap : register(t0);
SamplerState gsamAnisotropicWrap : register(s4);
float4 PS_PixelOverdraw(VertexOut pin) : SV_TARGET
{
// gsamAnisotropicWrap is a static sampler
int diffuseAlbedo = gDiffuseMap.Sample(gsamAnisotropicWrap, pin.TexC);
float3 litcolor = diffuseAlbedo / 255.0f;
return float4(litcolor, 1.0f);
}
when I debug pixel history at uv coordinate (0.321875, 0.5625), it just return 0 from Sample expression: