[PICA] Implement int uniforms

This commit is contained in:
wheremyfoodat 2022-09-25 17:45:59 +03:00
parent 4cda023c22
commit a5c6fb858f
5 changed files with 25 additions and 3 deletions

View file

@ -50,6 +50,11 @@ namespace PICAInternalRegs {
PrimitiveConfig = 0x25E,
// Vertex shader registers
VertexIntUniform0 = 0x2B1,
VertexIntUniform1 = 0x2B2,
VertexIntUniform2 = 0x2B3,
VertexIntUniform3 = 0x2B4,
VertexShaderTransferEnd = 0x2BF,
VertexFloatUniformIndex = 0x2C0,
VertexFloatUniformData0 = 0x2C1,

View file

@ -35,6 +35,8 @@ class PICAShader {
std::array<u32, 128> operandDescriptors;
std::array<vec4f, 16> tempRegisters; // General purpose registers the shader can use for temp values
OpenGL::Vector<s32, 2> addrRegister; // Address register
u32 pc = 0; // Program counter: Index of the next instruction we're going to execute
u32 loopCounter;
ShaderType type;
@ -102,7 +104,7 @@ public:
std::array<u32, 512> bufferedShader; // Shader to be transferred when the SH_CODETRANSFER_END reg gets written to
u32 boolUniform;
std::array<u32, 4> intUniforms;
std::array<OpenGL::Vector<u8, 4>, 4> intUniforms;
std::array<vec4f, 96> floatUniforms;
std::array<vec4f, 16> fixedAttributes; // Fixed vertex attributes
@ -164,6 +166,14 @@ public:
}
}
void uploadIntUniform(int index, u32 word) {
auto& u = intUniforms[index];
u.x() = word & 0xff;
u.y() = (word >> 8) & 0xff;
u.z() = (word >> 16) & 0xff;
u.w() = (word >> 24) & 0xff;
}
void run();
void reset();
};