[PICA] Fixed vertex attribute uploads

This commit is contained in:
wheremyfoodat 2022-09-23 02:19:23 +03:00
parent a86796936f
commit 4b3c7955dd
6 changed files with 60 additions and 9 deletions

View file

@ -65,7 +65,11 @@ class GPU {
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;
u32 fixedAttribMask = 0; // Which attributes are fixed?
u32 fixedAttribIndex = 0; // Which fixed attribute are we writing to ([0, 12] range)
u32 fixedAttribCount = 0; // How many attribute components have we written? When we get to 4 the attr will actually get submitted
std::array<u32, 3> fixedAttrBuff; // Buffer to hold fixed attributes in until they get submitted
public:
GPU(Memory& mem);

View file

@ -41,6 +41,12 @@ namespace PICAInternalRegs {
AttribInfoStart = Attrib0Offset,
AttribInfoEnd = Attrib11Config2,
// Fixed attribute registers
FixedAttribIndex = 0x232,
FixedAttribData0 = 0x233,
FixedAttribData1 = 0x234,
FixedAttribData2 = 0x235,
// Vertex shader registers
VertexShaderTransferEnd = 0x2BF,
VertexShaderTransferIndex = 0x2CB,

View file

@ -6,6 +6,11 @@
#include "opengl.hpp"
#include "PICA/float_types.hpp"
enum class ShaderType {
Vertex, Geometry
};
template <ShaderType type>
class PICAShader {
int bufferIndex; // Index of the next instruction to overwrite
using f24 = Floats::f24;
@ -19,7 +24,8 @@ public:
std::array<u32, 4> intUniforms;
std::array<vec4f, 8> floatUniforms;
std::array<vec4f, 16> attributes;
std::array<vec4f, 16> fixedAttributes; // Fixed vertex attributes
std::array<vec4f, 16> attributes; // Attributes past to the shader
std::array<vec4f, 16> outputs;
void reset() {

View file

@ -4,8 +4,8 @@
class ShaderUnit {
public:
PICAShader vs; // Vertex shader
PICAShader gs; // Geometry shader
PICAShader<ShaderType::Vertex> vs; // Vertex shader
PICAShader<ShaderType::Geometry> gs; // Geometry shader
void reset();
};