diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2019-03-23 21:14:11 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2019-03-23 21:14:11 +0000 |
| commit | 5c6457950b1886f317efaa2831e9d801d76dbbe3 (patch) | |
| tree | e1d44ba8cf8934ef491e9fb068d9f85f82699fef /Graphics/GraphicsEngineVulkan | |
| parent | Updated third-party submodules (diff) | |
| download | DiligentCore-5c6457950b1886f317efaa2831e9d801d76dbbe3.tar.gz DiligentCore-5c6457950b1886f317efaa2831e9d801d76dbbe3.zip | |
Improved shader resource layout error reporting
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
| -rw-r--r-- | Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp index 595c49f1..fdf3f830 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp @@ -235,6 +235,24 @@ void ShaderResourceLayoutVk::dvpVerifyResourceLayoutDesc(Uint32 const std::shared_ptr<const SPIRVShaderResources> pShaderResources[], const PipelineResourceLayoutDesc& ResourceLayoutDesc) { + auto GetAllowedShadersString = [&](SHADER_TYPE ShaderStages) + { + std::string ShadersStr; + for (Uint32 s=0; s < NumShaders; ++s) + { + const auto& Resources = *pShaderResources[s]; + if ((ShaderStages & Resources.GetShaderType()) != 0) + { + ShadersStr.append(ShadersStr.empty() ? "'" : ", '"); + ShadersStr.append(Resources.GetShaderName()); + ShadersStr.append("' ("); + ShadersStr.append(GetShaderTypeLiteralName(Resources.GetShaderType())); + ShadersStr.push_back(')'); + } + } + return ShadersStr; + }; + for (Uint32 v = 0; v < ResourceLayoutDesc.NumVariables; ++v) { const auto& VarDesc = ResourceLayoutDesc.Variables[v]; @@ -259,7 +277,9 @@ void ShaderResourceLayoutVk::dvpVerifyResourceLayoutDesc(Uint32 } if (!VariableFound) { - LOG_WARNING_MESSAGE(GetShaderVariableTypeLiteralName(VarDesc.Type), " variable '", VarDesc.Name, "' is not found in any of the designated shader stages (", GetShaderStagesString(VarDesc.ShaderStages), ")"); + LOG_WARNING_MESSAGE(GetShaderVariableTypeLiteralName(VarDesc.Type), " variable '", VarDesc.Name, + "' is not found in any of the designated shader stages: ", + GetAllowedShadersString(VarDesc.ShaderStages)); } } @@ -303,7 +323,9 @@ void ShaderResourceLayoutVk::dvpVerifyResourceLayoutDesc(Uint32 if (!SamplerFound) { - LOG_WARNING_MESSAGE("Static sampler '", StSamDesc.SamplerOrTextureName, "' is not found in any of the designated shader stages (", GetShaderStagesString(StSamDesc.ShaderStages), ")"); + LOG_WARNING_MESSAGE("Static sampler '", StSamDesc.SamplerOrTextureName, + "' is not found in any of the designated shader stages: ", + GetAllowedShadersString(StSamDesc.ShaderStages)); } } } |
