yuzu-emu
/
yuzu
Archived
1
0
Fork 0

OpenGL: Rename cache functions to better match what they actually do

This commit is contained in:
Yuri Kunde Schlesner 2015-12-06 17:02:35 -08:00
parent 87df493b5b
commit da80ece8b9
3 changed files with 11 additions and 12 deletions

View File

@ -135,7 +135,7 @@ void RasterizerOpenGL::Reset() {
SetShader();
res_cache.FullFlush();
res_cache.InvalidateAll();
}
void RasterizerOpenGL::AddTriangle(const Pica::Shader::OutputVertex& v0,
@ -176,8 +176,8 @@ void RasterizerOpenGL::DrawTriangles() {
u32 cur_fb_depth_size = Pica::Regs::BytesPerDepthPixel(regs.framebuffer.depth_format)
* regs.framebuffer.GetWidth() * regs.framebuffer.GetHeight();
res_cache.NotifyFlush(cur_fb_color_addr, cur_fb_color_size, true);
res_cache.NotifyFlush(cur_fb_depth_addr, cur_fb_depth_size, true);
res_cache.InvalidateInRange(cur_fb_color_addr, cur_fb_color_size, true);
res_cache.InvalidateInRange(cur_fb_depth_addr, cur_fb_depth_size, true);
}
void RasterizerOpenGL::CommitFramebuffer() {
@ -328,7 +328,7 @@ void RasterizerOpenGL::NotifyFlush(PAddr addr, u32 size) {
ReloadDepthBuffer();
// Notify cache of flush in case the region touches a cached resource
res_cache.NotifyFlush(addr, size);
res_cache.InvalidateInRange(addr, size);
}
void RasterizerOpenGL::SamplerInfo::Create() {

View File

@ -15,7 +15,7 @@
#include "video_core/renderer_opengl/pica_to_gl.h"
RasterizerCacheOpenGL::~RasterizerCacheOpenGL() {
FullFlush();
InvalidateAll();
}
MICROPROFILE_DEFINE(OpenGL_TextureUpload, "OpenGL", "Texture Upload", MP_RGB(128, 64, 192));
@ -58,8 +58,7 @@ void RasterizerCacheOpenGL::LoadAndBindTexture(OpenGLState &state, unsigned text
}
}
void RasterizerCacheOpenGL::NotifyFlush(PAddr addr, u32 size, bool ignore_hash) {
// Flush any texture that falls in the flushed region
void RasterizerCacheOpenGL::InvalidateInRange(PAddr addr, u32 size, bool ignore_hash) {
// TODO: Optimize by also inserting upper bound (addr + size) of each texture into the same map and also narrow using lower_bound
auto cache_upper_bound = texture_cache.upper_bound(addr + size);
@ -77,6 +76,6 @@ void RasterizerCacheOpenGL::NotifyFlush(PAddr addr, u32 size, bool ignore_hash)
}
}
void RasterizerCacheOpenGL::FullFlush() {
void RasterizerCacheOpenGL::InvalidateAll() {
texture_cache.clear();
}

View File

@ -23,11 +23,11 @@ public:
LoadAndBindTexture(state, texture_unit, Pica::DebugUtils::TextureInfo::FromPicaRegister(config.config, config.format));
}
/// Flush any cached resource that touches the flushed region
void NotifyFlush(PAddr addr, u32 size, bool ignore_hash = false);
/// Invalidate any cached resource intersecting the specified region.
void InvalidateInRange(PAddr addr, u32 size, bool ignore_hash = false);
/// Flush all cached OpenGL resources tracked by this cache manager
void FullFlush();
/// Invalidate all cached OpenGL resources tracked by this cache manager
void InvalidateAll();
private:
struct CachedTexture {