Add descriptor array scalar replacement (#2742)
Creates a pass that will replace a descriptor array with individual variables. See #2740 for details.
Fixes #2740.
diff --git a/include/spirv-tools/optimizer.hpp b/include/spirv-tools/optimizer.hpp
index a52dcd0..d442b97 100644
--- a/include/spirv-tools/optimizer.hpp
+++ b/include/spirv-tools/optimizer.hpp
@@ -784,6 +784,17 @@
// wide.
Optimizer::PassToken CreateGraphicsRobustAccessPass();
+// Create descriptor scalar replacement pass.
+// This pass replaces every array variable |desc| that has a DescriptorSet and
+// Binding decorations with a new variable for each element of the array.
+// Suppose |desc| was bound at binding |b|. Then the variable corresponding to
+// |desc[i]| will have binding |b+i|. The descriptor set will be the same. It
+// is assumed that no other variable already has a binding that will used by one
+// of the new variables. If not, the pass will generate invalid Spir-V. All
+// accesses to |desc| must be OpAccessChain instructions with a literal index
+// for the first index.
+Optimizer::PassToken CreateDescriptorScalarReplacementPass();
+
} // namespace spvtools
#endif // INCLUDE_SPIRV_TOOLS_OPTIMIZER_HPP_