rasterizer_interface: Add disk cache entry for the rasterizer

This commit is contained in:
ReinUsesLisp 2019-01-13 22:05:53 -03:00
parent 84412591c9
commit 0ed5d728ca
6 changed files with 17 additions and 0 deletions

View file

@ -175,6 +175,9 @@ struct System::Impl {
return static_cast<ResultStatus>(static_cast<u32>(ResultStatus::ErrorLoader) +
static_cast<u32>(load_result));
}
renderer->Rasterizer().LoadDiskResources();
status = ResultStatus::Success;
return status;
}

View file

@ -61,5 +61,8 @@ public:
/// Increase/decrease the number of object in pages touching the specified region
virtual void UpdatePagesCachedCount(Tegra::GPUVAddr addr, u64 size, int delta) {}
/// Initialize disk cached resources for the game being emulated
virtual void LoadDiskResources() {}
};
} // namespace VideoCore

View file

@ -22,6 +22,7 @@
#include "core/settings.h"
#include "video_core/engines/maxwell_3d.h"
#include "video_core/renderer_opengl/gl_rasterizer.h"
#include "video_core/renderer_opengl/gl_shader_cache.h"
#include "video_core/renderer_opengl/gl_shader_gen.h"
#include "video_core/renderer_opengl/maxwell_to_gl.h"
#include "video_core/renderer_opengl/renderer_opengl.h"
@ -477,6 +478,10 @@ void RasterizerOpenGL::UpdatePagesCachedCount(VAddr addr, u64 size, int delta) {
cached_pages.add({pages_interval, delta});
}
void RasterizerOpenGL::LoadDiskResources() {
shader_cache.LoadDiskCache();
}
std::pair<bool, bool> RasterizerOpenGL::ConfigureFramebuffers(
OpenGLState& current_state, bool using_color_fb, bool using_depth_fb, bool preserve_contents,
std::optional<std::size_t> single_color_target) {

View file

@ -60,6 +60,7 @@ public:
u32 pixel_stride) override;
bool AccelerateDrawBatch(bool is_indexed) override;
void UpdatePagesCachedCount(Tegra::GPUVAddr addr, u64 size, int delta) override;
void LoadDiskResources() override;
/// Maximum supported size that a constbuffer can have in bytes.
static constexpr std::size_t MaxConstbufferSize = 0x10000;

View file

@ -225,6 +225,8 @@ void CachedShader::CalculateProperties() {
ShaderCacheOpenGL::ShaderCacheOpenGL(RasterizerOpenGL& rasterizer) : RasterizerCache{rasterizer} {}
void ShaderCacheOpenGL::LoadDiskCache() {}
Shader ShaderCacheOpenGL::GetStageProgram(Maxwell::ShaderProgram program) {
if (!Core::System::GetInstance().GPU().Maxwell3D().dirty_flags.shaders) {
return last_shaders[static_cast<u32>(program)];

View file

@ -103,6 +103,9 @@ class ShaderCacheOpenGL final : public RasterizerCache<Shader> {
public:
explicit ShaderCacheOpenGL(RasterizerOpenGL& rasterizer);
/// Loads disk cache for the current game
void LoadDiskCache();
/// Gets the current specified shader stage program
Shader GetStageProgram(Maxwell::ShaderProgram program);