mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-21 12:59:14 +12:00
Separate renderer and PICA completely
This commit is contained in:
parent
9f792c2cf5
commit
57ef4e25e7
6 changed files with 65 additions and 37 deletions
44
include/renderer_gl/renderer_gl.hpp
Normal file
44
include/renderer_gl/renderer_gl.hpp
Normal file
|
@ -0,0 +1,44 @@
|
|||
#pragma once
|
||||
#include <array>
|
||||
#include "helpers.hpp"
|
||||
#include "logger.hpp"
|
||||
#include "opengl.hpp"
|
||||
|
||||
struct Vertex {
|
||||
OpenGL::vec4 position;
|
||||
OpenGL::vec4 colour;
|
||||
};
|
||||
|
||||
class Renderer {
|
||||
// OpenGL renderer state
|
||||
OpenGL::Framebuffer fbo;
|
||||
OpenGL::Texture fboTexture;
|
||||
OpenGL::Program triangleProgram;
|
||||
OpenGL::Program displayProgram;
|
||||
|
||||
OpenGL::VertexArray vao;
|
||||
OpenGL::VertexBuffer vbo;
|
||||
GLint alphaControlLoc = -1;
|
||||
u32 oldAlphaControl = 0;
|
||||
|
||||
// Dummy VAO/VBO for blitting the final output
|
||||
OpenGL::VertexArray dummyVAO;
|
||||
OpenGL::VertexBuffer dummyVBO;
|
||||
|
||||
static constexpr u32 regNum = 0x300; // Number of internal PICA registers
|
||||
const std::array<u32, regNum>& regs;
|
||||
|
||||
MAKE_LOG_FUNCTION(log, rendererLogger)
|
||||
|
||||
public:
|
||||
Renderer(const std::array<u32, regNum>& internalRegs) : regs(internalRegs) {}
|
||||
|
||||
void reset();
|
||||
void display(); // Display the 3DS screen contents to the window
|
||||
void initGraphicsContext(); // Initialize graphics context
|
||||
void getGraphicsContext(); // Set up graphics context for rendering
|
||||
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
|
||||
|
||||
static constexpr u32 vertexBufferSize = 0x1500;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue