2015-05-19 06:21:33 +02:00
|
|
|
// Copyright 2015 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "gl_state.h"
|
|
|
|
#include "gl_resource_manager.h"
|
|
|
|
#include "video_core/pica.h"
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
class RasterizerCacheOpenGL : NonCopyable {
|
|
|
|
public:
|
|
|
|
~RasterizerCacheOpenGL();
|
|
|
|
|
|
|
|
/// Loads a texture from 3DS memory to OpenGL and caches it (if not already cached)
|
|
|
|
void LoadAndBindTexture(OpenGLState &state, unsigned texture_unit, const Pica::Regs::FullTextureConfig& config);
|
|
|
|
|
|
|
|
/// Flush any cached resource that touches the flushed region
|
2015-08-25 04:11:46 +02:00
|
|
|
void NotifyFlush(PAddr addr, u32 size, bool ignore_hash = false);
|
2015-05-19 06:21:33 +02:00
|
|
|
|
|
|
|
/// Flush all cached OpenGL resources tracked by this cache manager
|
|
|
|
void FullFlush();
|
|
|
|
|
|
|
|
private:
|
|
|
|
struct CachedTexture {
|
|
|
|
OGLTexture texture;
|
|
|
|
GLuint width;
|
|
|
|
GLuint height;
|
|
|
|
u32 size;
|
2015-08-25 04:11:46 +02:00
|
|
|
u64 hash;
|
|
|
|
PAddr addr;
|
2015-05-19 06:21:33 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
std::map<PAddr, std::unique_ptr<CachedTexture>> texture_cache;
|
|
|
|
};
|