From 5c6457950b1886f317efaa2831e9d801d76dbbe3 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Sat, 23 Mar 2019 14:14:11 -0700 Subject: Improved shader resource layout error reporting --- .../src/ShaderResourceLayoutVk.cpp | 26 ++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') 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 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)); } } } -- cgit v1.2.3