| 855 | } |
| 856 | |
| 857 | void PBR_Renderer::SetMaterialTexture(IShaderResourceBinding* pSRB, ITextureView* pTexSRV, TEXTURE_ATTRIB_ID TextureId) const |
| 858 | { |
| 859 | if (m_Settings.ShaderTexturesArrayMode == SHADER_TEXTURE_ARRAY_MODE_NONE) |
| 860 | { |
| 861 | const std::string TextureName = GetTextureShaderName(TextureId); |
| 862 | if (IShaderResourceVariable* pTexVar = pSRB->GetVariableByName(SHADER_TYPE_PIXEL, TextureName.c_str())) |
| 863 | { |
| 864 | pTexVar->Set(pTexSRV); |
| 865 | } |
| 866 | } |
| 867 | else if (m_Settings.ShaderTexturesArrayMode == SHADER_TEXTURE_ARRAY_MODE_STATIC) |
| 868 | { |
| 869 | if (m_StaticShaderTextureIds) |
| 870 | { |
| 871 | const auto TextureIdx = (*m_StaticShaderTextureIds)[TextureId]; |
| 872 | if (TextureIdx == InvalidMaterialTextureId) |
| 873 | { |
| 874 | UNEXPECTED("Texture is not initialized"); |
| 875 | return; |
| 876 | } |
| 877 | |
| 878 | if (IShaderResourceVariable* pMatTexturesVar = pSRB->GetVariableByName(SHADER_TYPE_PIXEL, "g_MaterialTextures")) |
| 879 | { |
| 880 | IDeviceObject* pObj[] = {pTexSRV}; |
| 881 | pMatTexturesVar->SetArray(pObj, TextureIdx, 1); |
| 882 | } |
| 883 | } |
| 884 | else |
| 885 | { |
| 886 | UNEXPECTED("Static material texture indices are not initialized, which indicates that the client uses a custom GetStaticShaderTextureIds function. " |
| 887 | "In this case it is expected that the client binds the textures."); |
| 888 | } |
| 889 | } |
| 890 | else if (m_Settings.ShaderTexturesArrayMode == SHADER_TEXTURE_ARRAY_MODE_DYNAMIC) |
| 891 | { |
| 892 | UNEXPECTED("This method should not be called when shader textures array mode is dynamic."); |
| 893 | } |
| 894 | else |
| 895 | { |
| 896 | UNEXPECTED("Unexpected shader textures array mode"); |
| 897 | } |
| 898 | } |
| 899 | |
| 900 | void PBR_Renderer::CreateSignature() |
| 901 | { |
no test coverage detected