mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-23 02:24:38 +00:00
temp push
This commit is contained in:
parent
cbeaf46102
commit
2aee03218c
@ -633,6 +633,7 @@ set(COMMON src/common/logging/backend.cpp
|
|||||||
src/common/arch.h
|
src/common/arch.h
|
||||||
src/common/assert.cpp
|
src/common/assert.cpp
|
||||||
src/common/assert.h
|
src/common/assert.h
|
||||||
|
src/common/binary_helper.h
|
||||||
src/common/bit_field.h
|
src/common/bit_field.h
|
||||||
src/common/bounded_threadsafe_queue.h
|
src/common/bounded_threadsafe_queue.h
|
||||||
src/common/concepts.h
|
src/common/concepts.h
|
||||||
|
43
src/common/binary_helper.h
Normal file
43
src/common/binary_helper.h
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
using u32 = uint32_t;
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void writeBin(std::ostream& os, const T& v) {
|
||||||
|
os.write(reinterpret_cast<const char*>(&v), sizeof(T));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void readBin(std::istream& is, T& v) {
|
||||||
|
is.read(reinterpret_cast<char*>(&v), sizeof(T));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Spezialfall für Arrays/Blöcke
|
||||||
|
template <typename T>
|
||||||
|
void writeBlock(std::ostream& os, const T* data, size_t count) {
|
||||||
|
os.write(reinterpret_cast<const char*>(data), sizeof(T) * count);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void readBlock(std::istream& is, T* data, size_t count) {
|
||||||
|
is.read(reinterpret_cast<char*>(data), sizeof(T) * count);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Spezialfall für Container
|
||||||
|
template <typename T>
|
||||||
|
void writeContainer(std::ostream& os, const std::vector<T>& v) {
|
||||||
|
u32 n = static_cast<u32>(v.size());
|
||||||
|
writeBin(os, n);
|
||||||
|
if (n)
|
||||||
|
writeBlock(os, v.data(), n);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void readContainer(std::istream& is, std::vector<T>& v) {
|
||||||
|
u32 n;
|
||||||
|
readBin(is, n);
|
||||||
|
v.resize(n);
|
||||||
|
if (n)
|
||||||
|
readBlock(is, v.data(), n);
|
||||||
|
}
|
28
src/video_core/renderer_vulkan/shader_cache.cpp
Normal file
28
src/video_core/renderer_vulkan/shader_cache.cpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
namespace ShaderCache {
|
||||||
|
|
||||||
|
const auto shader_cache_dir = Common::FS::GetUserPath(Common::FS::PathType::ShaderDir) / "cache";
|
||||||
|
std::string CreateShaderID(std::ostream& info_dump, std::ostream& profile_dump) {
|
||||||
|
std::ostringstream info_stream, profile_stream;
|
||||||
|
info_stream << info_dump.rdbuf();
|
||||||
|
profile_stream << profile_dump.rdbuf();
|
||||||
|
|
||||||
|
std::string combined_data = info_stream.str() + profile_stream.str();
|
||||||
|
|
||||||
|
std::hash<std::string> hasher;
|
||||||
|
size_t shader_id = hasher(combined_data);
|
||||||
|
return std::to_string(shader_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GetShader{
|
||||||
|
|
||||||
|
}
|
||||||
|
void AddShader(std::vector<u32> spv, std::ostream& info_dump, std::ostream& profile_dump) {
|
||||||
|
|
||||||
|
std::string spirv_cache_filename = shader_name + ".spv ";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
0
src/video_core/renderer_vulkan/shader_cache.h
Normal file
0
src/video_core/renderer_vulkan/shader_cache.h
Normal file
@ -493,13 +493,12 @@ vk::ShaderModule PipelineCache::CompileModule(Shader::Info& info, Shader::Runtim
|
|||||||
DumpShader(code, info.pgm_hash, info.stage, perm_idx, "bin");
|
DumpShader(code, info.pgm_hash, info.stage, perm_idx, "bin");
|
||||||
|
|
||||||
const auto ir_program = Shader::TranslateProgram(code, pools, info, runtime_info, profile);
|
const auto ir_program = Shader::TranslateProgram(code, pools, info, runtime_info, profile);
|
||||||
|
|
||||||
std::string shader_name = GetShaderName(info.stage, info.pgm_hash, perm_idx);
|
std::string shader_name = GetShaderName(info.stage, info.pgm_hash, perm_idx);
|
||||||
std::string spirv_cache_filename =
|
std::string spirv_cache_filename =
|
||||||
shader_name + "_" + Common::g_scm_rev + ".spv ";
|
shader_name + "_" + Common::g_scm_rev + ".spv ";
|
||||||
|
|
||||||
const auto shader_cache_dir =
|
|
||||||
Common::FS::GetUserPath(Common::FS::PathType::ShaderDir) / "cache";
|
|
||||||
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;
|
||||||
|
|
||||||
std::vector<u32> spv;
|
std::vector<u32> spv;
|
||||||
|
Loading…
Reference in New Issue
Block a user