mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-23 10:35:03 +00:00
forgot file
This commit is contained in:
parent
b1db45a64d
commit
4a3bbb3747
29
src/common/serialization.h
Normal file
29
src/common/serialization.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cereal/archives/binary.hpp>
|
||||||
|
#include <boost/container/small_vector.hpp>
|
||||||
|
#include <common/types.h>
|
||||||
|
|
||||||
|
namespace cereal {
|
||||||
|
|
||||||
|
// boost::small_vector
|
||||||
|
template<class Archive, class T, std::size_t N, class Alloc>
|
||||||
|
void save(Archive& ar, boost::container::small_vector<T, N, Alloc> const& smallVector) {
|
||||||
|
ar(make_size_tag(static_cast<u32>(smallVector.size())));
|
||||||
|
for (auto const& element : smallVector)
|
||||||
|
ar(element);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class Archive, class T, std::size_t N, class Alloc>
|
||||||
|
void load(Archive& ar, boost::container::small_vector<T, N, Alloc>& smallVector) {
|
||||||
|
u32 elementCount;
|
||||||
|
ar(make_size_tag(elementCount));
|
||||||
|
smallVector.resize(elementCount);
|
||||||
|
for (auto& element : smallVector)
|
||||||
|
ar(element);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -281,7 +281,6 @@ bool CheckShaderCache(std::string shader_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GetShader(std::string shader_id, Shader::Info& info, std::vector<u32>& spv) {
|
void GetShader(std::string shader_id, Shader::Info& info, std::vector<u32>& spv) {
|
||||||
// read spirv
|
|
||||||
std::filesystem::path spirv_cache_filename = shader_id + ".spv";
|
std::filesystem::path spirv_cache_filename = shader_id + ".spv";
|
||||||
std::filesystem::path spirv_cache_file_path = SHADER_CACHE_DIR / spirv_cache_filename;
|
std::filesystem::path spirv_cache_file_path = SHADER_CACHE_DIR / spirv_cache_filename;
|
||||||
Common::FS::IOFile spirv_cache_file(spirv_cache_file_path, Common::FS::FileAccessMode::Read);
|
Common::FS::IOFile spirv_cache_file(spirv_cache_file_path, Common::FS::FileAccessMode::Read);
|
||||||
@ -289,7 +288,6 @@ void GetShader(std::string shader_id, Shader::Info& info, std::vector<u32>& spv)
|
|||||||
spirv_cache_file.Read(spv);
|
spirv_cache_file.Read(spv);
|
||||||
spirv_cache_file.Close();
|
spirv_cache_file.Close();
|
||||||
|
|
||||||
// read resources
|
|
||||||
std::filesystem::path resource_dump_filename = shader_id + ".resources";
|
std::filesystem::path resource_dump_filename = shader_id + ".resources";
|
||||||
std::filesystem::path resources_dump_file_path = SHADER_CACHE_DIR / resource_dump_filename;
|
std::filesystem::path resources_dump_file_path = SHADER_CACHE_DIR / resource_dump_filename;
|
||||||
Common::FS::IOFile resources_dump_file(resources_dump_file_path,
|
Common::FS::IOFile resources_dump_file(resources_dump_file_path,
|
||||||
|
Loading…
Reference in New Issue
Block a user