mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-20 20:49:12 +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
|
@ -71,7 +71,9 @@ void GPU::drawArrays() {
|
|||
for (int attrCount = 0; attrCount < totalAttribCount; attrCount++) {
|
||||
// Check if attribute is fixed or not
|
||||
if (fixedAttribMask & (1 << attrCount)) { // Fixed attribute
|
||||
|
||||
vec4f& fixedAttr = shaderUnit.vs.fixedAttributes[attrCount]; // TODO: Is this how it works?
|
||||
vec4f& inputAttr = shaderUnit.vs.attributes[attrCount];
|
||||
std::memcpy(&inputAttr, &fixedAttr, sizeof(vec4f)); // Copy fixed attr to input attr
|
||||
} else { // Non-fixed attribute
|
||||
auto& attr = attributeInfo[attrCount]; // Get information for this attribute
|
||||
u64 attrCfg = attr.getConfigFull(); // Get config1 | (config2 << 32)
|
||||
|
@ -113,5 +115,7 @@ void GPU::drawArrays() {
|
|||
printf("Attribute %d, type: %d, component count: %d\n", attrCount, attribType, componentCount);
|
||||
}
|
||||
}
|
||||
|
||||
shaderUnit.vs.run(); // Run vertex shader for vertex
|
||||
}
|
||||
}
|
14
src/core/PICA/shader_interpreter.cpp
Normal file
14
src/core/PICA/shader_interpreter.cpp
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include "PICA/shader.hpp"
|
||||
|
||||
void PICAShader::run() {
|
||||
u32 pc = 0; // Program counter
|
||||
|
||||
while (true) {
|
||||
const u32 instruction = loadedShader[pc++];
|
||||
const u32 opcode = instruction >> 26; // Top 6 bits are the opcode
|
||||
|
||||
switch (opcode) {
|
||||
default:Helpers::panic("Unimplemented PICA instruction %08X (Opcode = %02X)", instruction, opcode);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue