[PICA] Texture cache v0.1
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "logger.hpp"
|
||||
#include "opengl.hpp"
|
||||
#include "surface_cache.hpp"
|
||||
#include "textures.hpp"
|
||||
|
||||
// More circular dependencies!
|
||||
class GPU;
|
||||
@@ -25,6 +26,8 @@ class Renderer {
|
||||
|
||||
SurfaceCache<DepthBuffer, 10> depthBufferCache;
|
||||
SurfaceCache<ColourBuffer, 10> colourBufferCache;
|
||||
SurfaceCache<Texture, 16> textureCache;
|
||||
|
||||
OpenGL::uvec2 fbSize; // The size of the framebuffer (ie both the colour and depth buffer)'
|
||||
|
||||
u32 colourBufferLoc; // Location in 3DS VRAM for the colour buffer
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
#include "surfaces.hpp"
|
||||
#include "textures.hpp"
|
||||
|
||||
// Surface cache class that can fit "capacity" instances of the "SurfaceType" class of surfaces
|
||||
// SurfaceType *must* have all of the following
|
||||
@@ -16,8 +17,8 @@ template <typename SurfaceType, size_t capacity>
|
||||
class SurfaceCache {
|
||||
// Vanilla std::optional can't hold actual references
|
||||
using OptionalRef = std::optional<std::reference_wrapper<SurfaceType>>;
|
||||
static_assert(std::is_same<SurfaceType, ColourBuffer>() || std::is_same<SurfaceType, DepthBuffer>(),
|
||||
"Invalid surface type");
|
||||
static_assert(std::is_same<SurfaceType, ColourBuffer>() || std::is_same<SurfaceType, DepthBuffer>() ||
|
||||
std::is_same<SurfaceType, Texture>(), "Invalid surface type");
|
||||
|
||||
size_t size;
|
||||
std::array<SurfaceType, capacity> buffer;
|
||||
|
||||
Reference in New Issue
Block a user