otherwise we will have to bind an empty resource to every ShaderResourceVariable even it is not used at all.
[SpecializationConstant] const int BaseTextureEnabled = 0;
if (BaseTextureEnabled != 0)
{
baseColor = g_BaseTexture.Sample(g_BaseTexture_sampler, baseTexcoord);
}
we know that g_BaseTexture will never be used in this case unless BaseTextureEnabled explicitly set in PSOCreate.pSpecializationConstant.
Currently, I'm using pShaderVariables->Set(m_pEmptyShaderVariableResource); to mitigate the issue, where m_pEmptyShaderVariableResource is a 1x1 Texture2D. not a good option though.