layers: Tidy up shader cache, reserve space before merging
diff --git a/layers/shader_validation.h b/layers/shader_validation.h
index c6e6519..e2b9c46 100644
--- a/layers/shader_validation.h
+++ b/layers/shader_validation.h
@@ -141,7 +141,7 @@
}
void Write(size_t *pDataSize, void *pData) {
- auto headerSize = 8u + VK_UUID_SIZE;
+ auto headerSize = 8u + VK_UUID_SIZE; // 4 bytes for header size + 4 bytes for version number + UUID
if (!pData) {
*pDataSize = headerSize + good_shader_hashes.size() * sizeof(uint32_t);
return;
@@ -173,6 +173,7 @@
}
void Merge(ValidationCache const *other) {
+ good_shader_hashes.reserve(good_shader_hashes.size() + other->good_shader_hashes.size());
for (auto h : other->good_shader_hashes)
good_shader_hashes.insert(h);
}