Files
AnyPS5/core/shader/recompiler/ShaderDiskCache.hpp
T
Adrià FranchandClaude ac1c3b775b fix(agc): read the base level of a mipmapped view through unnormalized coordinates only where the hardware does
Multi-level views, and views starting above mip 0, are bound as their base
level only when every use of the image is image_sample_lz through an
unnormalized S# without minimum LOD or LOD bias, the case measured exact on
RDNA2. Selected-LOD, implicit-LOD and offset uses keep throwing.

The recompiler records selected-LOD uses (SamplerUseNonZeroLod) and proves
the case per image (imageUnnormalizedBaseLevel); the shader disk cache
format goes to 27.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-11 11:07:25 +02:00

57 lines
1.6 KiB
C++

#ifndef CORE_SHADER_RECOMPILER_SHADERDISKCACHE_HPP
#define CORE_SHADER_RECOMPILER_SHADERDISKCACHE_HPP
#include "CompiledVariant.hpp"
#include <cstddef>
#include <cstdint>
#include <filesystem>
#include <memory>
#include <span>
#include <string>
#include <vector>
namespace ShaderRecompiler::ShaderDiskCache {
inline constexpr std::uint32_t FormatVersion = 27;
enum class LoadStatus {
Loaded,
Absent,
KeyMismatch,
Rejected,
};
struct Counters {
std::uint64_t hits = 0;
std::uint64_t misses = 0;
std::uint64_t writes = 0;
std::uint64_t loadFailures = 0;
std::uint64_t writeFailures = 0;
std::uint64_t bytesRead = 0;
std::uint64_t bytesWritten = 0;
};
[[nodiscard]] std::uint64_t SourceVersion();
void BuildKey(const RecompileRequest& request, std::uint32_t hostSubgroupSize, std::vector<std::byte>& key);
[[nodiscard]] std::string EntryName(std::span<const std::byte> key);
void EncodeResult(const RecompileResult& result, std::vector<std::byte>& out);
[[nodiscard]] bool DecodeResult(std::span<const std::byte> bytes, RecompileResult& result);
[[nodiscard]] std::vector<std::byte> EncodeEntry(std::span<const std::byte> key, const CompiledVariant& variant);
[[nodiscard]] LoadStatus DecodeEntry(std::span<const std::byte> file, std::span<const std::byte> key, CompiledVariant& variant);
[[nodiscard]] bool Enabled();
[[nodiscard]] std::filesystem::path EntryDirectory();
[[nodiscard]] bool Load(std::span<const std::byte> key, CompiledVariant& variant);
void Store(std::vector<std::byte> key, std::shared_ptr<const CompiledVariant> variant);
void Flush();
[[nodiscard]] Counters Totals();
}
#endif