mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-03 12:27:21 +12:00
Geometry pipeline v2
Co-Authored-By: Sky <skylersaleh@gmail.com>
This commit is contained in:
parent
1019f65824
commit
e80679fe77
9 changed files with 114 additions and 48 deletions
|
@ -4,6 +4,7 @@
|
|||
#include "logger.hpp"
|
||||
#include "memory.hpp"
|
||||
#include "PICA/float_types.hpp"
|
||||
#include "PICA/regs.hpp"
|
||||
#include "PICA/shader_unit.hpp"
|
||||
#include "renderer_gl/renderer_gl.hpp"
|
||||
|
||||
|
@ -19,6 +20,7 @@ class GPU {
|
|||
static constexpr u32 regNum = 0x300;
|
||||
static constexpr u32 vramSize = 6_MB;
|
||||
std::array<u32, regNum> regs; // GPU internal registers
|
||||
std::array<vec4f, 16> currentAttributes; // Vertex attributes before being passed to the shader
|
||||
|
||||
template <bool indexed>
|
||||
void drawArrays();
|
||||
|
@ -31,12 +33,17 @@ class GPU {
|
|||
int size = 0; // Bytes per vertex
|
||||
u32 config1 = 0;
|
||||
u32 config2 = 0;
|
||||
u32 componentCount = 0; // Number of components for the attribute
|
||||
|
||||
u64 getConfigFull() {
|
||||
return u64(config1) | (u64(config2) << 32);
|
||||
}
|
||||
};
|
||||
|
||||
u64 getVertexShaderInputConfig() {
|
||||
return u64(regs[PICAInternalRegs::VertexShaderInputCfgLow]) | (u64(regs[PICAInternalRegs::VertexShaderInputCfgHigh]) << 32);
|
||||
}
|
||||
|
||||
std::array<AttribInfo, maxAttribCount> attributeInfo; // Info for each of the 12 attributes
|
||||
u32 totalAttribCount = 0; // Number of vertex attributes to send to VS
|
||||
u32 fixedAttribMask = 0; // Which attributes are fixed?
|
||||
|
|
|
@ -10,6 +10,7 @@ namespace PICAInternalRegs {
|
|||
|
||||
DepthScale = 0x4D,
|
||||
DepthOffset = 0x4E,
|
||||
ShaderOutputCount = 0x4F,
|
||||
|
||||
// Framebuffer registers
|
||||
AlphaTestConfig = 0x104,
|
||||
|
@ -85,6 +86,10 @@ namespace PICAInternalRegs {
|
|||
VertexFloatUniformData6 = 0x2C7,
|
||||
VertexFloatUniformData7 = 0x2C8,
|
||||
|
||||
VertexShaderInputBufferCfg = 0x2B9,
|
||||
VertexShaderInputCfgLow = 0x2BB,
|
||||
VertexShaderInputCfgHigh = 0x2BC,
|
||||
|
||||
VertexShaderTransferIndex = 0x2CB,
|
||||
VertexShaderData0 = 0x2CC,
|
||||
VertexShaderData1 = 0x2CD,
|
||||
|
|
|
@ -163,7 +163,7 @@ public:
|
|||
std::array<vec4f, 96> floatUniforms;
|
||||
|
||||
std::array<vec4f, 16> fixedAttributes; // Fixed vertex attributes
|
||||
std::array<vec4f, 16> attributes; // Attributes passed to the shader
|
||||
std::array<vec4f, 16> inputs; // Attributes passed to the shader
|
||||
std::array<vec4f, 16> outputs;
|
||||
|
||||
PICAShader(ShaderType type) : type(type) {}
|
||||
|
|
|
@ -120,10 +120,6 @@ namespace Helpers {
|
|||
static_for_impl<T, Begin>( std::forward<Func>(f), std::make_integer_sequence<T, End - Begin>{ } );
|
||||
}
|
||||
|
||||
static constexpr inline u8 get8BitColor (u8 colorRGB555) {
|
||||
return (colorRGB555 << 3) | (colorRGB555 >> 2);
|
||||
}
|
||||
|
||||
// For values < 0x99
|
||||
static constexpr inline u8 incBCDByte(u8 value) {
|
||||
return ((value & 0xf) == 0x9) ? value + 7 : value + 1;
|
||||
|
|
|
@ -12,6 +12,7 @@ class GPU;
|
|||
struct Vertex {
|
||||
OpenGL::vec4 position;
|
||||
OpenGL::vec4 colour;
|
||||
OpenGL::vec2 UVs;
|
||||
};
|
||||
|
||||
class Renderer {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue