+void BinaryRegistryWriter::addBinary (deUint32 index, const ProgramBinary& binary)
+{
+ DE_ASSERT(binary.getFormat() == vk::PROGRAM_FORMAT_SPIRV);
+ DE_ASSERT(findBinary(binary) == DE_NULL);
+
+ ProgramBinary* const binaryClone = new ProgramBinary(binary);
+
+ try
+ {
+ if (m_binaries.size() < (size_t)index+1)
+ m_binaries.resize(index+1);
+
+ DE_ASSERT(!m_binaries[index].binary);
+ DE_ASSERT(m_binaries[index].referenceCount == 0);
+
+ m_binaries[index].binary = binaryClone;
+ // \note referenceCount is not incremented here
+ }
+ catch (...)
+ {
+ delete binaryClone;
+ throw;
+ }
+
+ m_binaryHash.insert(binaryClone, index);
+}
+
+void BinaryRegistryWriter::write (void) const
+{
+ writeToPath(m_dstPath);
+}
+
+void BinaryRegistryWriter::writeToPath (const std::string& dstPath) const
+{
+ if (!de::FilePath(dstPath).exists())
+ de::createDirectoryAndParents(dstPath.c_str());
+
+ DE_ASSERT(m_binaries.size() <= 0xffffffffu);
+ for (size_t binaryNdx = 0; binaryNdx < m_binaries.size(); ++binaryNdx)