mirror of
https://git.h3cjp.net/H3cJP/citra.git
synced 2024-12-24 12:16:49 +00:00
Address review and update zstd
This commit is contained in:
parent
936094dd27
commit
6945b6539f
2
externals/zstd
vendored
2
externals/zstd
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 470344d33e1d52a2ada75d278466da8d4ee2faf6
|
Subproject commit 10f0e6993f9d2f682da6d04aa2385b7d53cbb4ee
|
|
@ -557,7 +557,7 @@ std::optional<std::string> GetCurrentDir() {
|
||||||
#endif
|
#endif
|
||||||
free(dir);
|
free(dir);
|
||||||
return strDir;
|
return strDir;
|
||||||
} // namespace FileUtil
|
}
|
||||||
|
|
||||||
bool SetCurrentDir(const std::string& directory) {
|
bool SetCurrentDir(const std::string& directory) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
namespace Common::Compression {
|
namespace Common::Compression {
|
||||||
|
|
||||||
std::vector<u8> CompressDataZSTD(const u8* source, std::size_t source_size, s32 compression_level) {
|
std::vector<u8> CompressDataZSTD(const u8* source, std::size_t source_size, s32 compression_level) {
|
||||||
compression_level = std::clamp(compression_level, 1, ZSTD_maxCLevel());
|
compression_level = std::clamp(compression_level, ZSTD_minCLevel(), ZSTD_maxCLevel());
|
||||||
|
|
||||||
const std::size_t max_compressed_size = ZSTD_compressBound(source_size);
|
const std::size_t max_compressed_size = ZSTD_compressBound(source_size);
|
||||||
std::vector<u8> compressed(max_compressed_size);
|
std::vector<u8> compressed(max_compressed_size);
|
||||||
|
@ -48,4 +48,4 @@ std::vector<u8> DecompressDataZSTD(const std::vector<u8>& compressed) {
|
||||||
return decompressed;
|
return decompressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Common::Compression
|
} // namespace Common::Compression
|
||||||
|
|
|
@ -41,4 +41,4 @@ std::vector<u8> CompressDataZSTDDefault(const u8* source, std::size_t source_siz
|
||||||
*/
|
*/
|
||||||
std::vector<u8> DecompressDataZSTD(const std::vector<u8>& compressed);
|
std::vector<u8> DecompressDataZSTD(const std::vector<u8>& compressed);
|
||||||
|
|
||||||
} // namespace Common::Compression
|
} // namespace Common::Compression
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/frontend/emu_window.h"
|
|
||||||
#include "video_core/rasterizer_interface.h"
|
#include "video_core/rasterizer_interface.h"
|
||||||
#include "video_core/video_core.h"
|
#include "video_core/video_core.h"
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
#include "common/microprofile.h"
|
#include "common/microprofile.h"
|
||||||
#include "common/scope_exit.h"
|
#include "common/scope_exit.h"
|
||||||
#include "common/vector_math.h"
|
#include "common/vector_math.h"
|
||||||
#include "core/core.h"
|
|
||||||
#include "core/hw/gpu.h"
|
#include "core/hw/gpu.h"
|
||||||
#include "video_core/pica_state.h"
|
#include "video_core/pica_state.h"
|
||||||
#include "video_core/regs_framebuffer.h"
|
#include "video_core/regs_framebuffer.h"
|
||||||
|
|
|
@ -19,7 +19,8 @@
|
||||||
|
|
||||||
namespace OpenGL {
|
namespace OpenGL {
|
||||||
|
|
||||||
using ShaderCacheVersionHash = std::array<u8, 64>;
|
constexpr std::size_t HASH_LENGTH = 64;
|
||||||
|
using ShaderCacheVersionHash = std::array<u8, HASH_LENGTH>;
|
||||||
|
|
||||||
enum class TransferableEntryKind : u32 {
|
enum class TransferableEntryKind : u32 {
|
||||||
Raw,
|
Raw,
|
||||||
|
@ -44,10 +45,6 @@ ShaderDiskCacheRaw::ShaderDiskCacheRaw(u64 unique_identifier, ProgramType progra
|
||||||
: unique_identifier{unique_identifier}, program_type{program_type}, config{config},
|
: unique_identifier{unique_identifier}, program_type{program_type}, config{config},
|
||||||
program_code{std::move(program_code)} {}
|
program_code{std::move(program_code)} {}
|
||||||
|
|
||||||
ShaderDiskCacheRaw::ShaderDiskCacheRaw() = default;
|
|
||||||
|
|
||||||
ShaderDiskCacheRaw::~ShaderDiskCacheRaw() = default;
|
|
||||||
|
|
||||||
bool ShaderDiskCacheRaw::Load(FileUtil::IOFile& file) {
|
bool ShaderDiskCacheRaw::Load(FileUtil::IOFile& file) {
|
||||||
if (file.ReadBytes(&unique_identifier, sizeof(u64)) != sizeof(u64) ||
|
if (file.ReadBytes(&unique_identifier, sizeof(u64)) != sizeof(u64) ||
|
||||||
file.ReadBytes(&program_type, sizeof(u32)) != sizeof(u32)) {
|
file.ReadBytes(&program_type, sizeof(u32)) != sizeof(u32)) {
|
||||||
|
@ -107,8 +104,6 @@ bool ShaderDiskCacheRaw::Save(FileUtil::IOFile& file) const {
|
||||||
|
|
||||||
ShaderDiskCache::ShaderDiskCache(bool separable) : separable{separable} {}
|
ShaderDiskCache::ShaderDiskCache(bool separable) : separable{separable} {}
|
||||||
|
|
||||||
ShaderDiskCache::~ShaderDiskCache() = default;
|
|
||||||
|
|
||||||
std::optional<std::vector<ShaderDiskCacheRaw>> ShaderDiskCache::LoadTransferable() {
|
std::optional<std::vector<ShaderDiskCacheRaw>> ShaderDiskCache::LoadTransferable() {
|
||||||
const bool has_title_id = GetProgramID() != 0;
|
const bool has_title_id = GetProgramID() != 0;
|
||||||
if (!Settings::values.use_disk_shader_cache || !has_title_id)
|
if (!Settings::values.use_disk_shader_cache || !has_title_id)
|
||||||
|
@ -158,7 +153,7 @@ std::optional<std::vector<ShaderDiskCacheRaw>> ShaderDiskCache::LoadTransferable
|
||||||
LOG_ERROR(Render_OpenGL, "Failed to load transferable raw entry - skipping");
|
LOG_ERROR(Render_OpenGL, "Failed to load transferable raw entry - skipping");
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
transferable.insert({entry.GetUniqueIdentifier(), {}});
|
transferable.emplace(entry.GetUniqueIdentifier(), ShaderDiskCacheRaw{});
|
||||||
raws.push_back(std::move(entry));
|
raws.push_back(std::move(entry));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,8 +46,8 @@ class ShaderDiskCacheRaw {
|
||||||
public:
|
public:
|
||||||
explicit ShaderDiskCacheRaw(u64 unique_identifier, ProgramType program_type,
|
explicit ShaderDiskCacheRaw(u64 unique_identifier, ProgramType program_type,
|
||||||
RawShaderConfig config, ProgramCode program_code);
|
RawShaderConfig config, ProgramCode program_code);
|
||||||
ShaderDiskCacheRaw();
|
ShaderDiskCacheRaw() = default;
|
||||||
~ShaderDiskCacheRaw();
|
~ShaderDiskCacheRaw() = default;
|
||||||
|
|
||||||
bool Load(FileUtil::IOFile& file);
|
bool Load(FileUtil::IOFile& file);
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ struct ShaderDiskCacheDump {
|
||||||
class ShaderDiskCache {
|
class ShaderDiskCache {
|
||||||
public:
|
public:
|
||||||
explicit ShaderDiskCache(bool separable);
|
explicit ShaderDiskCache(bool separable);
|
||||||
~ShaderDiskCache();
|
~ShaderDiskCache() = default;
|
||||||
|
|
||||||
/// Loads transferable cache. If file has a old version or on failure, it deletes the file.
|
/// Loads transferable cache. If file has a old version or on failure, it deletes the file.
|
||||||
std::optional<std::vector<ShaderDiskCacheRaw>> LoadTransferable();
|
std::optional<std::vector<ShaderDiskCacheRaw>> LoadTransferable();
|
||||||
|
|
|
@ -19,8 +19,6 @@ class System;
|
||||||
|
|
||||||
namespace OpenGL {
|
namespace OpenGL {
|
||||||
|
|
||||||
class ShaderDiskCacheOpenGL;
|
|
||||||
|
|
||||||
enum class UniformBindings : GLuint { Common, VS, GS };
|
enum class UniformBindings : GLuint { Common, VS, GS };
|
||||||
|
|
||||||
struct LightSrc {
|
struct LightSrc {
|
||||||
|
|
Loading…
Reference in a new issue