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