mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-03 12:27:21 +12:00
[PICA] Start implementing shader interpreter
This commit is contained in:
parent
4b3c7955dd
commit
057aa57422
5 changed files with 32 additions and 6 deletions
|
@ -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();
|
||||
};
|
|
@ -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();
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue