shader_environment: Receive cache version from outside

This allows us invalidating OpenGL and Vulkan separately in the future.
This commit is contained in:
ReinUsesLisp
2021-07-18 21:07:12 -03:00
committed by ameerj
parent 4a82450c81
commit 258f35515d
4 changed files with 23 additions and 16 deletions

View File

@ -164,18 +164,19 @@ private:
};
void SerializePipeline(std::span<const char> key, std::span<const GenericEnvironment* const> envs,
const std::filesystem::path& filename);
const std::filesystem::path& filename, u32 cache_version);
template <typename Key, typename Envs>
void SerializePipeline(const Key& key, const Envs& envs, const std::filesystem::path& filename) {
void SerializePipeline(const Key& key, const Envs& envs, const std::filesystem::path& filename,
u32 cache_version) {
static_assert(std::is_trivially_copyable_v<Key>);
static_assert(std::has_unique_object_representations_v<Key>);
SerializePipeline(std::span(reinterpret_cast<const char*>(&key), sizeof(key)),
std::span(envs.data(), envs.size()), filename);
std::span(envs.data(), envs.size()), filename, cache_version);
}
void LoadPipelines(
std::stop_token stop_loading, const std::filesystem::path& filename,
std::stop_token stop_loading, const std::filesystem::path& filename, u32 expected_cache_version,
Common::UniqueFunction<void, std::ifstream&, FileEnvironment> load_compute,
Common::UniqueFunction<void, std::ifstream&, std::vector<FileEnvironment>> load_graphics);