[PICA] Start implementing shader interpreter

This commit is contained in:
wheremyfoodat 2022-09-23 02:43:51 +03:00
parent 4b3c7955dd
commit 057aa57422
5 changed files with 32 additions and 6 deletions

View file

@ -10,12 +10,13 @@ enum class ShaderType {
Vertex, Geometry
};
template <ShaderType type>
class PICAShader {
int bufferIndex; // Index of the next instruction to overwrite
using f24 = Floats::f24;
using vec4f = OpenGL::Vector<f24, 4>;
int bufferIndex; // Index of the next instruction to overwrite for shader uploads
ShaderType type;
public:
std::array<u32, 512> loadedShader; // Currently loaded & active shader
std::array<u32, 512> bufferedShader; // Shader to be transferred when the SH_CODETRANSFER_END reg gets written to
@ -28,6 +29,8 @@ public:
std::array<vec4f, 16> attributes; // Attributes past to the shader
std::array<vec4f, 16> outputs;
PICAShader(ShaderType type) : type(type) {}
void reset() {
loadedShader.fill(0);
bufferedShader.fill(0);
@ -55,4 +58,6 @@ public:
bufferedShader[bufferIndex++] = word;
bufferIndex &= 511;
}
void run();
};

View file

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