mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-18 14:17:33 +01:00
RasterizerCache Redesign: Flush
flushing is now responsability of children caches instead of the cache object. This change will allow the specific cache to pass extra parameters on flushing and will allow more flexibility.
This commit is contained in:
parent
62c2404d3c
commit
a3eb91ed8c
@ -37,9 +37,6 @@ public:
|
|||||||
/// Gets the size of the shader in guest memory, required for cache management
|
/// Gets the size of the shader in guest memory, required for cache management
|
||||||
virtual std::size_t GetSizeInBytes() const = 0;
|
virtual std::size_t GetSizeInBytes() const = 0;
|
||||||
|
|
||||||
/// Wriets any cached resources back to memory
|
|
||||||
virtual void Flush() = 0;
|
|
||||||
|
|
||||||
/// Sets whether the cached object should be considered registered
|
/// Sets whether the cached object should be considered registered
|
||||||
void SetIsRegistered(bool registered) {
|
void SetIsRegistered(bool registered) {
|
||||||
is_registered = registered;
|
is_registered = registered;
|
||||||
@ -158,6 +155,8 @@ protected:
|
|||||||
return ++modified_ticks;
|
return ++modified_ticks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void FlushObjectInner(const T& object) = 0;
|
||||||
|
|
||||||
/// Flushes the specified object, updating appropriate cache state as needed
|
/// Flushes the specified object, updating appropriate cache state as needed
|
||||||
void FlushObject(const T& object) {
|
void FlushObject(const T& object) {
|
||||||
std::lock_guard lock{mutex};
|
std::lock_guard lock{mutex};
|
||||||
@ -165,7 +164,7 @@ protected:
|
|||||||
if (!object->IsDirty()) {
|
if (!object->IsDirty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
object->Flush();
|
FlushObjectInner(object);
|
||||||
object->MarkAsModified(false, *this);
|
object->MarkAsModified(false, *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,9 +42,6 @@ public:
|
|||||||
return alignment;
|
return alignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We do not have to flush this cache as things in it are never modified by us.
|
|
||||||
void Flush() override {}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VAddr cpu_addr{};
|
VAddr cpu_addr{};
|
||||||
std::size_t size{};
|
std::size_t size{};
|
||||||
@ -75,6 +72,9 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void AlignBuffer(std::size_t alignment);
|
void AlignBuffer(std::size_t alignment);
|
||||||
|
|
||||||
|
// We do not have to flush this cache as things in it are never modified by us.
|
||||||
|
void FlushObjectInner(const std::shared_ptr<CachedBufferEntry>& object) override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OGLStreamBuffer stream_buffer;
|
OGLStreamBuffer stream_buffer;
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public:
|
|||||||
/// Reloads the global region from guest memory
|
/// Reloads the global region from guest memory
|
||||||
void Reload(u32 size_);
|
void Reload(u32 size_);
|
||||||
|
|
||||||
void Flush() override;
|
void Flush();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VAddr cpu_addr{};
|
VAddr cpu_addr{};
|
||||||
@ -65,6 +65,12 @@ public:
|
|||||||
GlobalRegion GetGlobalRegion(const GLShader::GlobalMemoryEntry& descriptor,
|
GlobalRegion GetGlobalRegion(const GLShader::GlobalMemoryEntry& descriptor,
|
||||||
Tegra::Engines::Maxwell3D::Regs::ShaderStage stage);
|
Tegra::Engines::Maxwell3D::Regs::ShaderStage stage);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
void FlushObjectInner(const GlobalRegion& object) override {
|
||||||
|
object->Flush();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GlobalRegion TryGetReservedGlobalRegion(CacheAddr addr, u32 size) const;
|
GlobalRegion TryGetReservedGlobalRegion(CacheAddr addr, u32 size) const;
|
||||||
GlobalRegion GetUncachedGlobalRegion(GPUVAddr addr, u8* host_ptr, u32 size);
|
GlobalRegion GetUncachedGlobalRegion(GPUVAddr addr, u8* host_ptr, u32 size);
|
||||||
|
@ -371,10 +371,6 @@ public:
|
|||||||
return memory_size;
|
return memory_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Flush() override {
|
|
||||||
FlushGLBuffer();
|
|
||||||
}
|
|
||||||
|
|
||||||
const OGLTexture& Texture() const {
|
const OGLTexture& Texture() const {
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
@ -473,6 +469,11 @@ public:
|
|||||||
void SignalPreDrawCall();
|
void SignalPreDrawCall();
|
||||||
void SignalPostDrawCall();
|
void SignalPostDrawCall();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void FlushObjectInner(const Surface& object) override {
|
||||||
|
object->FlushGLBuffer();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void LoadSurface(const Surface& surface);
|
void LoadSurface(const Surface& surface);
|
||||||
Surface GetSurface(const SurfaceParams& params, bool preserve_contents = true);
|
Surface GetSurface(const SurfaceParams& params, bool preserve_contents = true);
|
||||||
|
@ -56,9 +56,6 @@ public:
|
|||||||
return shader_length;
|
return shader_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We do not have to flush this cache as things in it are never modified by us.
|
|
||||||
void Flush() override {}
|
|
||||||
|
|
||||||
/// Gets the shader entries for the shader
|
/// Gets the shader entries for the shader
|
||||||
const GLShader::ShaderEntries& GetShaderEntries() const {
|
const GLShader::ShaderEntries& GetShaderEntries() const {
|
||||||
return entries;
|
return entries;
|
||||||
@ -121,6 +118,10 @@ public:
|
|||||||
/// Gets the current specified shader stage program
|
/// Gets the current specified shader stage program
|
||||||
Shader GetStageProgram(Maxwell::ShaderProgram program);
|
Shader GetStageProgram(Maxwell::ShaderProgram program);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// We do not have to flush this cache as things in it are never modified by us.
|
||||||
|
void FlushObjectInner(const Shader& object) override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unordered_map<u64, UnspecializedShader> GenerateUnspecializedShaders(
|
std::unordered_map<u64, UnspecializedShader> GenerateUnspecializedShaders(
|
||||||
const std::atomic_bool& stop_loading, const VideoCore::DiskResourceLoadCallback& callback,
|
const std::atomic_bool& stop_loading, const VideoCore::DiskResourceLoadCallback& callback,
|
||||||
|
@ -49,8 +49,6 @@ public:
|
|||||||
return alignment;
|
return alignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We do not have to flush this cache as things in it are never modified by us.
|
|
||||||
void Flush() override {}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VAddr cpu_addr{};
|
VAddr cpu_addr{};
|
||||||
@ -87,6 +85,10 @@ public:
|
|||||||
return buffer_handle;
|
return buffer_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// We do not have to flush this cache as things in it are never modified by us.
|
||||||
|
void FlushObjectInner(const std::shared_ptr<CachedBufferEntry>& object) override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void AlignBuffer(std::size_t alignment);
|
void AlignBuffer(std::size_t alignment);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user