[PICA] Why is attribute fetching so hard

This commit is contained in:
wheremyfoodat 2022-09-23 00:55:16 +03:00
parent 39bfeda586
commit 8770e6dc41
6 changed files with 44 additions and 8 deletions

View file

@ -146,4 +146,4 @@ namespace Floats {
using f20 = Float<12, 7>;
using f16 = Float<10, 5>;
} // namespace Pica
} // namespace Floats

View file

@ -51,6 +51,12 @@ class GPU {
struct AttribInfo {
u32 offset = 0; // Offset from base vertex array
int size = 0; // Bytes per vertex
u32 config1 = 0;
u32 config2 = 0;
u64 getConfigFull() {
return u64(config1) | (u64(config2) << 32);
}
};
std::array<AttribInfo, maxAttribCount> attributeInfo; // Info for each of the 12 attributes

View file

@ -2,8 +2,9 @@
namespace PICAInternalRegs {
enum : u32 {
// Geometry pipelin regs
// Geometry pipeline regs
VertexAttribLoc = 0x200,
AttribFormatLow = 0x201,
AttribFormatHigh = 0x202,
IndexBufferConfig = 0x227,
VertexCountReg = 0x228,

View file

@ -3,9 +3,13 @@
#include <array>
#include <cstring>
#include "helpers.hpp"
#include "opengl.hpp"
#include "PICA/float_types.hpp"
class PICAShader {
int bufferIndex; // Index of the next instruction to overwrite
using f24 = Floats::f24;
using vec4f = OpenGL::Vector<f24, 4>;
public:
std::array<u32, 512> loadedShader; // Currently loaded & active shader
@ -13,16 +17,23 @@ public:
u32 boolUniform;
std::array<u32, 4> intUniforms;
std::array<u32, 8> floatUniforms;
std::array<vec4f, 8> floatUniforms;
std::array<vec4f, 16> attributes;
std::array<vec4f, 16> outputs;
void reset() {
loadedShader.fill(0);
bufferedShader.fill(0);
intUniforms.fill(0);
floatUniforms.fill(0);
boolUniform = 0;
bufferIndex = 0;
const vec4f zero = vec4f({ f24::fromFloat32(0.0), f24::fromFloat32(0.0), f24::fromFloat32(0.0), f24::fromFloat32(0.0) });
attributes.fill(zero);
floatUniforms.fill(zero);
outputs.fill(zero);
}
void finalize() {