mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-30 10:42:47 +01:00
rasterizer_cache: Reintroduce method for flushing.
This commit is contained in:
parent
9b929e934b
commit
0be7e82289
3 changed files with 23 additions and 0 deletions
|
@ -17,6 +17,22 @@
|
||||||
template <class T>
|
template <class T>
|
||||||
class RasterizerCache : NonCopyable {
|
class RasterizerCache : NonCopyable {
|
||||||
public:
|
public:
|
||||||
|
/// Write any cached resources overlapping the region back to memory (if dirty)
|
||||||
|
void FlushRegion(Tegra::GPUVAddr addr, size_t size) {
|
||||||
|
if (size == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const ObjectInterval interval{addr, addr + size};
|
||||||
|
for (auto& pair : boost::make_iterator_range(object_cache.equal_range(interval))) {
|
||||||
|
for (auto& cached_object : pair.second) {
|
||||||
|
if (!cached_object)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
cached_object->Flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Mark the specified region as being invalidated
|
/// Mark the specified region as being invalidated
|
||||||
void InvalidateRegion(VAddr addr, u64 size) {
|
void InvalidateRegion(VAddr addr, u64 size) {
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
|
@ -71,6 +87,7 @@ protected:
|
||||||
void Unregister(const T& object) {
|
void Unregister(const T& object) {
|
||||||
auto& rasterizer = Core::System::GetInstance().Renderer().Rasterizer();
|
auto& rasterizer = Core::System::GetInstance().Renderer().Rasterizer();
|
||||||
rasterizer.UpdatePagesCachedCount(object->GetAddr(), object->GetSizeInBytes(), -1);
|
rasterizer.UpdatePagesCachedCount(object->GetAddr(), object->GetSizeInBytes(), -1);
|
||||||
|
object->Flush();
|
||||||
object_cache.subtract({GetInterval(object), ObjectSet{object}});
|
object_cache.subtract({GetInterval(object), ObjectSet{object}});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,9 @@ struct CachedBufferEntry final {
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We do not have to flush this cache as things in it are never modified by us.
|
||||||
|
void Flush() {}
|
||||||
|
|
||||||
VAddr addr;
|
VAddr addr;
|
||||||
std::size_t size;
|
std::size_t size;
|
||||||
GLintptr offset;
|
GLintptr offset;
|
||||||
|
|
|
@ -33,6 +33,9 @@ public:
|
||||||
return GLShader::MAX_PROGRAM_CODE_LENGTH * sizeof(u64);
|
return GLShader::MAX_PROGRAM_CODE_LENGTH * sizeof(u64);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We do not have to flush this cache as things in it are never modified by us.
|
||||||
|
void Flush() {}
|
||||||
|
|
||||||
/// 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;
|
||||||
|
|
Loading…
Reference in a new issue