summaryrefslogtreecommitdiffstats
path: root/Graphics/ShaderTools
diff options
context:
space:
mode:
authorazhirnov <zh1dron@gmail.com>2021-02-10 20:00:27 +0000
committerassiduous <assiduous@diligentgraphics.com>2021-03-19 00:31:36 +0000
commite5296c8d10d0c4f37ac17c5394f71aad6443703a (patch)
tree03279b1c839ad31718aa31213493e7f1cd5363f0 /Graphics/ShaderTools
parentFixed immutable samplers for dx12 (diff)
downloadDiligentCore-e5296c8d10d0c4f37ac17c5394f71aad6443703a.tar.gz
DiligentCore-e5296c8d10d0c4f37ac17c5394f71aad6443703a.zip
added debug checks for DXIL resource remapping
Diffstat (limited to 'Graphics/ShaderTools')
-rw-r--r--Graphics/ShaderTools/src/DXCompiler.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/Graphics/ShaderTools/src/DXCompiler.cpp b/Graphics/ShaderTools/src/DXCompiler.cpp
index e399dcc3..19c1d78d 100644
--- a/Graphics/ShaderTools/src/DXCompiler.cpp
+++ b/Graphics/ShaderTools/src/DXCompiler.cpp
@@ -1187,6 +1187,21 @@ void DXCompilerImpl::PatchResourceHandle(const TResourceBindingMap& ResourceMap,
ReplaceBindPoint(Iter, ArgStart, ArgEnd, NewIndexLen);
startPos += NewIndexLen - (ArgEnd - ArgStart);
}
+
+#ifdef DILIGENT_DEVELOPMENT
+ Uint32 IndexVarUsageCount = 0;
+ for (pos = 0; pos < DXIL.size();)
+ {
+ pos = DXIL.find(SrcIndexStr, pos + 1);
+ if (pos == String::npos)
+ break;
+
+ pos += SrcIndexStr.size();
+ if (DXIL[pos] == ' ' || DXIL[pos] == ',')
+ ++IndexVarUsageCount;
+ }
+ DEV_CHECK_ERR(IndexVarUsageCount == 2, "Temp variable '", SrcIndexStr, "' with resource bind point used more than 2 times, patching for this variable may lead to UB");
+#endif
}
else
{