Add PICA texel-format and topology types

Slowly stepping the codebase towards having renderer-agnostic types and keeping the translation of PICA-types to OpenGL/VK/DX/Software/etc to the renderer-backend.
This commit is contained in:
Wunkolo 2023-06-17 11:59:45 -07:00
parent d0ae5f0546
commit 78a3f9fa23
6 changed files with 85 additions and 76 deletions

View file

@ -7,6 +7,7 @@
#include "opengl.hpp"
#include "surface_cache.hpp"
#include "textures.hpp"
#include "PICA/regs.hpp"
// More circular dependencies!
class GPU;
@ -46,11 +47,11 @@ class Renderer {
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
PICAColorFmt colourBufferFormat; // Format of the colours stored in the colour buffer
// Same for the depth/stencil buffer
u32 depthBufferLoc;
DepthBuffer::Formats depthBufferFormat;
PICADepthFmt depthBufferFormat;
// Dummy VAO/VBO for blitting the final output
OpenGL::VertexArray dummyVAO;
@ -75,23 +76,19 @@ class Renderer {
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 displayTransfer(u32 inputAddr, u32 outputAddr, u32 inputSize, u32 outputSize, u32 flags); // Perform display transfer
void drawVertices(OpenGL::Primitives primType, std::span<const Vertex> vertices); // Draw the given vertices
void drawVertices(PICAPrimType primType, std::span<const Vertex> vertices); // 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) {
if (format == 1) {
void setColourFormat(PICAColorFmt format) { colourBufferFormat = format; }
void setDepthFormat(PICADepthFmt format) {
if (format == PICADepthFmt::Unknown1) {
Helpers::panic("[PICA] Undocumented depth-stencil mode!");
}
depthBufferFormat = static_cast<DepthBuffer::Formats>(format);
depthBufferFormat = format;
}
void setColourBufferLoc(u32 loc) { colourBufferLoc = loc; }