mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-21 12:59:14 +12:00
[GPU] Surface cache vol 1
This commit is contained in:
parent
57ef4e25e7
commit
ecbb33b906
7 changed files with 276 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
|||
#include "helpers.hpp"
|
||||
#include "logger.hpp"
|
||||
#include "opengl.hpp"
|
||||
#include "surface_cache.hpp"
|
||||
|
||||
struct Vertex {
|
||||
OpenGL::vec4 position;
|
||||
|
@ -21,6 +22,17 @@ class Renderer {
|
|||
GLint alphaControlLoc = -1;
|
||||
u32 oldAlphaControl = 0;
|
||||
|
||||
SurfaceCache<DepthBuffer, 10> depthBufferCache;
|
||||
SurfaceCache<ColourBuffer, 10> colourBufferCache;
|
||||
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
|
||||
ColourBuffer::Formats colourBufferFormat; // Format of the colours stored in the colour buffer
|
||||
|
||||
// Same for the depth/stencil buffer
|
||||
u32 depthBufferLoc;
|
||||
DepthBuffer::Formats depthBufferFormat;
|
||||
|
||||
// Dummy VAO/VBO for blitting the final output
|
||||
OpenGL::VertexArray dummyVAO;
|
||||
OpenGL::VertexBuffer dummyVBO;
|
||||
|
@ -28,6 +40,8 @@ class Renderer {
|
|||
static constexpr u32 regNum = 0x300; // Number of internal PICA registers
|
||||
const std::array<u32, regNum>& regs;
|
||||
|
||||
OpenGL::Framebuffer getColourFBO();
|
||||
|
||||
MAKE_LOG_FUNCTION(log, rendererLogger)
|
||||
|
||||
public:
|
||||
|
@ -40,5 +54,19 @@ public:
|
|||
void clearBuffer(u32 startAddress, u32 endAddress, u32 value, u32 control); // Clear a GPU buffer in VRAM
|
||||
void drawVertices(OpenGL::Primitives primType, Vertex* vertices, u32 count); // Draw the given vertices
|
||||
|
||||
void setFBSize(u32 width, u32 height) {
|
||||
fbSize.x() = width;
|
||||
fbSize.y() = height;
|
||||
}
|
||||
|
||||
void setColourFormat(ColourBuffer::Formats format) { colourBufferFormat = format; }
|
||||
void setColourFormat(u32 format) { colourBufferFormat = static_cast<ColourBuffer::Formats>(format); }
|
||||
|
||||
void setDepthFormat(DepthBuffer::Formats format) { depthBufferFormat = format; }
|
||||
void setDepthFormat(u32 format) { depthBufferFormat = static_cast<DepthBuffer::Formats>(format); }
|
||||
|
||||
void setColourBufferLoc(u32 loc) { colourBufferLoc = loc; }
|
||||
void setDepthBufferLoc(u32 loc) { depthBufferLoc = loc; }
|
||||
|
||||
static constexpr u32 vertexBufferSize = 0x1500;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue