Browse Source

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

nce_cpp
Yuri Kunde Schlesner 10 years ago
parent
commit
c2526d440e
  1. 8
      src/video_core/renderer_opengl/gl_rasterizer.cpp
  2. 7
      src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
  3. 8
      src/video_core/renderer_opengl/gl_rasterizer_cache.h

8
src/video_core/renderer_opengl/gl_rasterizer.cpp

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

7
src/video_core/renderer_opengl/gl_rasterizer_cache.cpp

@ -15,7 +15,7 @@
#include "video_core/renderer_opengl/pica_to_gl.h" #include "video_core/renderer_opengl/pica_to_gl.h"
RasterizerCacheOpenGL::~RasterizerCacheOpenGL() { RasterizerCacheOpenGL::~RasterizerCacheOpenGL() {
FullFlush();
InvalidateAll();
} }
MICROPROFILE_DEFINE(OpenGL_TextureUpload, "OpenGL", "Texture Upload", MP_RGB(128, 64, 192)); 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 // 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); 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(); texture_cache.clear();
} }

8
src/video_core/renderer_opengl/gl_rasterizer_cache.h

@ -23,11 +23,11 @@ public:
LoadAndBindTexture(state, texture_unit, Pica::DebugUtils::TextureInfo::FromPicaRegister(config.config, config.format)); 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: private:
struct CachedTexture { struct CachedTexture {

Loading…
Cancel
Save