Add a little reminder to self with a link to an interesting article.

This commit is contained in:
Henrik Rydgård 2019-07-23 17:45:52 +02:00
parent a7820b6aee
commit 3916f8d7b6
2 changed files with 4 additions and 0 deletions

View File

@ -136,6 +136,7 @@ void GPU_Vulkan::LoadCache(std::string filename) {
// it can just memcpy the finished shader binaries out of the pipeline cache file.
bool result = shaderManagerVulkan_->LoadCache(f);
if (result) {
// WARNING: See comment in LoadCache if you are tempted to flip the second parameter to true.
result = pipelineManager_->LoadCache(f, false, shaderManagerVulkan_, draw_, drawEngine_.GetPipelineLayout());
}
fclose(f);
@ -159,6 +160,7 @@ void GPU_Vulkan::SaveCache(std::string filename) {
if (!f)
return;
shaderManagerVulkan_->SaveCache(f);
// WARNING: See comment in LoadCache if you are tempted to flip the second parameter to true.
pipelineManager_->SaveCache(f, false, shaderManagerVulkan_, draw_);
INFO_LOG(G3D, "Saved Vulkan pipeline cache");
fclose(f);

View File

@ -582,6 +582,7 @@ void PipelineManagerVulkan::SaveCache(FILE *file, bool saveRawPipelineCache, Sha
uint32_t size;
if (saveRawPipelineCache) {
// WARNING: See comment in LoadCache before using this path.
VkResult result = vkGetPipelineCacheData(vulkan_->GetDevice(), pipelineCache_, &dataSize, nullptr);
uint32_t size = (uint32_t)dataSize;
if (result != VK_SUCCESS) {
@ -670,6 +671,7 @@ bool PipelineManagerVulkan::LoadCache(FILE *file, bool loadRawPipelineCache, Sha
uint32_t size = 0;
if (loadRawPipelineCache) {
// WARNING: Do not use this path until after reading and implementing https://zeux.io/2019/07/17/serializing-pipeline-cache/ !
bool success = fread(&size, sizeof(size), 1, file) == 1;
if (!size || !success) {
WARN_LOG(G3D, "Zero-sized Vulkan pipeline cache.");